JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.2
[ckeditor.git] / _source / plugins / undo / plugin.js
index 89819f0..337c427 100644 (file)
@@ -64,9 +64,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        editor.on( 'afterCommandExec', recordCommand );\r
 \r
                        // Save snapshots before doing custom changes.\r
-                       editor.on( 'saveSnapshot', function()\r
+                       editor.on( 'saveSnapshot', function( evt )\r
                                {\r
-                                       undoManager.save();\r
+                                       undoManager.save( evt.data && evt.data.contentOnly );\r
                                });\r
 \r
                        // Registering keydown on every document recreation.(#3844)\r
@@ -116,24 +116,22 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        };\r
 \r
                        /**\r
-                        * Update the undo stacks with any subsequent DOM changes after this call.\r
+                        * Amend the top of undo stack (last undo image) with the current DOM changes.\r
                         * @name CKEDITOR.editor#updateUndo\r
                         * @example\r
                         * function()\r
                         * {\r
-                        * editor.fire( 'updateSnapshot' );\r
-                        * ...\r
-                        *  // Ask to include subsequent (in this call stack) DOM changes to be\r
-                        * // considered as part of the first snapshot.\r
-                        *      editor.fire( 'updateSnapshot' );\r
+                        *  editor.fire( 'saveSnapshot' );\r
                         *      editor.document.body.append(...);\r
+                        *  // Make new changes following the last undo snapshot part of it.\r
+                        *      editor.fire( 'updateSnapshot' );\r
                         * ...\r
                         * }\r
                         */\r
                        editor.on( 'updateSnapshot', function()\r
                        {\r
-                               if ( undoManager.currentImage && new Image( editor ).equals( undoManager.currentImage ) )\r
-                                       setTimeout( function() { undoManager.update(); }, 0 );\r
+                               if ( undoManager.currentImage )\r
+                                       undoManager.update();\r
                        });\r
                }\r
        });\r