Ticket #28595: 28595.17.patch
File 28595.17.patch, 2.3 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wplink/plugin.js
15 15 editor.addShortcut( 'ctrl+k', '', 'WP_Link' ); 16 16 17 17 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; 19 20 20 button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) );21 button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) || getView( node ) ); 21 22 button.active( parent && parent.href ); 22 23 } 23 24 -
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
1 1 /* global tinymce */ 2 2 3 /** 3 4 * WordPress View plugin. 4 5 */ … … 21 22 */ 22 23 function getParent( node, className ) { 23 24 while ( node && node.parentNode ) { 24 if ( node.className && ( ' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1 ) {25 if ( node.className && ( ' ' + node.className + ' ' ).indexOf( ' ' + className + ' ' ) !== -1 ) { 25 26 return node; 26 27 } 27 28 … … 584 585 editor.dom.removeClass( editor.getBody(), 'has-focus' ); 585 586 } ); 586 587 587 editor.on( ' nodechange', function( event ) {588 editor.on( 'NodeChange', function( event ) { 588 589 var dom = editor.dom, 589 590 views = editor.dom.select( '.wpview-wrap' ), 590 591 className = event.element.className, … … 638 639 } 639 640 }); 640 641 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 ) { 642 656 if ( editor.dom.hasClass( event.target, 'wpview-wrap' ) ) { 643 657 event.name = editor.dom.getAttrib( event.target, 'data-wpview-type' ) || 'wpview'; 644 658 event.stopPropagation();