Make WordPress Core

Ticket #28595: 28595.17.patch

File 28595.17.patch, 2.3 KB (added by iseulde, 11 years ago)
  • src/wp-includes/js/tinymce/plugins/wplink/plugin.js

     
    1515        editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
    1616
    1717        function setState( button, node ) {
    18                 var parent = editor.dom.getParent( node, 'a' );
     18                var parent = editor.dom.getParent( node, 'a' ),
     19                        getView = editor.plugins.wpview ? editor.plugins.wpview.getView : false;
    1920
    20                 button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );
     21                button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) || getView( node ) );
    2122                button.active( parent && parent.href );
    2223        }
    2324
  • src/wp-includes/js/tinymce/plugins/wpview/plugin.js

     
    11/* global tinymce */
     2
    23/**
    34 * WordPress View plugin.
    45 */
     
    2122         */
    2223        function getParent( node, className ) {
    2324                while ( node && node.parentNode ) {
    24                         if ( node.className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1 ) {
     25                        if ( node.className && ( ' ' + node.className + ' ' ).indexOf( ' ' + className + ' ' ) !== -1 ) {
    2526                                return node;
    2627                        }
    2728
     
    584585                editor.dom.removeClass( editor.getBody(), 'has-focus' );
    585586        } );
    586587
    587         editor.on( 'nodechange', function( event ) {
     588        editor.on( 'NodeChange', function( event ) {
    588589                var dom = editor.dom,
    589590                        views = editor.dom.select( '.wpview-wrap' ),
    590591                        className = event.element.className,
     
    638639                }
    639640        });
    640641
    641         editor.on( 'resolvename', function( event ) {
     642        editor.on( 'BeforeExecCommand', function( event ) {
     643                var cmd = event.command,
     644                        view;
     645
     646                if ( cmd === 'undo' || cmd === 'redo' || cmd === 'RemoveFormat' ) {
     647                        return;
     648                }
     649
     650                if ( view = getView( editor.selection.getNode() ) ) {
     651                        handleEnter( view );
     652                }
     653        });
     654
     655        editor.on( 'ResolveName', function( event ) {
    642656                if ( editor.dom.hasClass( event.target, 'wpview-wrap' ) ) {
    643657                        event.name = editor.dom.getAttrib( event.target, 'data-wpview-type' ) || 'wpview';
    644658                        event.stopPropagation();