Make WordPress Core

Ticket #31522: 31522.patch

File 31522.patch, 8.0 KB (added by afercia, 10 years ago)
  • src/wp-includes/js/quicktags.js

     
    330330         * @param string arg2 Optional. Ending tag like "</span>"
    331331         * @param string access_key Deprecated Not used
    332332         * @param string title Optional. Button's title="..."
     333         * @param string ariaLabel Optional. Button's aria-label="..."
    333334         * @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.
    334335         * @param string instance Optional. Limit the button to a specific instance of Quicktags, add to all instances if not present.
    335336         * @return mixed null or the button object that is needed for back-compat.
    336337         */
    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 ) {
    338339                var btn;
    339340
    340341                if ( !id || !display ) {
     
    345346                arg2 = arg2 || '';
    346347
    347348                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);
    349350                        btn.callback = arg1;
    350351                } 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);
    352353                } else {
    353354                        return;
    354355                }
     
    404405        };
    405406
    406407        // a plain, dumb button
    407         qt.Button = function(id, display, access, title, instance) {
     408        qt.Button = function(id, display, access, title, ariaLabel, instance) {
    408409                var t = this;
    409410                t.id = id;
    410411                t.display = display;
    411412                t.access = '';
    412413                t.title = title || '';
     414                t.ariaLabel = ariaLabel || '';
    413415                t.instance = instance || '';
    414416        };
    415417        qt.Button.prototype.html = function(idPrefix) {
    416418                var title = this.title ? ' title="' + this.title + '"' : '',
     419                        ariaLabel = this.ariaLabel ? ' aria-label="' + this.ariaLabel + '"' : '',
    417420                        active, on, wp,
    418421                        dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw;
    419422
    420423                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>';
    422425                } else if ( this.id === 'dfw' ) {
    423426                        active = dfw && dfw.isActive() ? '' : ' disabled="disabled"';
    424427                        on = dfw && dfw.isOn() ? ' active' : '';
    425428
    426                         return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + active + '></button>';
     429                        return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + ariaLabel + active + '></button>';
    427430                }
    428431
    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 + '" />';
    430433        };
    431434        qt.Button.prototype.callback = function(){};
    432435
    433436        // 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 ) {
    435438                var t = this;
    436                 qt.Button.call(t, id, display, access, title, instance);
     439                qt.Button.call( t, id, display, access, title, ariaLabel, instance );
    437440                t.tagStart = tagStart;
    438441                t.tagEnd = tagEnd;
    439442        };
     
    549552
    550553        // the close tags button
    551554        qt.CloseButton = function() {
    552                 qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', quicktagsL10n.closeAllOpenTags);
     555                qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', '', quicktagsL10n.closeAllOpenTags);
    553556        };
    554557
    555558        qt.CloseButton.prototype = new qt.Button();
     
    580583
    581584        // the link button
    582585        qt.LinkButton = function() {
    583                 qt.TagButton.call(this, 'link', 'link', '', '</a>');
     586                qt.TagButton.call(this, 'link', 'link', '', '</a>', '', '', quicktagsL10n.link);
    584587        };
    585588        qt.LinkButton.prototype = new qt.TagButton();
    586589        qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) {
     
    608611
    609612        // the img button
    610613        qt.ImgButton = function() {
    611                 qt.TagButton.call(this, 'img', 'img', '', '');
     614                qt.TagButton.call(this, 'img', 'img', '', '', '', '', quicktagsL10n.image);
    612615        };
    613616        qt.ImgButton.prototype = new qt.TagButton();
    614617        qt.ImgButton.prototype.callback = function(e, c, ed, defaultValue) {
     
    666669        };
    667670
    668671        // 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),
    671674        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),
    675678        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),
    681684        edButtons[140] = new qt.CloseButton();
    682685
    683686})();
  • src/wp-includes/script-loader.php

     
    9797                'toggleFullscreen'      => esc_attr__( 'Toggle fullscreen mode' ),
    9898                'textdirection'         => esc_attr__( 'text direction' ),
    9999                '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' ),
    101113        ) );
    102114
    103115        $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );