Ticket #3662: 3662_3.patch

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

     
    107107                                        label : editor.lang.redo,
    108108                                        command : 'redo'
    109109                                });
     110                               
     111                        editor.resetUndo = function()
     112                        {
     113                                // Reset the undo stack.
     114                                undoManager.reset();
     115
     116                                // Create the first image.
     117                                editor.fire( 'saveSnapshot' );
     118                        }
    110119                }
    111120        });
    112121
     
    166175         */
    167176        function UndoManager( editor )
    168177        {
    169                 this.typesCount = 0;
    170                 this.modifiersCount = 0;
    171 
    172178                this.editor = editor;
    173179
    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;
     180                // Reset the undo stack.
     181                this.reset();
    191182        }
    192183
    193184        UndoManager.prototype =
     
    288279                        this.typing = true;
    289280                },
    290281
     282                reset : function()      // Reset the undo stack.
     283                {
     284                        /**
     285                         * Remember last pressed key.
     286                         */
     287                        this.lastKeystroke = 0;
     288
     289                        /**
     290                         * Stack for all the undo and redo snapshots, they're always created/removed
     291                         * in consistency.
     292                         */
     293                        this.snapshots = [];
     294
     295                        /**
     296                         * Current snapshot history index.
     297                         */
     298                        this.index = -1;
     299
     300                        this.limit = this.editor.config.undoStackSize;
     301
     302                        this.currentImage = null;
     303
     304                        this.hasUndo = false;
     305                        this.tasRedo = false;
     306
     307                        this.resetType();
     308                },
     309
    291310                /**
    292311                 * Reset all states about typing.
    293312                 * @see  UndoManager.type
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy