@nasser-sw/fabric 7.0.1-beta10 → 7.0.1-beta12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +177 -117
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +177 -117
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +177 -117
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +177 -117
- package/dist/index.node.mjs.map +1 -1
- package/dist/package.json.min.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/shapes/IText/ITextBehavior.d.ts.map +1 -1
- package/dist/src/shapes/IText/ITextBehavior.min.mjs +1 -1
- package/dist/src/shapes/IText/ITextBehavior.min.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextBehavior.mjs +10 -0
- package/dist/src/shapes/IText/ITextBehavior.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.d.ts.map +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.min.mjs.map +1 -1
- package/dist/src/shapes/IText/ITextKeyBehavior.mjs +162 -116
- package/dist/src/shapes/IText/ITextKeyBehavior.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist/src/shapes/Text/Text.min.mjs +1 -1
- package/dist/src/shapes/Text/Text.min.mjs.map +1 -1
- package/dist/src/shapes/Text/Text.mjs +4 -0
- package/dist/src/shapes/Text/Text.mjs.map +1 -1
- package/dist/src/shapes/Text/constants.d.ts +1 -1
- package/dist/src/shapes/Text/constants.d.ts.map +1 -1
- package/dist/src/shapes/Text/constants.min.mjs +1 -1
- package/dist/src/shapes/Text/constants.min.mjs.map +1 -1
- package/dist/src/shapes/Text/constants.mjs +1 -1
- package/dist/src/shapes/Text/constants.mjs.map +1 -1
- package/dist-extensions/src/shapes/IText/ITextBehavior.d.ts.map +1 -1
- package/dist-extensions/src/shapes/IText/ITextKeyBehavior.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/Text.d.ts.map +1 -1
- package/dist-extensions/src/shapes/Text/constants.d.ts +1 -1
- package/dist-extensions/src/shapes/Text/constants.d.ts.map +1 -1
- package/fabric-test-editor.html +1 -1
- package/package.json +1 -1
- package/rtl-debug.html +745 -0
- package/src/shapes/IText/ITextBehavior.ts +11 -0
- package/src/shapes/IText/ITextKeyBehavior.ts +732 -691
- package/src/shapes/Text/Text.ts +4 -0
- package/src/shapes/Text/constants.ts +1 -0
package/dist/index.node.mjs
CHANGED
|
@@ -410,7 +410,7 @@ class Cache {
|
|
|
410
410
|
}
|
|
411
411
|
const cache = new Cache();
|
|
412
412
|
|
|
413
|
-
var version = "7.0.1-
|
|
413
|
+
var version = "7.0.1-beta11";
|
|
414
414
|
|
|
415
415
|
// use this syntax so babel plugin see this import here
|
|
416
416
|
const VERSION = version;
|
|
@@ -4857,7 +4857,7 @@ const TEXT_DECORATION_THICKNESS = 'textDecorationThickness';
|
|
|
4857
4857
|
const fontProperties = ['fontSize', 'fontWeight', 'fontFamily', 'fontStyle'];
|
|
4858
4858
|
const textDecorationProperties = ['underline', 'overline', 'linethrough'];
|
|
4859
4859
|
const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign', 'wrap', 'ellipsis', 'letterSpacing', 'enableAdvancedLayout', 'verticalAlign'];
|
|
4860
|
-
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS];
|
|
4860
|
+
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS, 'useOverlayEditing'];
|
|
4861
4861
|
const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor', TEXT_DECORATION_THICKNESS];
|
|
4862
4862
|
|
|
4863
4863
|
// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
|
|
@@ -22435,6 +22435,10 @@ class FabricText extends StyledText {
|
|
|
22435
22435
|
textObject._usingBrowserWrapping = true;
|
|
22436
22436
|
console.log(`🔤 STV font: Forcing browser wrapping flag during JSON load`);
|
|
22437
22437
|
|
|
22438
|
+
// Enable overlay editing for STV fonts to use native browser text handling
|
|
22439
|
+
textObject.useOverlayEditing = true;
|
|
22440
|
+
console.log(`🔤 STV font: Enabling overlay editing during JSON load`);
|
|
22441
|
+
|
|
22438
22442
|
// Multiple initialization attempts for STV fonts
|
|
22439
22443
|
const reinitWithDelay = attempt => {
|
|
22440
22444
|
if (textObject.forceTextReinitialization) {
|
|
@@ -24207,10 +24211,20 @@ class ITextBehavior extends FabricText {
|
|
|
24207
24211
|
* @private
|
|
24208
24212
|
*/
|
|
24209
24213
|
_updateTextarea() {
|
|
24214
|
+
console.log('🔤 _updateTextarea called with fabric text:', this.text);
|
|
24210
24215
|
this.cursorOffsetCache = {};
|
|
24211
24216
|
if (!this.hiddenTextarea) {
|
|
24212
24217
|
return;
|
|
24213
24218
|
}
|
|
24219
|
+
|
|
24220
|
+
// Sync textarea content with fabric text to prevent double-keypress issues
|
|
24221
|
+
const currentFabricText = this.text;
|
|
24222
|
+
if (this.hiddenTextarea.value !== currentFabricText) {
|
|
24223
|
+
console.log('🔤 _updateTextarea: syncing textarea to fabric text');
|
|
24224
|
+
console.log('🔤 _updateTextarea: textarea was:', this.hiddenTextarea.value);
|
|
24225
|
+
console.log('🔤 _updateTextarea: fabric is:', currentFabricText);
|
|
24226
|
+
this.hiddenTextarea.value = currentFabricText;
|
|
24227
|
+
}
|
|
24214
24228
|
if (!this.inCompositionMode) {
|
|
24215
24229
|
const newSelection = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text);
|
|
24216
24230
|
this.hiddenTextarea.selectionStart = newSelection.selectionStart;
|
|
@@ -24712,36 +24726,36 @@ class ITextBehavior extends FabricText {
|
|
|
24712
24726
|
}
|
|
24713
24727
|
|
|
24714
24728
|
class ITextKeyBehavior extends ITextBehavior {
|
|
24715
|
-
/**
|
|
24716
|
-
* For functionalities on keyDown
|
|
24717
|
-
* Map a special key to a function of the instance/prototype
|
|
24718
|
-
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24719
|
-
* this map setting the name of a function that you build on the IText or
|
|
24720
|
-
* your prototype.
|
|
24721
|
-
* the map change will affect all Instances unless you need for only some text Instances
|
|
24722
|
-
* in that case you have to clone this object and assign your Instance.
|
|
24723
|
-
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24724
|
-
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24729
|
+
/**
|
|
24730
|
+
* For functionalities on keyDown
|
|
24731
|
+
* Map a special key to a function of the instance/prototype
|
|
24732
|
+
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24733
|
+
* this map setting the name of a function that you build on the IText or
|
|
24734
|
+
* your prototype.
|
|
24735
|
+
* the map change will affect all Instances unless you need for only some text Instances
|
|
24736
|
+
* in that case you have to clone this object and assign your Instance.
|
|
24737
|
+
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24738
|
+
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24725
24739
|
*/
|
|
24726
24740
|
|
|
24727
|
-
/**
|
|
24728
|
-
* For functionalities on keyUp + ctrl || cmd
|
|
24741
|
+
/**
|
|
24742
|
+
* For functionalities on keyUp + ctrl || cmd
|
|
24729
24743
|
*/
|
|
24730
24744
|
|
|
24731
|
-
/**
|
|
24732
|
-
* For functionalities on keyDown + ctrl || cmd
|
|
24745
|
+
/**
|
|
24746
|
+
* For functionalities on keyDown + ctrl || cmd
|
|
24733
24747
|
*/
|
|
24734
24748
|
|
|
24735
|
-
/**
|
|
24736
|
-
* DOM container to append the hiddenTextarea.
|
|
24737
|
-
* An alternative to attaching to the document.body.
|
|
24738
|
-
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24739
|
-
* also with modals event capturing that won't let the textarea take focus.
|
|
24740
|
-
* @type HTMLElement
|
|
24749
|
+
/**
|
|
24750
|
+
* DOM container to append the hiddenTextarea.
|
|
24751
|
+
* An alternative to attaching to the document.body.
|
|
24752
|
+
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24753
|
+
* also with modals event capturing that won't let the textarea take focus.
|
|
24754
|
+
* @type HTMLElement
|
|
24741
24755
|
*/
|
|
24742
24756
|
|
|
24743
|
-
/**
|
|
24744
|
-
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24757
|
+
/**
|
|
24758
|
+
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24745
24759
|
*/
|
|
24746
24760
|
initHiddenTextarea() {
|
|
24747
24761
|
const doc = this.canvas && getDocumentFromElement(this.canvas.getElement()) || getFabricDocument();
|
|
@@ -24784,17 +24798,17 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24784
24798
|
this.hiddenTextarea = textarea;
|
|
24785
24799
|
}
|
|
24786
24800
|
|
|
24787
|
-
/**
|
|
24788
|
-
* Override this method to customize cursor behavior on textbox blur
|
|
24801
|
+
/**
|
|
24802
|
+
* Override this method to customize cursor behavior on textbox blur
|
|
24789
24803
|
*/
|
|
24790
24804
|
blur() {
|
|
24791
24805
|
this.abortCursorAnimation();
|
|
24792
24806
|
}
|
|
24793
24807
|
|
|
24794
|
-
/**
|
|
24795
|
-
* Handles keydown event
|
|
24796
|
-
* only used for arrows and combination of modifier keys.
|
|
24797
|
-
* @param {KeyboardEvent} e Event object
|
|
24808
|
+
/**
|
|
24809
|
+
* Handles keydown event
|
|
24810
|
+
* only used for arrows and combination of modifier keys.
|
|
24811
|
+
* @param {KeyboardEvent} e Event object
|
|
24798
24812
|
*/
|
|
24799
24813
|
onKeyDown(e) {
|
|
24800
24814
|
if (!this.isEditing) {
|
|
@@ -24820,11 +24834,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24820
24834
|
}
|
|
24821
24835
|
}
|
|
24822
24836
|
|
|
24823
|
-
/**
|
|
24824
|
-
* Handles keyup event
|
|
24825
|
-
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24826
|
-
* if a copy/cut event fired, keyup is dismissed
|
|
24827
|
-
* @param {KeyboardEvent} e Event object
|
|
24837
|
+
/**
|
|
24838
|
+
* Handles keyup event
|
|
24839
|
+
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24840
|
+
* if a copy/cut event fired, keyup is dismissed
|
|
24841
|
+
* @param {KeyboardEvent} e Event object
|
|
24828
24842
|
*/
|
|
24829
24843
|
onKeyUp(e) {
|
|
24830
24844
|
if (!this.isEditing || this._copyDone || this.inCompositionMode) {
|
|
@@ -24841,9 +24855,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24841
24855
|
this.canvas && this.canvas.requestRenderAll();
|
|
24842
24856
|
}
|
|
24843
24857
|
|
|
24844
|
-
/**
|
|
24845
|
-
* Handles onInput event
|
|
24846
|
-
* @param {Event} e Event object
|
|
24858
|
+
/**
|
|
24859
|
+
* Handles onInput event
|
|
24860
|
+
* @param {Event} e Event object
|
|
24847
24861
|
*/
|
|
24848
24862
|
onInput(e) {
|
|
24849
24863
|
const fromPaste = this.fromPaste;
|
|
@@ -24857,6 +24871,52 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24857
24871
|
if (!this.isEditing) {
|
|
24858
24872
|
return;
|
|
24859
24873
|
}
|
|
24874
|
+
|
|
24875
|
+
// Debug log to track the double keypress issue
|
|
24876
|
+
console.log('🔤 onInput debug:', {
|
|
24877
|
+
fabricText: this.text,
|
|
24878
|
+
textareaValue: value,
|
|
24879
|
+
fabricSelection: {
|
|
24880
|
+
start: this.selectionStart,
|
|
24881
|
+
end: this.selectionEnd
|
|
24882
|
+
},
|
|
24883
|
+
textareaSelection: {
|
|
24884
|
+
start: selectionStart,
|
|
24885
|
+
end: selectionEnd
|
|
24886
|
+
},
|
|
24887
|
+
fromPaste,
|
|
24888
|
+
inComposition: this.inCompositionMode
|
|
24889
|
+
});
|
|
24890
|
+
|
|
24891
|
+
// Immediate sync for simple character replacement - fix for double keypress issue
|
|
24892
|
+
if (this.text !== value && !this.inCompositionMode) {
|
|
24893
|
+
console.log('🔤 Immediate sync: fabric text differs from textarea, syncing immediately');
|
|
24894
|
+
console.log('🔤 Before sync - fabric text:', this.text);
|
|
24895
|
+
console.log('🔤 Before sync - textarea value:', value);
|
|
24896
|
+
console.log('🔤 fromPaste:', fromPaste);
|
|
24897
|
+
|
|
24898
|
+
// Clear all relevant caches that might prevent visual updates
|
|
24899
|
+
this.cursorOffsetCache = {};
|
|
24900
|
+
this._browserWrapCache = null;
|
|
24901
|
+
this._lastDimensionState = null;
|
|
24902
|
+
this._forceClearCache = true;
|
|
24903
|
+
console.log('🔤 Cleared all caches');
|
|
24904
|
+
|
|
24905
|
+
// Use the same logic as updateAndFire but immediately
|
|
24906
|
+
this.updateFromTextArea();
|
|
24907
|
+
this.fire(CHANGED);
|
|
24908
|
+
if (this.canvas) {
|
|
24909
|
+
this.canvas.fire('text:changed', {
|
|
24910
|
+
target: this
|
|
24911
|
+
});
|
|
24912
|
+
// ONLY use synchronous rendering to avoid race conditions
|
|
24913
|
+
// Remove requestRenderAll() which queues for next animation frame
|
|
24914
|
+
this.canvas.renderAll();
|
|
24915
|
+
}
|
|
24916
|
+
console.log('🔤 After updateFromTextArea - fabric text:', this.text);
|
|
24917
|
+
console.log('🔤 Sync complete, caches cleared, synchronous render only');
|
|
24918
|
+
return;
|
|
24919
|
+
}
|
|
24860
24920
|
const updateAndFire = () => {
|
|
24861
24921
|
this.updateFromTextArea();
|
|
24862
24922
|
this.fire(CHANGED);
|
|
@@ -24934,15 +24994,15 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24934
24994
|
updateAndFire();
|
|
24935
24995
|
}
|
|
24936
24996
|
|
|
24937
|
-
/**
|
|
24938
|
-
* Composition start
|
|
24997
|
+
/**
|
|
24998
|
+
* Composition start
|
|
24939
24999
|
*/
|
|
24940
25000
|
onCompositionStart() {
|
|
24941
25001
|
this.inCompositionMode = true;
|
|
24942
25002
|
}
|
|
24943
25003
|
|
|
24944
|
-
/**
|
|
24945
|
-
* Composition end
|
|
25004
|
+
/**
|
|
25005
|
+
* Composition end
|
|
24946
25006
|
*/
|
|
24947
25007
|
onCompositionEnd() {
|
|
24948
25008
|
this.inCompositionMode = false;
|
|
@@ -24960,8 +25020,8 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24960
25020
|
this.updateTextareaPosition();
|
|
24961
25021
|
}
|
|
24962
25022
|
|
|
24963
|
-
/**
|
|
24964
|
-
* Copies selected text
|
|
25023
|
+
/**
|
|
25024
|
+
* Copies selected text
|
|
24965
25025
|
*/
|
|
24966
25026
|
copy() {
|
|
24967
25027
|
if (this.selectionStart === this.selectionEnd) {
|
|
@@ -24980,19 +25040,19 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24980
25040
|
this._copyDone = true;
|
|
24981
25041
|
}
|
|
24982
25042
|
|
|
24983
|
-
/**
|
|
24984
|
-
* Pastes text
|
|
25043
|
+
/**
|
|
25044
|
+
* Pastes text
|
|
24985
25045
|
*/
|
|
24986
25046
|
paste() {
|
|
24987
25047
|
this.fromPaste = true;
|
|
24988
25048
|
}
|
|
24989
25049
|
|
|
24990
|
-
/**
|
|
24991
|
-
* Finds the width in pixels before the cursor on the same line
|
|
24992
|
-
* @private
|
|
24993
|
-
* @param {Number} lineIndex
|
|
24994
|
-
* @param {Number} charIndex
|
|
24995
|
-
* @return {Number} widthBeforeCursor width before cursor
|
|
25050
|
+
/**
|
|
25051
|
+
* Finds the width in pixels before the cursor on the same line
|
|
25052
|
+
* @private
|
|
25053
|
+
* @param {Number} lineIndex
|
|
25054
|
+
* @param {Number} charIndex
|
|
25055
|
+
* @return {Number} widthBeforeCursor width before cursor
|
|
24996
25056
|
*/
|
|
24997
25057
|
_getWidthBeforeCursor(lineIndex, charIndex) {
|
|
24998
25058
|
let widthBeforeCursor = this._getLineLeftOffset(lineIndex),
|
|
@@ -25004,11 +25064,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25004
25064
|
return widthBeforeCursor;
|
|
25005
25065
|
}
|
|
25006
25066
|
|
|
25007
|
-
/**
|
|
25008
|
-
* Gets start offset of a selection
|
|
25009
|
-
* @param {KeyboardEvent} e Event object
|
|
25010
|
-
* @param {Boolean} isRight
|
|
25011
|
-
* @return {Number}
|
|
25067
|
+
/**
|
|
25068
|
+
* Gets start offset of a selection
|
|
25069
|
+
* @param {KeyboardEvent} e Event object
|
|
25070
|
+
* @param {Boolean} isRight
|
|
25071
|
+
* @return {Number}
|
|
25012
25072
|
*/
|
|
25013
25073
|
getDownCursorOffset(e, isRight) {
|
|
25014
25074
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -25026,12 +25086,12 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25026
25086
|
return textAfterCursor.length + indexOnOtherLine + 1 + this.missingNewlineOffset(lineIndex);
|
|
25027
25087
|
}
|
|
25028
25088
|
|
|
25029
|
-
/**
|
|
25030
|
-
* private
|
|
25031
|
-
* Helps finding if the offset should be counted from Start or End
|
|
25032
|
-
* @param {KeyboardEvent} e Event object
|
|
25033
|
-
* @param {Boolean} isRight
|
|
25034
|
-
* @return {Number}
|
|
25089
|
+
/**
|
|
25090
|
+
* private
|
|
25091
|
+
* Helps finding if the offset should be counted from Start or End
|
|
25092
|
+
* @param {KeyboardEvent} e Event object
|
|
25093
|
+
* @param {Boolean} isRight
|
|
25094
|
+
* @return {Number}
|
|
25035
25095
|
*/
|
|
25036
25096
|
_getSelectionForOffset(e, isRight) {
|
|
25037
25097
|
if (e.shiftKey && this.selectionStart !== this.selectionEnd && isRight) {
|
|
@@ -25041,10 +25101,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25041
25101
|
}
|
|
25042
25102
|
}
|
|
25043
25103
|
|
|
25044
|
-
/**
|
|
25045
|
-
* @param {KeyboardEvent} e Event object
|
|
25046
|
-
* @param {Boolean} isRight
|
|
25047
|
-
* @return {Number}
|
|
25104
|
+
/**
|
|
25105
|
+
* @param {KeyboardEvent} e Event object
|
|
25106
|
+
* @param {Boolean} isRight
|
|
25107
|
+
* @return {Number}
|
|
25048
25108
|
*/
|
|
25049
25109
|
getUpCursorOffset(e, isRight) {
|
|
25050
25110
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -25063,9 +25123,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25063
25123
|
return -this._textLines[lineIndex - 1].length + indexOnOtherLine - textBeforeCursor.length + (1 - missingNewlineOffset);
|
|
25064
25124
|
}
|
|
25065
25125
|
|
|
25066
|
-
/**
|
|
25067
|
-
* for a given width it founds the matching character.
|
|
25068
|
-
* @private
|
|
25126
|
+
/**
|
|
25127
|
+
* for a given width it founds the matching character.
|
|
25128
|
+
* @private
|
|
25069
25129
|
*/
|
|
25070
25130
|
_getIndexOnLine(lineIndex, width) {
|
|
25071
25131
|
const line = this._textLines[lineIndex],
|
|
@@ -25095,9 +25155,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25095
25155
|
return indexOnLine;
|
|
25096
25156
|
}
|
|
25097
25157
|
|
|
25098
|
-
/**
|
|
25099
|
-
* Moves cursor down
|
|
25100
|
-
* @param {KeyboardEvent} e Event object
|
|
25158
|
+
/**
|
|
25159
|
+
* Moves cursor down
|
|
25160
|
+
* @param {KeyboardEvent} e Event object
|
|
25101
25161
|
*/
|
|
25102
25162
|
moveCursorDown(e) {
|
|
25103
25163
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25106,9 +25166,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25106
25166
|
this._moveCursorUpOrDown('Down', e);
|
|
25107
25167
|
}
|
|
25108
25168
|
|
|
25109
|
-
/**
|
|
25110
|
-
* Moves cursor up
|
|
25111
|
-
* @param {KeyboardEvent} e Event object
|
|
25169
|
+
/**
|
|
25170
|
+
* Moves cursor up
|
|
25171
|
+
* @param {KeyboardEvent} e Event object
|
|
25112
25172
|
*/
|
|
25113
25173
|
moveCursorUp(e) {
|
|
25114
25174
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25117,10 +25177,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25117
25177
|
this._moveCursorUpOrDown('Up', e);
|
|
25118
25178
|
}
|
|
25119
25179
|
|
|
25120
|
-
/**
|
|
25121
|
-
* Moves cursor up or down, fires the events
|
|
25122
|
-
* @param {String} direction 'Up' or 'Down'
|
|
25123
|
-
* @param {KeyboardEvent} e Event object
|
|
25180
|
+
/**
|
|
25181
|
+
* Moves cursor up or down, fires the events
|
|
25182
|
+
* @param {String} direction 'Up' or 'Down'
|
|
25183
|
+
* @param {KeyboardEvent} e Event object
|
|
25124
25184
|
*/
|
|
25125
25185
|
_moveCursorUpOrDown(direction, e) {
|
|
25126
25186
|
const offset = this[`get${direction}CursorOffset`](e, this._selectionDirection === RIGHT);
|
|
@@ -25142,9 +25202,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25142
25202
|
}
|
|
25143
25203
|
}
|
|
25144
25204
|
|
|
25145
|
-
/**
|
|
25146
|
-
* Moves cursor with shift
|
|
25147
|
-
* @param {Number} offset
|
|
25205
|
+
/**
|
|
25206
|
+
* Moves cursor with shift
|
|
25207
|
+
* @param {Number} offset
|
|
25148
25208
|
*/
|
|
25149
25209
|
moveCursorWithShift(offset) {
|
|
25150
25210
|
const newSelection = this._selectionDirection === LEFT ? this.selectionStart + offset : this.selectionEnd + offset;
|
|
@@ -25152,9 +25212,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25152
25212
|
return offset !== 0;
|
|
25153
25213
|
}
|
|
25154
25214
|
|
|
25155
|
-
/**
|
|
25156
|
-
* Moves cursor up without shift
|
|
25157
|
-
* @param {Number} offset
|
|
25215
|
+
/**
|
|
25216
|
+
* Moves cursor up without shift
|
|
25217
|
+
* @param {Number} offset
|
|
25158
25218
|
*/
|
|
25159
25219
|
moveCursorWithoutShift(offset) {
|
|
25160
25220
|
if (offset < 0) {
|
|
@@ -25167,9 +25227,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25167
25227
|
return offset !== 0;
|
|
25168
25228
|
}
|
|
25169
25229
|
|
|
25170
|
-
/**
|
|
25171
|
-
* Moves cursor left
|
|
25172
|
-
* @param {KeyboardEvent} e Event object
|
|
25230
|
+
/**
|
|
25231
|
+
* Moves cursor left
|
|
25232
|
+
* @param {KeyboardEvent} e Event object
|
|
25173
25233
|
*/
|
|
25174
25234
|
moveCursorLeft(e) {
|
|
25175
25235
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25178,11 +25238,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25178
25238
|
this._moveCursorLeftOrRight('Left', e);
|
|
25179
25239
|
}
|
|
25180
25240
|
|
|
25181
|
-
/**
|
|
25182
|
-
* @private
|
|
25183
|
-
* @return {Boolean} true if a change happened
|
|
25184
|
-
*
|
|
25185
|
-
* @todo refactor not to use method name composition
|
|
25241
|
+
/**
|
|
25242
|
+
* @private
|
|
25243
|
+
* @return {Boolean} true if a change happened
|
|
25244
|
+
*
|
|
25245
|
+
* @todo refactor not to use method name composition
|
|
25186
25246
|
*/
|
|
25187
25247
|
_move(e, prop, direction) {
|
|
25188
25248
|
let newValue;
|
|
@@ -25201,23 +25261,23 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25201
25261
|
return false;
|
|
25202
25262
|
}
|
|
25203
25263
|
|
|
25204
|
-
/**
|
|
25205
|
-
* @private
|
|
25264
|
+
/**
|
|
25265
|
+
* @private
|
|
25206
25266
|
*/
|
|
25207
25267
|
_moveLeft(e, prop) {
|
|
25208
25268
|
return this._move(e, prop, 'Left');
|
|
25209
25269
|
}
|
|
25210
25270
|
|
|
25211
|
-
/**
|
|
25212
|
-
* @private
|
|
25271
|
+
/**
|
|
25272
|
+
* @private
|
|
25213
25273
|
*/
|
|
25214
25274
|
_moveRight(e, prop) {
|
|
25215
25275
|
return this._move(e, prop, 'Right');
|
|
25216
25276
|
}
|
|
25217
25277
|
|
|
25218
|
-
/**
|
|
25219
|
-
* Moves cursor left without keeping selection
|
|
25220
|
-
* @param {KeyboardEvent} e
|
|
25278
|
+
/**
|
|
25279
|
+
* Moves cursor left without keeping selection
|
|
25280
|
+
* @param {KeyboardEvent} e
|
|
25221
25281
|
*/
|
|
25222
25282
|
moveCursorLeftWithoutShift(e) {
|
|
25223
25283
|
let change = true;
|
|
@@ -25232,9 +25292,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25232
25292
|
return change;
|
|
25233
25293
|
}
|
|
25234
25294
|
|
|
25235
|
-
/**
|
|
25236
|
-
* Moves cursor left while keeping selection
|
|
25237
|
-
* @param {KeyboardEvent} e
|
|
25295
|
+
/**
|
|
25296
|
+
* Moves cursor left while keeping selection
|
|
25297
|
+
* @param {KeyboardEvent} e
|
|
25238
25298
|
*/
|
|
25239
25299
|
moveCursorLeftWithShift(e) {
|
|
25240
25300
|
if (this._selectionDirection === RIGHT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25245,9 +25305,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25245
25305
|
}
|
|
25246
25306
|
}
|
|
25247
25307
|
|
|
25248
|
-
/**
|
|
25249
|
-
* Moves cursor right
|
|
25250
|
-
* @param {KeyboardEvent} e Event object
|
|
25308
|
+
/**
|
|
25309
|
+
* Moves cursor right
|
|
25310
|
+
* @param {KeyboardEvent} e Event object
|
|
25251
25311
|
*/
|
|
25252
25312
|
moveCursorRight(e) {
|
|
25253
25313
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25256,10 +25316,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25256
25316
|
this._moveCursorLeftOrRight('Right', e);
|
|
25257
25317
|
}
|
|
25258
25318
|
|
|
25259
|
-
/**
|
|
25260
|
-
* Moves cursor right or Left, fires event
|
|
25261
|
-
* @param {String} direction 'Left', 'Right'
|
|
25262
|
-
* @param {KeyboardEvent} e Event object
|
|
25319
|
+
/**
|
|
25320
|
+
* Moves cursor right or Left, fires event
|
|
25321
|
+
* @param {String} direction 'Left', 'Right'
|
|
25322
|
+
* @param {KeyboardEvent} e Event object
|
|
25263
25323
|
*/
|
|
25264
25324
|
_moveCursorLeftOrRight(direction, e) {
|
|
25265
25325
|
const actionName = `moveCursor${direction}${e.shiftKey ? 'WithShift' : 'WithoutShift'}`;
|
|
@@ -25274,9 +25334,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25274
25334
|
}
|
|
25275
25335
|
}
|
|
25276
25336
|
|
|
25277
|
-
/**
|
|
25278
|
-
* Moves cursor right while keeping selection
|
|
25279
|
-
* @param {KeyboardEvent} e
|
|
25337
|
+
/**
|
|
25338
|
+
* Moves cursor right while keeping selection
|
|
25339
|
+
* @param {KeyboardEvent} e
|
|
25280
25340
|
*/
|
|
25281
25341
|
moveCursorRightWithShift(e) {
|
|
25282
25342
|
if (this._selectionDirection === LEFT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25287,9 +25347,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25287
25347
|
}
|
|
25288
25348
|
}
|
|
25289
25349
|
|
|
25290
|
-
/**
|
|
25291
|
-
* Moves cursor right without keeping selection
|
|
25292
|
-
* @param {KeyboardEvent} e Event object
|
|
25350
|
+
/**
|
|
25351
|
+
* Moves cursor right without keeping selection
|
|
25352
|
+
* @param {KeyboardEvent} e Event object
|
|
25293
25353
|
*/
|
|
25294
25354
|
moveCursorRightWithoutShift(e) {
|
|
25295
25355
|
let changed = true;
|