Ticket #3662: 3662_2.patch

File 3662_2.patch, 2.0 KB (added by Artur Formella, 15 years ago)
  • _source/plugins/undo/plugin.js

     
    4646                                        canUndo : false
    4747                                });
    4848
     49                        editor.on( 'resetUndo', function()
     50                                {
     51                                        // Reset the undo stack.
     52                                        undoManager.reset();
     53
     54                                        // Create the first image.
     55                                        editor.fire( 'saveSnapshot' );
     56                                });
     57
    4958                        undoManager.onChange = function()
    5059                        {
    5160                                undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
     
    107116                                        label : editor.lang.redo,
    108117                                        command : 'redo'
    109118                                });
     119                               
     120                        editor.resetUndo = function()
     121                        {
     122                                editor.fire( "resetUndo" );
     123                        }
    110124                }
    111125        });
    112126
     
    166180         */
    167181        function UndoManager( editor )
    168182        {
    169                 this.typesCount = 0;
    170                 this.modifiersCount = 0;
    171 
    172183                this.editor = editor;
    173184
    174                 /**
    175                  * Stack for all the undo and redo snapshots, they're always created/removed
    176                  * in consistency.
    177                  */
    178                 this.snapshots = [];
    179 
    180                 /**
    181                  * Current snapshot history index.
    182                  */
    183                 this.index = -1;
    184 
    185                 this.limit = editor.config.undoStackSize;
    186 
    187                 /**
    188                  * Remember last pressed key.
    189                  */
    190                 this.lastKeystroke = 0;
     185                // Reset the undo stack.
     186                this.reset();
    191187        }
    192188
    193189        UndoManager.prototype =
     
    288284                        this.typing = true;
    289285                },
    290286
     287                reset : function()      // Reset the undo stack.
     288                {
     289                        /**
     290                         * Remember last pressed key.
     291                         */
     292                        this.lastKeystroke = 0;
     293
     294                        this.modifiersCount = 0;
     295
     296                        this.typesCount = 0;
     297
     298                        /**
     299                         * Stack for all the undo and redo snapshots, they're always created/removed
     300                         * in consistency.
     301                         */
     302                        this.snapshots = [];
     303
     304                        /**
     305                         * Current snapshot history index.
     306                         */
     307                        this.index = -1;
     308
     309                        this.limit = this.editor.config.undoStackSize;
     310
     311                        this.currentImage = null;
     312                },
     313
    291314                /**
    292315                 * Reset all states about typing.
    293316                 * @see  UndoManager.type
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy