Ticket #27915: 27915.patch
File 27915.patch, 1.3 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
332 332 tinymce.each( dom.select( 'div[data-wpview-text]', event.node ), function( node ) { 333 333 // Empty the wrap node 334 334 if ( 'textContent' in node ) { 335 node.textContent = ' ';335 node.textContent = '\u00a0'; 336 336 } else { 337 node.innerText = ' ';337 node.innerText = '\u00a0'; 338 338 } 339 340 // This makes all views into block tags (as we use <div>).341 // Can use 'PostProcess' and a regex instead.342 dom.replace( dom.create( 'p', null, window.decodeURIComponent( dom.getAttrib( node, 'data-wpview-text' ) ) ), node );343 339 }); 344 340 }); 345 341 342 editor.on( 'PostProcess', function( event ) { 343 if ( event.content ) { 344 event.content = event.content.replace( /<div [^>]*?data-wpview-text="([^"]*)"[^>]*>[\s\S]*?<\/div>/g, function( match, shortcode ) { 345 if ( shortcode ) { 346 return '<p>' + window.decodeURIComponent( shortcode ) + '</p>'; 347 } 348 return ''; // If error, remove the view wrapper 349 }); 350 } 351 }); 352 346 353 editor.on( 'keydown', function( event ) { 347 354 var keyCode = event.keyCode, 348 355 body = editor.getBody(),