X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fundo%2Fplugin.js;h=89819f0d808ff71f3934fcb6e559a85e52ed5677;hb=4e70ea24db840898be8cc21c950363a52a2a6aba;hp=95bd04a1ddb14f859bff18e52f81667c32f6575c;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/plugins/undo/plugin.js b/_source/plugins/undo/plugin.js index 95bd04a..89819f0 100644 --- a/_source/plugins/undo/plugin.js +++ b/_source/plugins/undo/plugin.js @@ -90,7 +90,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Make the undo manager available only in wysiwyg mode. editor.on( 'mode', function() { - undoManager.enabled = editor.mode == 'wysiwyg'; + undoManager.enabled = editor.readOnly ? false : editor.mode == 'wysiwyg'; undoManager.onChange(); }); @@ -148,6 +148,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var Image = CKEDITOR.plugins.undo.Image = function( editor ) { this.editor = editor; + + editor.fire( 'beforeUndoImage' ); + var contents = editor.getSnapshot(), selection = contents && editor.getSelection(); @@ -156,6 +159,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license this.contents = contents; this.bookmarks = selection && selection.createBookmarks2( true ); + + editor.fire( 'afterUndoImage' ); }; // Attributes that browser may changing them when setting via innerHTML. @@ -540,6 +545,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * The number of undo steps to be saved. The higher this setting value the more * memory is used for it. + * @name CKEDITOR.config.undoStackSize * @type Number * @default 20 * @example @@ -552,3 +558,23 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * @name CKEDITOR.editor#saveSnapshot * @event */ + +/** + * Fired before an undo image is to be taken. An undo image represents the + * editor state at some point. It's saved into an undo store, so the editor is + * able to recover the editor state on undo and redo operations. + * @name CKEDITOR.editor#beforeUndoImage + * @since 3.5.3 + * @see CKEDITOR.editor#afterUndoImage + * @event + */ + +/** + * Fired after an undo image is taken. An undo image represents the + * editor state at some point. It's saved into an undo store, so the editor is + * able to recover the editor state on undo and redo operations. + * @name CKEDITOR.editor#afterUndoImage + * @since 3.5.3 + * @see CKEDITOR.editor#beforeUndoImage + * @event + */