Ticket #31522: 31522.2.patch
File 31522.2.patch, 9.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/quicktags.js
330 330 * @param string arg2 Optional. Ending tag like "</span>" 331 331 * @param string access_key Deprecated Not used 332 332 * @param string title Optional. Button's title="..." 333 * @param string ariaLabel Optional. Button's aria-label="..." 334 * @param string ariaLabelClose Optional. Button's aria-label for "close tag" status 333 335 * @param int priority Optional. Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc. 334 336 * @param string instance Optional. Limit the button to a specific instance of Quicktags, add to all instances if not present. 335 337 * @return mixed null or the button object that is needed for back-compat. 336 338 */ 337 qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {339 qt.addButton = function( id, display, arg1, arg2, access_key, title, ariaLabel, ariaLabelClose, priority, instance ) { 338 340 var btn; 339 341 340 342 if ( !id || !display ) { … … 345 347 arg2 = arg2 || ''; 346 348 347 349 if ( typeof(arg1) === 'function' ) { 348 btn = new qt.Button(id, display, access_key, title, instance);350 btn = new qt.Button(id, display, access_key, title, ariaLabel, ariaLabelClose, instance); 349 351 btn.callback = arg1; 350 352 } else if ( typeof(arg1) === 'string' ) { 351 btn = new qt.TagButton(id, display, arg1, arg2, access_key, title, instance);353 btn = new qt.TagButton(id, display, arg1, arg2, access_key, title, ariaLabel, ariaLabelClose, instance); 352 354 } else { 353 355 return; 354 356 } … … 404 406 }; 405 407 406 408 // a plain, dumb button 407 qt.Button = function(id, display, access, title, instance) {409 qt.Button = function(id, display, access, title, ariaLabel, ariaLabelClose, instance) { 408 410 var t = this; 409 411 t.id = id; 410 412 t.display = display; 411 413 t.access = ''; 412 414 t.title = title || ''; 415 t.ariaLabel = ariaLabel || ''; 416 t.ariaLabelClose = ariaLabelClose || ''; 413 417 t.instance = instance || ''; 414 418 }; 415 419 qt.Button.prototype.html = function(idPrefix) { 416 420 var title = this.title ? ' title="' + this.title + '"' : '', 421 ariaLabel = this.ariaLabel ? ' aria-label="' + this.ariaLabel + '"' : '', 417 422 active, on, wp, 418 423 dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw; 419 424 420 425 if ( this.id === 'fullscreen' ) { 421 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + '></button>';426 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + ariaLabel + '></button>'; 422 427 } else if ( this.id === 'dfw' ) { 423 428 active = dfw && dfw.isActive() ? '' : ' disabled="disabled"'; 424 429 on = dfw && dfw.isOn() ? ' active' : ''; 425 430 426 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + a ctive + '></button>';431 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + ariaLabel + active + '></button>'; 427 432 } 428 433 429 return '<input type="button" id="' + idPrefix + this.id + '" class="ed_button button button-small"' + title + ' value="' + this.display + '" />';434 return '<input type="button" id="' + idPrefix + this.id + '" class="ed_button button button-small"' + title + ariaLabel + ' value="' + this.display + '" />'; 430 435 }; 431 436 qt.Button.prototype.callback = function(){}; 432 437 433 438 // a button that inserts HTML tag 434 qt.TagButton = function( id, display, tagStart, tagEnd, access, title, instance) {439 qt.TagButton = function( id, display, tagStart, tagEnd, access, title, ariaLabel, ariaLabelClose, instance ) { 435 440 var t = this; 436 qt.Button.call( t, id, display, access, title, instance);441 qt.Button.call( t, id, display, access, title, ariaLabel, ariaLabelClose, instance ); 437 442 t.tagStart = tagStart; 438 443 t.tagEnd = tagEnd; 439 444 }; … … 447 452 if ( t.tagEnd ) { 448 453 ed.openTags.push(t.id); 449 454 e.value = '/' + e.value; 455 e.setAttribute( 'aria-label', t.ariaLabelClose ); 450 456 } 451 457 }; 452 458 qt.TagButton.prototype.closeTag = function(e, ed) { … … 457 463 } 458 464 459 465 e.value = t.display; 466 e.setAttribute( 'aria-label', t.ariaLabel ); 460 467 }; 461 468 // whether a tag is open or not. Returns false if not open, or current open depth of the tag 462 469 qt.TagButton.prototype.isOpen = function (ed) { … … 549 556 550 557 // the close tags button 551 558 qt.CloseButton = function() { 552 qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', quicktagsL10n.closeAllOpenTags);559 qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', '', quicktagsL10n.closeAllOpenTags); 553 560 }; 554 561 555 562 qt.CloseButton.prototype = new qt.Button(); … … 580 587 581 588 // the link button 582 589 qt.LinkButton = function() { 583 qt.TagButton.call(this, 'link', 'link', '', '</a>' );590 qt.TagButton.call(this, 'link', 'link', '', '</a>', '', '', quicktagsL10n.link); 584 591 }; 585 592 qt.LinkButton.prototype = new qt.TagButton(); 586 593 qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) { … … 608 615 609 616 // the img button 610 617 qt.ImgButton = function() { 611 qt.TagButton.call(this, 'img', 'img', '', '' );618 qt.TagButton.call(this, 'img', 'img', '', '', '', '', quicktagsL10n.image); 612 619 }; 613 620 qt.ImgButton.prototype = new qt.TagButton(); 614 621 qt.ImgButton.prototype.callback = function(e, c, ed, defaultValue) { … … 666 673 }; 667 674 668 675 // ensure backward compatibility 669 edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>' );670 edButtons[20] = new qt.TagButton('em','i','<em>','</em>' ),676 edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','','',quicktagsL10n.strong,quicktagsL10n.strongClose); 677 edButtons[20] = new qt.TagButton('em','i','<em>','</em>','','',quicktagsL10n.emphasized,quicktagsL10n.emphasizedClose), 671 678 edButtons[30] = new qt.LinkButton(), // special case 672 edButtons[40] = new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n' ),673 edButtons[50] = new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>' ),674 edButtons[60] = new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>' ),679 edButtons[40] = new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n','','',quicktagsL10n.blockquote,quicktagsL10n.blockquoteClose), 680 edButtons[50] = new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>','','',quicktagsL10n.deletion,quicktagsL10n.deletionClose), 681 edButtons[60] = new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>','','',quicktagsL10n.insertion,quicktagsL10n.insertionClose), 675 682 edButtons[70] = new qt.ImgButton(), // special case 676 edButtons[80] = new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n' ),677 edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n' ),678 edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n' ),679 edButtons[110] = new qt.TagButton('code','code','<code>','</code>' ),680 edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n','' ),683 edButtons[80] = new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n','','',quicktagsL10n.bulllist,quicktagsL10n.bulllistClose), 684 edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n','','',quicktagsL10n.numlist,quicktagsL10n.numlistClose), 685 edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','','',quicktagsL10n.listitem,quicktagsL10n.listitemClose), 686 edButtons[110] = new qt.TagButton('code','code','<code>','</code>','','',quicktagsL10n.code,quicktagsL10n.codeClose), 687 edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n','','','',quicktagsL10n.more), 681 688 edButtons[140] = new qt.CloseButton(); 682 689 683 690 })(); -
src/wp-includes/script-loader.php
97 97 'toggleFullscreen' => esc_attr__( 'Toggle fullscreen mode' ), 98 98 'textdirection' => esc_attr__( 'text direction' ), 99 99 'toggleTextdirection' => esc_attr__( 'Toggle Editor Text Direction' ), 100 'dfw' => esc_attr__( 'Distraction-free writing mode' ) 100 'dfw' => esc_attr__( 'Distraction-free writing mode' ), 101 'strong' => esc_attr__( 'Bold' ), 102 'strongClose' => esc_attr__( 'Close bold tag' ), 103 'emphasized' => esc_attr__( 'Italic' ), 104 'emphasizedClose' => esc_attr__( 'Close italic tag' ), 105 'link' => esc_attr__( 'Insert link' ), 106 'blockquote' => esc_attr__( 'Blockquote' ), 107 'blockquoteClose' => esc_attr__( 'Close blockquote tag' ), 108 'deletion' => esc_attr__( 'Deleted text (strikethrough)' ), 109 'deletionClose' => esc_attr__( 'Close deleted text tag' ), 110 'insertion' => esc_attr__( 'Added text' ), 111 'insertionClose' => esc_attr__( 'Close added text tag' ), 112 'image' => esc_attr__( 'Insert image' ), 113 'bulllist' => esc_attr__( 'Bulleted list' ), 114 'bulllistClose' => esc_attr__( 'Close bulleted list tag' ), 115 'numlist' => esc_attr__( 'Numbered list' ), 116 'numlistClose' => esc_attr__( 'Close numbered list tag' ), 117 'listitem' => esc_attr__( 'List item' ), 118 'listitemClose' => esc_attr__( 'Close list item tag' ), 119 'code' => esc_attr__( 'Code' ), 120 'codeClose' => esc_attr__( 'Close code tag' ), 121 'more' => esc_attr__( 'Insert Read More tag' ), 101 122 ) ); 102 123 103 124 $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );