Make WordPress Core

Changeset 26880


Ignore:
Timestamp:
12/30/2013 01:53:25 AM (13 years ago)
Author:
azaozz
Message:

TinyMCE:

  • Fix toolbar icons in IE9.
  • Remove background gradients in IE < 10.
  • Lint our plugins.
  • Add draggable attribute to the caption wrapper and make the captioned images non-draggable in Chrome.

See #24067.

Location:
trunk/src/wp-includes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/editor.css

    r26876 r26880  
    33------------------------------------------------------------------------------*/
    44
    5 .mce-panel {
     5div.mce-panel {
    66        border: 0;
    77        background: #fff;
    8 }
    9 
    10 .mce-toolbar-grp {
     8        filter: none;
     9}
     10
     11div.mce-toolbar-grp {
    1112        border-bottom: 1px solid #dedede;
    1213        background: #f5f5f5;
     
    4142        -webkit-border-radius: 2px;
    4243        border-radius: 2px;
     44        filter: none;
    4345}
    4446
     
    108110}
    109111
    110 .mce-i-bold,
    111 .mce-i-italic,
    112 .mce-i-bullist,
    113 .mce-i-numlist,
    114 .mce-i-blockquote,
    115 .mce-i-alignleft,
    116 .mce-i-aligncenter,
    117 .mce-i-alignright,
    118 .mce-i-link,
    119 .mce-i-unlink,
    120 .mce-i-wp_more,
    121 .mce-i-strikethrough,
    122 .mce-i-spellchecker,
    123 .mce-i-fullscreen,
    124 .mce-i-wp_fullscreen,
    125 .mce-i-wp_adv,
    126 .mce-i-underline,
    127 .mce-i-alignjustify,
    128 .mce-i-forecolor,
    129 .mce-i-pastetext,
    130 .mce-i-pasteword,
    131 .mce-i-removeformat,
    132 .mce-i-charmap,
    133 .mce-i-outdent,
    134 .mce-i-indent,
    135 .mce-i-undo,
    136 .mce-i-redo,
    137 .mce-i-help,
    138 .mce-i-wp_help,
    139 .mce-i-wp-media-library,
    140 .mce-i-ltr {
     112i.mce-i-bold,
     113i.mce-i-italic,
     114i.mce-i-bullist,
     115i.mce-i-numlist,
     116i.mce-i-blockquote,
     117i.mce-i-alignleft,
     118i.mce-i-aligncenter,
     119i.mce-i-alignright,
     120i.mce-i-link,
     121i.mce-i-unlink,
     122i.mce-i-wp_more,
     123i.mce-i-strikethrough,
     124i.mce-i-spellchecker,
     125i.mce-i-fullscreen,
     126i.mce-i-wp_fullscreen,
     127i.mce-i-wp_adv,
     128i.mce-i-underline,
     129i.mce-i-alignjustify,
     130i.mce-i-forecolor,
     131i.mce-i-pastetext,
     132i.mce-i-pasteword,
     133i.mce-i-removeformat,
     134i.mce-i-charmap,
     135i.mce-i-outdent,
     136i.mce-i-indent,
     137i.mce-i-undo,
     138i.mce-i-redo,
     139i.mce-i-help,
     140i.mce-i-wp_help,
     141i.mce-i-wp-media-library,
     142i.mce-i-ltr {
    141143        font: normal 20px/1 'dashicons';
    142144        padding: 0;
     
    147149}
    148150
    149 .mce-i-bold:before {
     151i.mce-i-bold:before {
    150152        content: '\f200';
    151153}
    152154
    153 .mce-i-italic:before {
     155i.mce-i-italic:before {
    154156        content: '\f201';
    155157}
    156158
    157 .mce-i-bullist:before {
     159i.mce-i-bullist:before {
    158160        content: '\f203';
    159161}
    160162
    161 .mce-i-numlist:before {
     163i.mce-i-numlist:before {
    162164        content: '\f204';
    163165}
    164166
    165 .mce-i-blockquote:before {
     167i.mce-i-blockquote:before {
    166168        content: '\f205';
    167169}
    168170
    169 .mce-i-alignleft:before {
     171i.mce-i-alignleft:before {
    170172        content: '\f206';
    171173}
    172174
    173 .mce-i-aligncenter:before {
     175i.mce-i-aligncenter:before {
    174176        content: '\f207';
    175177}
    176178
    177 .mce-i-alignright:before {
     179i.mce-i-alignright:before {
    178180        content: '\f208';
    179181}
    180182
    181 .mce-i-link:before {
     183i.mce-i-link:before {
    182184        content: '\f103';
    183185}
    184186
    185 .mce-i-unlink:before {
     187i.mce-i-unlink:before {
    186188        content: '\f225';
    187189}
    188190
    189 .mce-i-wp_more:before {
     191i.mce-i-wp_more:before {
    190192        content: '\f209';
    191193}
    192194
    193 .mce-i-strikethrough:before {
     195i.mce-i-strikethrough:before {
    194196        content: '\f224';
    195197}
    196198
    197 .mce-i-spellchecker:before {
     199i.mce-i-spellchecker:before {
    198200        content: '\f210';
    199201}
    200202
    201 .mce-i-fullscreen:before,
    202 .mce-i-wp_fullscreen:before {
     203i.mce-i-fullscreen:before,
     204i.mce-i-wp_fullscreen:before {
    203205        content: '\f211';
    204206}
    205207
    206 .mce-i-wp_adv:before {
     208i.mce-i-wp_adv:before {
    207209        content: '\f212';
    208210}
    209 .mce-i-underline:before {
     211
     212i.mce-i-underline:before {
    210213        content: '\f213';
    211214}
    212215
    213 .mce-i-alignjustify:before {
     216i.mce-i-alignjustify:before {
    214217        content: '\f214';
    215218}
    216219
    217 .mce-i-forecolor:before {
     220i.mce-i-forecolor:before {
    218221        content: '\f215';
    219222}
    220223
    221 .mce-i-pastetext:before {
     224i.mce-i-pastetext:before {
    222225        content: '\f217';
    223226}
    224227
    225 .mce-i-removeformat:before {
     228i.mce-i-removeformat:before {
    226229        content: '\f218';
    227230}
    228231
    229 .mce-i-charmap:before {
     232i.mce-i-charmap:before {
    230233        content: '\f220';
    231234}
    232235
    233 .mce-i-outdent:before {
     236i.mce-i-outdent:before {
    234237        content: '\f221';
    235238}
    236239
    237 .mce-i-indent:before {
     240i.mce-i-indent:before {
    238241        content: '\f222';
    239242}
    240243
    241 .mce-i-undo:before {
     244i.mce-i-undo:before {
    242245        content: '\f171';
    243246}
    244247
    245 .mce-i-redo:before {
     248i.mce-i-redo:before {
    246249        content: '\f172';
    247250}
    248251
    249 .mce-i-help:before,
    250 .mce-i-wp_help:before {
     252i.mce-i-help:before,
     253i.mce-i-wp_help:before {
    251254        content: '\f223';
    252255}
    253256
    254 .mce-i-wp-media-library:before {
     257i.mce-i-wp-media-library:before {
    255258        content: '\f104';
    256259}
    257260
    258 .mce-i-ltr:before {
     261i.mce-i-ltr:before {
    259262        content: '\f320';
    260263}
     
    300303}
    301304
    302 .quicktags-toolbar,
    303 .wp_themeSkin tr.mceFirst td.mceToolbar {
     305.quicktags-toolbar {
    304306        border-bottom: 1px solid #dedede;
    305307        background: #f5f5f5;
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r26876 r26880  
    55
    66        function toggleToolbars( state ) {
    7                 var iframe,
    8                         pixels = 0,
    9                         initial = state === 'hide',
    10                         toolbars = editor.theme.panel && editor.theme.panel.find('.toolbar');
     7                var iframe, initial, toolbars,
     8                        pixels = 0;
     9
     10                initial = ( state === 'hide' );
     11
     12                if ( editor.theme.panel ) {
     13                        toolbars = editor.theme.panel.find('.toolbar');
     14                }
    1115
    1216                if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) {
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r26876 r26880  
    5050        function getShortcode( content ) {
    5151                return content.replace( /<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function( a, b ) {
     52                        if ( b.indexOf('<img ') === -1 ) {
     53                                // Broken caption. The user dragged the image out?
     54                                return '';
     55                        }
     56
    5257                        var ret = b.replace( /<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi, function( a, b, c, cap ) {
    5358                                var id, cls, w;
     
    130135                                captionAlign = '',
    131136                                captionWidth = '',
    132                                 wrap, parent, html, P, imgId;
     137                                wrap, parent, node, html, imgId;
    133138
    134139                        // Temp image id so we can find the node later
     
    179184
    180185                                        if ( parent && parent.nodeName === 'P' ) {
    181                                                 wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
     186                                                wrap = dom.create( 'div', { 'class': 'mceTemp', 'draggable': 'true' }, html );
    182187                                                dom.insertAfter( wrap, parent );
    183188                                                editor.selection.select( wrap );
     
    188193                                                }
    189194                                        } else {
    190                                                 editor.selection.setContent( '<div class="mceTemp">' + html + '</div>' );
     195                                                editor.selection.setContent( '<div class="mceTemp" draggable="true">' + html + '</div>' );
    191196                                        }
    192197                                } else {
     
    245250
    246251                                                if ( parent = dom.getParent( imgNode, 'p' ) ) {
    247                                                         wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
     252                                                        wrap = dom.create( 'div', { 'class': 'mceTemp', 'draggable': 'true' }, html );
    248253                                                        dom.insertAfter( wrap, parent );
    249254                                                        editor.selection.select( wrap );
     
    257262                                                        }
    258263                                                } else {
    259                                                         editor.selection.setContent( '<div class="mceTemp">' + html + '</div>' );
     264                                                        editor.selection.setContent( '<div class="mceTemp" draggable="true">' + html + '</div>' );
    260265                                                }
    261266                                        }
     
    285290                editor.on( 'wpLoadImageData', function( e ) {
    286291                        var parent,
    287                                 data = e.imgData.data
     292                                data = e.imgData.data,
    288293                                imgNode = e.imgData.node;
    289294
  • trunk/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

    r26876 r26880  
    1111                        d = editor.getDoc(),
    1212                        body = d.body,
    13                         de = d.documentElement,
    14                         DOM = tinymce.DOM
     13                        DOM = tinymce.DOM,
    1514                        resizeHeight = 250;
    1615
    17                 if ( ( e && e.type == 'setcontent' && e.initial ) || editor.settings.inline ) {
     16                if ( ( e && e.type === 'setcontent' && e.initial ) || editor.settings.inline ) {
    1817                        return;
    1918                }
  • trunk/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js

    r26876 r26880  
    11/* global tinymce */
    2 tinymce.PluginManager.add('wpgallery', function( editor, url ) {
     2tinymce.PluginManager.add('wpgallery', function( editor ) {
    33
    44        function parseGallery( content ) {
     
    7070*/
    7171        editor.on( 'mouseup', function( e ) {
    72                 if ( e.target.nodeName == 'IMG' && editor.dom.hasClass( e.target, 'wp-gallery' ) ) {
     72                if ( e.target.nodeName === 'IMG' && editor.dom.hasClass( e.target, 'wp-gallery' ) ) {
    7373                        // Don't trigger on right-click
    7474                        if ( e.button !== 2 ) {
  • trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js

    r26876 r26880  
    1414
    1515                        // Check if the `wp.mce` API exists.
    16                         if ( typeof wp === 'undefined' || ! wp.mce )
     16                        if ( typeof wp === 'undefined' || ! wp.mce ) {
    1717                                return;
     18                        }
    1819
    1920                        editor.on( 'PreInit', function() {
     
    2728                        // we'll wait to render the views.
    2829                        editor.on( 'BeforeSetContent', function( e ) {
    29                                 if ( ! e.content )
     30                                if ( ! e.content ) {
    3031                                        return;
     32                                }
    3133
    3234                                e.content = wp.mce.view.toViews( e.content );
     
    4345                                // When a view is selected, ensure content that is being pasted
    4446                                // or inserted is added to a text node (instead of the view).
    45                                 editor.on( 'BeforeSetContent', function( e ) {
     47                                editor.on( 'BeforeSetContent', function() {
    4648                                        var walker, target,
    4749                                                view = wpView.getParentView( selection.getNode() );
    4850
    4951                                        // If the selection is not within a view, bail.
    50                                         if ( ! view )
     52                                        if ( ! view ) {
    5153                                                return;
     54                                        }
    5255
    5356                                        // If there are no additional nodes or the next node is a
     
    7376                                // Runs on paste and on inserting nodes/html.
    7477                                editor.on( 'SetContent', function( e ) {
    75                                         if ( ! e.context )
     78                                        if ( ! e.context ) {
    7679                                                return;
     80                                        }
    7781
    7882                                        var node = selection.getNode();
    7983
    80                                         if ( ! node.innerHTML )
     84                                        if ( ! node.innerHTML ) {
    8185                                                return;
     86                                        }
    8287
    8388                                        node.innerHTML = wp.mce.view.toViews( node.innerHTML );
     
    8994                        // transform any views back to their text representations.
    9095                        editor.on( 'PostProcess', function( e ) {
    91                                 if ( ( ! e.get && ! e.save ) || ! e.content )
     96                                if ( ( ! e.get && ! e.save ) || ! e.content ) {
    9297                                        return;
     98                                }
    9399
    94100                                e.content = wp.mce.view.toText( e.content );
     
    98104                        // Add the event handler to the top of the stack.
    99105                        editor.on( 'NodeChange', function( e ) {
    100                                 var view = wpView.getParentView( node );
     106                                var view = wpView.getParentView( e.element );
    101107
    102108                                // Update the selected view.
     
    118124
    119125                                // If a view isn't selected, let the event go on its merry way.
    120                                 if ( ! selected )
     126                                if ( ! selected ) {
    121127                                        return;
     128                                }
    122129
    123130                                // If the caret is not within the selected view, deselect the
    124131                                // view and bail.
    125                                 view = wpView.getParentView( selection.getNode() );
     132                                view = wpView.getParentView( editor.selection.getNode() );
    126133                                if ( view !== selected ) {
    127134                                        wpView.deselect();
     
    139146                                // Let keypresses that involve the command or control keys through.
    140147                                // Also, let any of the F# keys through.
    141                                 if ( event.metaKey || event.ctrlKey || ( keyCode >= 112 && keyCode <= 123 ) )
     148                                if ( event.metaKey || event.ctrlKey || ( keyCode >= 112 && keyCode <= 123 ) ) {
    142149                                        return;
     150                                }
    143151
    144152                                event.preventDefault();
     
    148156                getParentView : function( node ) {
    149157                        while ( node ) {
    150                                 if ( this.isView( node ) )
     158                                if ( this.isView( node ) ) {
    151159                                        return node;
     160                                }
    152161
    153162                                node = node.parentNode;
     
    160169
    161170                select : function( view ) {
    162                         if ( view === selected )
     171                        if ( view === selected ) {
    163172                                return;
     173                        }
    164174
    165175                        this.deselect();
     
    169179
    170180                deselect : function() {
    171                         if ( selected )
     181                        if ( selected ) {
    172182                                wp.mce.view.deselect( selected );
     183                        }
     184
    173185                        selected = null;
    174186                }
  • trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

    r26876 r26880  
    5151}
    5252
    53 .wp-caption img,
    54 .wp-caption a {
     53div.mceTemp {
     54        -ms-user-select: element;
     55}
     56
     57dl.wp-caption,
     58dl.wp-caption * {
    5559        -webkit-user-drag: none;
    5660}
Note: See TracChangeset for help on using the changeset viewer.