Ticket #39337: 39337.patch
File 39337.patch, 2.0 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/mce-view.js
116 116 } 117 117 118 118 instance = self.createInstance( type, result.content, result.options ); 119 text = instance. loader ? '.' : instance.text;119 text = instance.text; 120 120 121 121 // Add the processed piece for the match. 122 122 pieces.push( { … … 440 440 ); 441 441 442 442 editor.$( node ).replaceWith( $viewNode ); 443 444 var nextSibling = $viewNode[0].nextSibling; 445 446 if ( ! nextSibling ) { 447 nextSibling = editor.dom.create( 'p', { 'data-wpview-after': 1 }, '<br data-mce-bogus="1" />' ); 448 $viewNode.after( nextSibling ); 449 } 450 451 if ( ! nextSibling.hasAttribute( 'contenteditable' ) ) { 452 editor.selection.setCursorLocation( nextSibling, 0 ); 453 } 443 454 } ); 444 455 }, 445 456 -
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
102 102 wp.mce.views.render(); 103 103 } ); 104 104 105 // Empty view nodes for easier processing. 106 editor.on( 'preprocess hide', function( event ) { 105 editor.on( 'preprocess', function( event ) { 106 var $lastNode = editor.$( event.node.lastChild ); 107 108 // Remove the last paragraph if it is empty and was auto-inserted caret placeholder after a wpview 109 if ( $lastNode.length && $lastNode.attr( 'data-wpview-after' ) && editor.dom.isEmpty( $lastNode[0] ) ) { 110 $lastNode.remove(); 111 } 112 113 // Remove internal data attributes 114 editor.$( 'p[data-wpview-after]', event.node ).each( function( i, node ) { 115 editor.$( node ).removeAttr( 'data-wpview-after' ); 116 } ); 117 118 // Empty wpview nodes 107 119 editor.$( 'div[data-wpview-text], p[data-wpview-marker]', event.node ).each( function( i, node ) { 108 120 node.innerHTML = '.'; 109 121 } );