Skip to content

Commit

Permalink
fixed enter undo issues
Browse files Browse the repository at this point in the history
  • Loading branch information
spocke committed Nov 22, 2016
1 parent 4cc633c commit 9edc910
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions js/tinymce/classes/EnterKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ define("tinymce/EnterKey", [
// Allow custom handling of new blocks
editor.fire('NewBlock', {newBlock: newBlock});

undoManager.typing = false;
undoManager.add();
}

Expand Down
2 changes: 1 addition & 1 deletion js/tinymce/classes/Shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ define("tinymce/Shortcuts", [
}

function isFunctionKey(e) {
return e.keyCode >= 112 && e.keyCode <= 123;
return e.type === "keydown" && e.keyCode >= 112 && e.keyCode <= 123;
}

function matchShortcut(e, shortcut) {
Expand Down
2 changes: 1 addition & 1 deletion js/tinymce/classes/UndoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ define("tinymce/UndoManager", [
return;
}

if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode === 45 || keyCode === 13 || e.ctrlKey) {
if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode === 45 || e.ctrlKey) {
addNonTypingUndoLevel();
editor.nodeChanged();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tinymce/UndoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('Typing state', function() {
editor.dom.fire(editor.getBody(), 'keydown', {keyCode: 65});
ok(editor.undoManager.typing);

editor.dom.fire(editor.getBody(), 'keyup', {keyCode: 13});
editor.dom.fire(editor.getBody(), 'keydown', {keyCode: 13});
ok(!editor.undoManager.typing);

selectAllFlags = {keyCode: 65, ctrlKey: false, altKey: false, shiftKey: false};
Expand Down

0 comments on commit 9edc910

Please sign in to comment.