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