diff options
Diffstat (limited to 'node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js')
-rw-r--r-- | node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js index e92da424..46e45926 100644 --- a/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js +++ b/node_modules/montage/ui/rich-text-editor/rich-text-editor.reel/rich-text-editor-base.js | |||
@@ -907,10 +907,10 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
907 | handleInput: { | 907 | handleInput: { |
908 | enumerable: false, | 908 | enumerable: false, |
909 | value: function(event) { | 909 | value: function(event) { |
910 | if (!this._executingCommand && !this._nextInputIsNotTyping) { | 910 | if (!this._executingCommand && !this._ignoreNextInputEvent) { |
911 | this._startTyping(); | 911 | this._startTyping(); |
912 | } | 912 | } |
913 | delete this._nextInputIsNotTyping; | 913 | delete this._ignoreNextInputEvent; |
914 | 914 | ||
915 | if (this._hasSelectionChangeEvent === false) { | 915 | if (this._hasSelectionChangeEvent === false) { |
916 | this.handleSelectionchange(); | 916 | this.handleSelectionchange(); |
@@ -1149,7 +1149,7 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
1149 | if (this.undoManager) { | 1149 | if (this.undoManager) { |
1150 | this.undoManager.add("Move", this._undo, this, "Move", this._innerElement); | 1150 | this.undoManager.add("Move", this._undo, this, "Move", this._innerElement); |
1151 | } | 1151 | } |
1152 | this._nextInputIsNotTyping = true; | 1152 | this._ignoreNextInputEvent = true; |
1153 | 1153 | ||
1154 | this.handleDragend(event); | 1154 | this.handleDragend(event); |
1155 | this.handleSelectionchange(); | 1155 | this.handleSelectionchange(); |
@@ -1253,7 +1253,7 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
1253 | if (this.undoManager) { | 1253 | if (this.undoManager) { |
1254 | this.undoManager.add("Cut", this._undo, this, "Cut", this._innerElement); | 1254 | this.undoManager.add("Cut", this._undo, this, "Cut", this._innerElement); |
1255 | } | 1255 | } |
1256 | this._nextInputIsNotTyping = true; | 1256 | this._ignoreNextInputEvent = true; |
1257 | } | 1257 | } |
1258 | }, | 1258 | }, |
1259 | 1259 | ||
@@ -1389,34 +1389,10 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
1389 | doAction: { | 1389 | doAction: { |
1390 | enumerable: true, | 1390 | enumerable: true, |
1391 | value: function(action, value) { | 1391 | value: function(action, value) { |
1392 | var savedActiveElement = document.activeElement, | ||
1393 | editorElement = this._innerElement; | ||
1394 | |||
1395 | if (!editorElement) { | ||
1396 | return; | ||
1397 | } | ||
1398 | |||
1399 | // Make sure we are the active element before calling execCommand | ||
1400 | if (editorElement != savedActiveElement) { | ||
1401 | editorElement.focus(); | ||
1402 | } | ||
1403 | |||
1404 | if (value === undefined) { | ||
1405 | value = false; | ||
1406 | } | ||
1407 | |||
1408 | this.execCommand(action, false, value); | 1392 | this.execCommand(action, false, value); |
1409 | 1393 | ||
1410 | // Force an update states right away | 1394 | // Force an update states right away |
1411 | this._updateStates(); | 1395 | this._updateStates(); |
1412 | |||
1413 | this.handleSelectionchange(); | ||
1414 | this.markDirty(); | ||
1415 | |||
1416 | // Reset the focus | ||
1417 | if (editorElement != savedActiveElement) { | ||
1418 | savedActiveElement.focus(); | ||
1419 | } | ||
1420 | } | 1396 | } |
1421 | }, | 1397 | }, |
1422 | 1398 | ||
@@ -1427,6 +1403,7 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
1427 | var editorElement = this._innerElement; | 1403 | var editorElement = this._innerElement; |
1428 | if (!element || element === editorElement) { | 1404 | if (!element || element === editorElement) { |
1429 | this._doingUndoRedo = true; | 1405 | this._doingUndoRedo = true; |
1406 | this._ignoreNextInputEvent = true; | ||
1430 | document.execCommand("undo", false, null); | 1407 | document.execCommand("undo", false, null); |
1431 | this.markDirty(); | 1408 | this.markDirty(); |
1432 | if (this.undoManager) { | 1409 | if (this.undoManager) { |
@@ -1447,6 +1424,7 @@ exports.RichTextEditorBase = Montage.create(Component,/** @lends module:"montage | |||
1447 | var editorElement = this._innerElement; | 1424 | var editorElement = this._innerElement; |
1448 | if (!element || element === editorElement) { | 1425 | if (!element || element === editorElement) { |
1449 | this._doingUndoRedo = true; | 1426 | this._doingUndoRedo = true; |
1427 | this._ignoreNextInputEvent = true; | ||
1450 | document.execCommand("redo", false, null); | 1428 | document.execCommand("redo", false, null); |
1451 | this.markDirty(); | 1429 | this.markDirty(); |
1452 | if (this.undoManager) { | 1430 | if (this.undoManager) { |