Ticket #3662: 3662.patch

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

     
    4646                                        canUndo : false
    4747                                });
    4848
     49                        editor.on( 'resetUndoHistory', 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 );
     
    166175         */
    167176        function UndoManager( editor )
    168177        {
    169                 this.typesCount = 0;
    170 
    171178                this.editor = editor;
    172179
    173                 /**
    174                  * Stack for all the undo and redo snapshots, they're always created/removed
    175                  * in consistency.
    176                  */
    177                 this.snapshots = [];
    178 
    179                 /**
    180                  * Current snapshot history index.
    181                  */
    182                 this.index = -1;
    183 
    184                 this.limit = editor.config.undoStackSize;
     180                this.reset();
    185181        }
    186182
    187183        UndoManager.prototype =
     
    278274                        return true;
    279275                },
    280276
     277                reset : function()      // Reset the undo stack,
     278                {
     279                        this.typesCount = 0;
     280
     281                        /**
     282                         * Stack for all the undo and redo snapshots, they're always created/removed
     283                         * in consistency.
     284                         */
     285                        this.snapshots = [];
     286
     287                        /**
     288                         * Current snapshot history index.
     289                         */
     290                        this.index = -1;
     291
     292                        this.limit = this.editor.config.undoStackSize;
     293
     294                        this.currentImage = null;
     295                },
     296
    281297                restoreImage : function( image )
    282298                {
    283299                        this.editor.loadSnapshot( image.contents );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy