Skip to content

Commit

Permalink
MDL-60574 atto_undo: fixed redo erasing content
Browse files Browse the repository at this point in the history
When you'd hit ctrl-y with nothing on the redo stack the entire
content of Atto would get deleted with no way of getting it back.
  • Loading branch information
t-schroeder committed Aug 4, 2020
1 parent 07238ca commit 95fc9d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 6 additions & 0 deletions lib/editor/atto/plugins/undo/yui/src/button/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,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();

Expand Down

0 comments on commit 95fc9d9

Please sign in to comment.