Changeset 45631
- Timestamp:
- 07/12/2019 03:24:20 AM (5 years ago)
- Location:
- trunk/src/js/_enqueues
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/vendor/tinymce/plugins/wpview/plugin.js
r44718 r45631 26 26 } 27 27 28 if ( ! content ) {28 if ( ! content || content.indexOf( ' data-wpview-' ) === -1 ) { 29 29 return content; 30 30 } … … 112 112 } ); 113 113 114 // Replace views with their text inside undo levels.115 // This also prevents that new levels are added when there are changes inside theviews.114 // Prevent adding of undo levels when replacing wpview markers 115 // or when there are changes only in the (non-editable) previews. 116 116 editor.on( 'beforeaddundo', function( event ) { 117 event.level.content = resetViews( event.level.content ); 117 var lastContent; 118 var newContent = event.level.content || ( event.level.fragments && event.level.fragments.join( '' ) ); 119 120 if ( ! event.lastLevel ) { 121 lastContent = editor.startContent; 122 } else { 123 lastContent = event.lastLevel.content || ( event.lastLevel.fragments && event.lastLevel.fragments.join( '' ) ); 124 } 125 126 if ( 127 ! newContent || 128 ! lastContent || 129 newContent.indexOf( ' data-wpview-' ) === -1 || 130 lastContent.indexOf( ' data-wpview-' ) === -1 131 ) { 132 return; 133 } 134 135 if ( resetViews( lastContent ) === resetViews( newContent ) ) { 136 event.preventDefault(); 137 } 118 138 } ); 119 139 -
trunk/src/js/_enqueues/wp/mce-view.js
r43347 r45631 445 445 ); 446 446 447 editor.$( node ).replaceWith( $viewNode ); 447 editor.undoManager.ignore( function() { 448 editor.$( node ).replaceWith( $viewNode ); 449 } ); 448 450 449 451 if ( selected ) { 450 452 setTimeout( function() { 451 editor.selection.select( $viewNode[0] ); 452 editor.selection.collapse(); 453 editor.undoManager.ignore( function() { 454 editor.selection.select( $viewNode[0] ); 455 editor.selection.collapse(); 456 } ); 453 457 } ); 454 458 } … … 962 966 views.register( 'embedURL', _.extend( {}, embed, { 963 967 match: function( content ) { 964 var re = /(^|<p>)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi, 965 match = re.exec( content ); 968 // There may be a "bookmark" node next to the URL... 969 var re = /(^|<p>(?:<span data-mce-type="bookmark"[^>]+>\s*<\/span>)?)(https?:\/\/[^\s"]+?)((?:<span data-mce-type="bookmark"[^>]+>\s*<\/span>)?<\/p>\s*|$)/gi; 970 var match = re.exec( content ); 966 971 967 972 if ( match ) {
Note: See TracChangeset
for help on using the changeset viewer.