Ticket #27389: 27389-wpviews-undo-revamp-02.patch
File 27389-wpviews-undo-revamp-02.patch, 4.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mce-view.js
diff --git src/wp-includes/js/mce-view.js src/wp-includes/js/mce-view.js index d3af61e..27135cf 100644
window.wp = window.wp || {}; 41 41 doc = editor.getDoc(); 42 42 $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).each(function (i, elem) { 43 43 var node = $( elem ); 44 node.html( html ) ;44 node.html( html ).append( '<span data-wp-view-end class="wp-view-end"></span>' ); 45 45 $( self ).trigger( 'ready', elem ); 46 46 }); 47 47 } -
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
diff --git src/wp-includes/js/tinymce/plugins/wpview/plugin.js src/wp-includes/js/tinymce/plugins/wpview/plugin.js index 75f7047..d7602d4 100644
tinymce.PluginManager.add( 'wpview', function( editor ) { 141 141 } 142 142 143 143 editor.on( 'BeforeAddUndo', function( event ) { 144 if ( selected && ! toRemove ) { 145 event.preventDefault(); 144 var replace, 145 previousContent, 146 content; 147 148 replace = function( content ) { 149 return content.replace(/(<div[^>]+wpview-wrap[^>]+>)([\s\S]+)(<span[^>]+data-wp-view-end[^>]+><\/span><\/div>)/mg, '$`$1$3$\'' ); 150 }; 151 152 if ( event.lastLevel ) { 153 previousContent = replace( event.lastLevel.content ); 154 content = replace( event.level.content ); 155 156 if ( content === previousContent ) { 157 event.preventDefault(); 158 } 146 159 } 147 160 }); 148 161 … … tinymce.PluginManager.add( 'wpview', function( editor ) { 162 175 editor.on( 'SetContent', function( event ) { 163 176 var body, padNode; 164 177 165 // don't (re-)render views if the format of the content is raw 166 // to avoid adding additional undo levels on undo/redo 167 if ( event.format !== 'raw' ) { 168 wp.mce.views.render(); 169 } 178 wp.mce.views.render(); 170 179 171 180 // Add padding <p> if the noneditable node is last 172 181 if ( event.load || ! event.set ) { -
src/wp-includes/js/tinymce/tinymce.js
diff --git src/wp-includes/js/tinymce/tinymce.js src/wp-includes/js/tinymce/tinymce.js index 1c291c9..5f7bb10 100644
define("tinymce/UndoManager", [ 17165 17165 return null; 17166 17166 } 17167 17167 17168 if (editor.fire('BeforeAddUndo', {level: level, originalEvent: event}).isDefaultPrevented()) { 17168 lastLevel = data[index]; 17169 if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) { 17169 17170 return null; 17170 17171 } 17171 17172 17172 17173 // Add undo level if needed 17173 lastLevel = data[index];17174 17174 if (lastLevel && lastLevel.content == level.content) { 17175 17175 return null; 17176 17176 } … … define("tinymce/ui/Throbber", [ 34977 34977 }); 34978 34978 34979 34979 expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/util/Tools","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/dom/StyleSheetLoader","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/RangeUtils","tinymce/dom/Selection","tinymce/fmt/Preview","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/ui/ComboBox","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]); 34980 })(this); 34981 No newline at end of file 34980 })(this);