diff --git a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js index 1a3e43ee3f6..81c39d1c627 100644 --- a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js +++ b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js @@ -257,6 +257,12 @@ Y.namespace('M.atto_undo').Button = Y.Base.create('button', Y.M.editor_atto.Edit */ _redoHandler: function(e) { e.preventDefault(); + + // Don't do anything if redo stack is empty. + if (this._redoStack.length === 0) { + return; + } + var html = this._getHTML(), redo = this._getRedo(); diff --git a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js index fc5786da666..703182100eb 100644 --- a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js +++ b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_undo-button",function(t,e){t.namespace("M.atto_undo").Button=t.Base.create("button",t.M.editor_atto.EditorPlugin,[],{_maxUndos:40,_undoStack:null,_redoStack:null,initializer:function(){this._undoStack=[],this._redoStack=[],this.addButton({title:"undo",icon:"e/undo",callback:this._undoHandler,buttonName:"undo",keys:90}),this.addButton({title:"redo",icon:"e/redo",callback:this._redoHandler,buttonName:"redo",keys:89}),this.get("host").on("pluginsloaded",function(){this._addToUndo(this._getHTML()),this.get("host").on("atto:selectionchanged",this._changeListener,this)},this),this._updateButtonsStates()},_addToRedo:function(t){this._redoStack.push(t)},_addToUndo:function(t,e){for(void 0===e&&(e=!1),this._undoStack[this._undoStack.length-1]!==t&&(this._undoStack.push(t),e&&(this._redoStack=[]));this._undoStack.length>this._maxUndos;)this._undoStack.shift()},_getHTML:function(){return this.get("host").getCleanHTML()},_getRedo:function(){return this._redoStack.pop()},_getUndo:function(t){if(1===this._undoStack.length)return this._undoStack[0];var e=this._undoStack.pop();return e===t&&(e=this._undoStack.pop()),0===this._undoStack.length&&this._addToUndo(e),e},_restoreValue:function(t){this.editor.setHTML(t),this._addToUndo(t)},_updateButtonsStates:function(){1this._maxUndos;)this._undoStack.shift()},_getHTML:function(){return this.get("host").getCleanHTML()},_getRedo:function(){return this._redoStack.pop()},_getUndo:function(t){if(1===this._undoStack.length)return this._undoStack[0];var e=this._undoStack.pop();return e===t&&(e=this._undoStack.pop()),0===this._undoStack.length&&this._addToUndo(e),e},_restoreValue:function(t){this.editor.setHTML(t),this._addToUndo(t)},_updateButtonsStates:function(){1