Ticket #31522: 31522.patch
File 31522.patch, 8.0 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="..." 333 334 * @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 335 * @param string instance Optional. Limit the button to a specific instance of Quicktags, add to all instances if not present. 335 336 * @return mixed null or the button object that is needed for back-compat. 336 337 */ 337 qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {338 qt.addButton = function( id, display, arg1, arg2, access_key, title, ariaLabel, priority, instance ) { 338 339 var btn; 339 340 340 341 if ( !id || !display ) { … … 345 346 arg2 = arg2 || ''; 346 347 347 348 if ( typeof(arg1) === 'function' ) { 348 btn = new qt.Button(id, display, access_key, title, instance);349 btn = new qt.Button(id, display, access_key, title, ariaLabel, instance); 349 350 btn.callback = arg1; 350 351 } else if ( typeof(arg1) === 'string' ) { 351 btn = new qt.TagButton(id, display, arg1, arg2, access_key, title, instance);352 btn = new qt.TagButton(id, display, arg1, arg2, access_key, title, ariaLabel, instance); 352 353 } else { 353 354 return; 354 355 } … … 404 405 }; 405 406 406 407 // a plain, dumb button 407 qt.Button = function(id, display, access, title, instance) {408 qt.Button = function(id, display, access, title, ariaLabel, instance) { 408 409 var t = this; 409 410 t.id = id; 410 411 t.display = display; 411 412 t.access = ''; 412 413 t.title = title || ''; 414 t.ariaLabel = ariaLabel || ''; 413 415 t.instance = instance || ''; 414 416 }; 415 417 qt.Button.prototype.html = function(idPrefix) { 416 418 var title = this.title ? ' title="' + this.title + '"' : '', 419 ariaLabel = this.ariaLabel ? ' aria-label="' + this.ariaLabel + '"' : '', 417 420 active, on, wp, 418 421 dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw; 419 422 420 423 if ( this.id === 'fullscreen' ) { 421 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + '></button>';424 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + ariaLabel + '></button>'; 422 425 } else if ( this.id === 'dfw' ) { 423 426 active = dfw && dfw.isActive() ? '' : ' disabled="disabled"'; 424 427 on = dfw && dfw.isOn() ? ' active' : ''; 425 428 426 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + a ctive + '></button>';429 return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + ariaLabel + active + '></button>'; 427 430 } 428 431 429 return '<input type="button" id="' + idPrefix + this.id + '" class="ed_button button button-small"' + title + ' value="' + this.display + '" />';432 return '<input type="button" id="' + idPrefix + this.id + '" class="ed_button button button-small"' + title + ariaLabel + ' value="' + this.display + '" />'; 430 433 }; 431 434 qt.Button.prototype.callback = function(){}; 432 435 433 436 // a button that inserts HTML tag 434 qt.TagButton = function( id, display, tagStart, tagEnd, access, title, instance) {437 qt.TagButton = function( id, display, tagStart, tagEnd, access, title, ariaLabel, instance ) { 435 438 var t = this; 436 qt.Button.call( t, id, display, access, title, instance);439 qt.Button.call( t, id, display, access, title, ariaLabel, instance ); 437 440 t.tagStart = tagStart; 438 441 t.tagEnd = tagEnd; 439 442 }; … … 549 552 550 553 // the close tags button 551 554 qt.CloseButton = function() { 552 qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', quicktagsL10n.closeAllOpenTags);555 qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', '', quicktagsL10n.closeAllOpenTags); 553 556 }; 554 557 555 558 qt.CloseButton.prototype = new qt.Button(); … … 580 583 581 584 // the link button 582 585 qt.LinkButton = function() { 583 qt.TagButton.call(this, 'link', 'link', '', '</a>' );586 qt.TagButton.call(this, 'link', 'link', '', '</a>', '', '', quicktagsL10n.link); 584 587 }; 585 588 qt.LinkButton.prototype = new qt.TagButton(); 586 589 qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) { … … 608 611 609 612 // the img button 610 613 qt.ImgButton = function() { 611 qt.TagButton.call(this, 'img', 'img', '', '' );614 qt.TagButton.call(this, 'img', 'img', '', '', '', '', quicktagsL10n.image); 612 615 }; 613 616 qt.ImgButton.prototype = new qt.TagButton(); 614 617 qt.ImgButton.prototype.callback = function(e, c, ed, defaultValue) { … … 666 669 }; 667 670 668 671 // ensure backward compatibility 669 edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>' );670 edButtons[20] = new qt.TagButton('em','i','<em>','</em>' ),672 edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','','',quicktagsL10n.strong); 673 edButtons[20] = new qt.TagButton('em','i','<em>','</em>','','',quicktagsL10n.emphasized), 671 674 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>' ),675 edButtons[40] = new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n','','',quicktagsL10n.blockquote), 676 edButtons[50] = new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>','','',quicktagsL10n.deletion), 677 edButtons[60] = new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>','','',quicktagsL10n.insertion), 675 678 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','' ),679 edButtons[80] = new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n','','',quicktagsL10n.bulllist), 680 edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n','','',quicktagsL10n.numlist), 681 edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','','',quicktagsL10n.listitem), 682 edButtons[110] = new qt.TagButton('code','code','<code>','</code>','','',quicktagsL10n.code), 683 edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n','','','',quicktagsL10n.more), 681 684 edButtons[140] = new qt.CloseButton(); 682 685 683 686 })(); -
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 'emphasized' => esc_attr__( 'Italic' ), 103 'link' => esc_attr__( 'Insert/edit link' ), 104 'blockquote' => esc_attr__( 'Blockquote' ), 105 'deletion' => esc_attr__( 'Deleted text (strikethrough)' ), 106 'insertion' => esc_attr__( 'Added text' ), 107 'image' => esc_attr__( 'Image' ), 108 'bulllist' => esc_attr__( 'Bulleted list' ), 109 'numlist' => esc_attr__( 'Numbered list' ), 110 'listitem' => esc_attr__( 'List item' ), 111 'code' => esc_attr__( 'Code' ), 112 'more' => esc_attr__( 'Insert Read More tag' ), 101 113 ) ); 102 114 103 115 $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );