@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.mjs
CHANGED
|
@@ -354,7 +354,7 @@ class Cache {
|
|
|
354
354
|
}
|
|
355
355
|
const cache = new Cache();
|
|
356
356
|
|
|
357
|
-
var version = "7.0.1-
|
|
357
|
+
var version = "7.0.1-beta11";
|
|
358
358
|
|
|
359
359
|
// use this syntax so babel plugin see this import here
|
|
360
360
|
const VERSION = version;
|
|
@@ -4801,7 +4801,7 @@ const TEXT_DECORATION_THICKNESS = 'textDecorationThickness';
|
|
|
4801
4801
|
const fontProperties = ['fontSize', 'fontWeight', 'fontFamily', 'fontStyle'];
|
|
4802
4802
|
const textDecorationProperties = ['underline', 'overline', 'linethrough'];
|
|
4803
4803
|
const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign', 'wrap', 'ellipsis', 'letterSpacing', 'enableAdvancedLayout', 'verticalAlign'];
|
|
4804
|
-
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS];
|
|
4804
|
+
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS, 'useOverlayEditing'];
|
|
4805
4805
|
const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor', TEXT_DECORATION_THICKNESS];
|
|
4806
4806
|
|
|
4807
4807
|
// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
|
|
@@ -22379,6 +22379,10 @@ class FabricText extends StyledText {
|
|
|
22379
22379
|
textObject._usingBrowserWrapping = true;
|
|
22380
22380
|
console.log(`🔤 STV font: Forcing browser wrapping flag during JSON load`);
|
|
22381
22381
|
|
|
22382
|
+
// Enable overlay editing for STV fonts to use native browser text handling
|
|
22383
|
+
textObject.useOverlayEditing = true;
|
|
22384
|
+
console.log(`🔤 STV font: Enabling overlay editing during JSON load`);
|
|
22385
|
+
|
|
22382
22386
|
// Multiple initialization attempts for STV fonts
|
|
22383
22387
|
const reinitWithDelay = attempt => {
|
|
22384
22388
|
if (textObject.forceTextReinitialization) {
|
|
@@ -24151,10 +24155,20 @@ class ITextBehavior extends FabricText {
|
|
|
24151
24155
|
* @private
|
|
24152
24156
|
*/
|
|
24153
24157
|
_updateTextarea() {
|
|
24158
|
+
console.log('🔤 _updateTextarea called with fabric text:', this.text);
|
|
24154
24159
|
this.cursorOffsetCache = {};
|
|
24155
24160
|
if (!this.hiddenTextarea) {
|
|
24156
24161
|
return;
|
|
24157
24162
|
}
|
|
24163
|
+
|
|
24164
|
+
// Sync textarea content with fabric text to prevent double-keypress issues
|
|
24165
|
+
const currentFabricText = this.text;
|
|
24166
|
+
if (this.hiddenTextarea.value !== currentFabricText) {
|
|
24167
|
+
console.log('🔤 _updateTextarea: syncing textarea to fabric text');
|
|
24168
|
+
console.log('🔤 _updateTextarea: textarea was:', this.hiddenTextarea.value);
|
|
24169
|
+
console.log('🔤 _updateTextarea: fabric is:', currentFabricText);
|
|
24170
|
+
this.hiddenTextarea.value = currentFabricText;
|
|
24171
|
+
}
|
|
24158
24172
|
if (!this.inCompositionMode) {
|
|
24159
24173
|
const newSelection = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text);
|
|
24160
24174
|
this.hiddenTextarea.selectionStart = newSelection.selectionStart;
|
|
@@ -24656,36 +24670,36 @@ class ITextBehavior extends FabricText {
|
|
|
24656
24670
|
}
|
|
24657
24671
|
|
|
24658
24672
|
class ITextKeyBehavior extends ITextBehavior {
|
|
24659
|
-
/**
|
|
24660
|
-
* For functionalities on keyDown
|
|
24661
|
-
* Map a special key to a function of the instance/prototype
|
|
24662
|
-
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24663
|
-
* this map setting the name of a function that you build on the IText or
|
|
24664
|
-
* your prototype.
|
|
24665
|
-
* the map change will affect all Instances unless you need for only some text Instances
|
|
24666
|
-
* in that case you have to clone this object and assign your Instance.
|
|
24667
|
-
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24668
|
-
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24673
|
+
/**
|
|
24674
|
+
* For functionalities on keyDown
|
|
24675
|
+
* Map a special key to a function of the instance/prototype
|
|
24676
|
+
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24677
|
+
* this map setting the name of a function that you build on the IText or
|
|
24678
|
+
* your prototype.
|
|
24679
|
+
* the map change will affect all Instances unless you need for only some text Instances
|
|
24680
|
+
* in that case you have to clone this object and assign your Instance.
|
|
24681
|
+
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24682
|
+
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24669
24683
|
*/
|
|
24670
24684
|
|
|
24671
|
-
/**
|
|
24672
|
-
* For functionalities on keyUp + ctrl || cmd
|
|
24685
|
+
/**
|
|
24686
|
+
* For functionalities on keyUp + ctrl || cmd
|
|
24673
24687
|
*/
|
|
24674
24688
|
|
|
24675
|
-
/**
|
|
24676
|
-
* For functionalities on keyDown + ctrl || cmd
|
|
24689
|
+
/**
|
|
24690
|
+
* For functionalities on keyDown + ctrl || cmd
|
|
24677
24691
|
*/
|
|
24678
24692
|
|
|
24679
|
-
/**
|
|
24680
|
-
* DOM container to append the hiddenTextarea.
|
|
24681
|
-
* An alternative to attaching to the document.body.
|
|
24682
|
-
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24683
|
-
* also with modals event capturing that won't let the textarea take focus.
|
|
24684
|
-
* @type HTMLElement
|
|
24693
|
+
/**
|
|
24694
|
+
* DOM container to append the hiddenTextarea.
|
|
24695
|
+
* An alternative to attaching to the document.body.
|
|
24696
|
+
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24697
|
+
* also with modals event capturing that won't let the textarea take focus.
|
|
24698
|
+
* @type HTMLElement
|
|
24685
24699
|
*/
|
|
24686
24700
|
|
|
24687
|
-
/**
|
|
24688
|
-
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24701
|
+
/**
|
|
24702
|
+
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24689
24703
|
*/
|
|
24690
24704
|
initHiddenTextarea() {
|
|
24691
24705
|
const doc = this.canvas && getDocumentFromElement(this.canvas.getElement()) || getFabricDocument();
|
|
@@ -24728,17 +24742,17 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24728
24742
|
this.hiddenTextarea = textarea;
|
|
24729
24743
|
}
|
|
24730
24744
|
|
|
24731
|
-
/**
|
|
24732
|
-
* Override this method to customize cursor behavior on textbox blur
|
|
24745
|
+
/**
|
|
24746
|
+
* Override this method to customize cursor behavior on textbox blur
|
|
24733
24747
|
*/
|
|
24734
24748
|
blur() {
|
|
24735
24749
|
this.abortCursorAnimation();
|
|
24736
24750
|
}
|
|
24737
24751
|
|
|
24738
|
-
/**
|
|
24739
|
-
* Handles keydown event
|
|
24740
|
-
* only used for arrows and combination of modifier keys.
|
|
24741
|
-
* @param {KeyboardEvent} e Event object
|
|
24752
|
+
/**
|
|
24753
|
+
* Handles keydown event
|
|
24754
|
+
* only used for arrows and combination of modifier keys.
|
|
24755
|
+
* @param {KeyboardEvent} e Event object
|
|
24742
24756
|
*/
|
|
24743
24757
|
onKeyDown(e) {
|
|
24744
24758
|
if (!this.isEditing) {
|
|
@@ -24764,11 +24778,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24764
24778
|
}
|
|
24765
24779
|
}
|
|
24766
24780
|
|
|
24767
|
-
/**
|
|
24768
|
-
* Handles keyup event
|
|
24769
|
-
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24770
|
-
* if a copy/cut event fired, keyup is dismissed
|
|
24771
|
-
* @param {KeyboardEvent} e Event object
|
|
24781
|
+
/**
|
|
24782
|
+
* Handles keyup event
|
|
24783
|
+
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24784
|
+
* if a copy/cut event fired, keyup is dismissed
|
|
24785
|
+
* @param {KeyboardEvent} e Event object
|
|
24772
24786
|
*/
|
|
24773
24787
|
onKeyUp(e) {
|
|
24774
24788
|
if (!this.isEditing || this._copyDone || this.inCompositionMode) {
|
|
@@ -24785,9 +24799,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24785
24799
|
this.canvas && this.canvas.requestRenderAll();
|
|
24786
24800
|
}
|
|
24787
24801
|
|
|
24788
|
-
/**
|
|
24789
|
-
* Handles onInput event
|
|
24790
|
-
* @param {Event} e Event object
|
|
24802
|
+
/**
|
|
24803
|
+
* Handles onInput event
|
|
24804
|
+
* @param {Event} e Event object
|
|
24791
24805
|
*/
|
|
24792
24806
|
onInput(e) {
|
|
24793
24807
|
const fromPaste = this.fromPaste;
|
|
@@ -24801,6 +24815,52 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24801
24815
|
if (!this.isEditing) {
|
|
24802
24816
|
return;
|
|
24803
24817
|
}
|
|
24818
|
+
|
|
24819
|
+
// Debug log to track the double keypress issue
|
|
24820
|
+
console.log('🔤 onInput debug:', {
|
|
24821
|
+
fabricText: this.text,
|
|
24822
|
+
textareaValue: value,
|
|
24823
|
+
fabricSelection: {
|
|
24824
|
+
start: this.selectionStart,
|
|
24825
|
+
end: this.selectionEnd
|
|
24826
|
+
},
|
|
24827
|
+
textareaSelection: {
|
|
24828
|
+
start: selectionStart,
|
|
24829
|
+
end: selectionEnd
|
|
24830
|
+
},
|
|
24831
|
+
fromPaste,
|
|
24832
|
+
inComposition: this.inCompositionMode
|
|
24833
|
+
});
|
|
24834
|
+
|
|
24835
|
+
// Immediate sync for simple character replacement - fix for double keypress issue
|
|
24836
|
+
if (this.text !== value && !this.inCompositionMode) {
|
|
24837
|
+
console.log('🔤 Immediate sync: fabric text differs from textarea, syncing immediately');
|
|
24838
|
+
console.log('🔤 Before sync - fabric text:', this.text);
|
|
24839
|
+
console.log('🔤 Before sync - textarea value:', value);
|
|
24840
|
+
console.log('🔤 fromPaste:', fromPaste);
|
|
24841
|
+
|
|
24842
|
+
// Clear all relevant caches that might prevent visual updates
|
|
24843
|
+
this.cursorOffsetCache = {};
|
|
24844
|
+
this._browserWrapCache = null;
|
|
24845
|
+
this._lastDimensionState = null;
|
|
24846
|
+
this._forceClearCache = true;
|
|
24847
|
+
console.log('🔤 Cleared all caches');
|
|
24848
|
+
|
|
24849
|
+
// Use the same logic as updateAndFire but immediately
|
|
24850
|
+
this.updateFromTextArea();
|
|
24851
|
+
this.fire(CHANGED);
|
|
24852
|
+
if (this.canvas) {
|
|
24853
|
+
this.canvas.fire('text:changed', {
|
|
24854
|
+
target: this
|
|
24855
|
+
});
|
|
24856
|
+
// ONLY use synchronous rendering to avoid race conditions
|
|
24857
|
+
// Remove requestRenderAll() which queues for next animation frame
|
|
24858
|
+
this.canvas.renderAll();
|
|
24859
|
+
}
|
|
24860
|
+
console.log('🔤 After updateFromTextArea - fabric text:', this.text);
|
|
24861
|
+
console.log('🔤 Sync complete, caches cleared, synchronous render only');
|
|
24862
|
+
return;
|
|
24863
|
+
}
|
|
24804
24864
|
const updateAndFire = () => {
|
|
24805
24865
|
this.updateFromTextArea();
|
|
24806
24866
|
this.fire(CHANGED);
|
|
@@ -24878,15 +24938,15 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24878
24938
|
updateAndFire();
|
|
24879
24939
|
}
|
|
24880
24940
|
|
|
24881
|
-
/**
|
|
24882
|
-
* Composition start
|
|
24941
|
+
/**
|
|
24942
|
+
* Composition start
|
|
24883
24943
|
*/
|
|
24884
24944
|
onCompositionStart() {
|
|
24885
24945
|
this.inCompositionMode = true;
|
|
24886
24946
|
}
|
|
24887
24947
|
|
|
24888
|
-
/**
|
|
24889
|
-
* Composition end
|
|
24948
|
+
/**
|
|
24949
|
+
* Composition end
|
|
24890
24950
|
*/
|
|
24891
24951
|
onCompositionEnd() {
|
|
24892
24952
|
this.inCompositionMode = false;
|
|
@@ -24904,8 +24964,8 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24904
24964
|
this.updateTextareaPosition();
|
|
24905
24965
|
}
|
|
24906
24966
|
|
|
24907
|
-
/**
|
|
24908
|
-
* Copies selected text
|
|
24967
|
+
/**
|
|
24968
|
+
* Copies selected text
|
|
24909
24969
|
*/
|
|
24910
24970
|
copy() {
|
|
24911
24971
|
if (this.selectionStart === this.selectionEnd) {
|
|
@@ -24924,19 +24984,19 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24924
24984
|
this._copyDone = true;
|
|
24925
24985
|
}
|
|
24926
24986
|
|
|
24927
|
-
/**
|
|
24928
|
-
* Pastes text
|
|
24987
|
+
/**
|
|
24988
|
+
* Pastes text
|
|
24929
24989
|
*/
|
|
24930
24990
|
paste() {
|
|
24931
24991
|
this.fromPaste = true;
|
|
24932
24992
|
}
|
|
24933
24993
|
|
|
24934
|
-
/**
|
|
24935
|
-
* Finds the width in pixels before the cursor on the same line
|
|
24936
|
-
* @private
|
|
24937
|
-
* @param {Number} lineIndex
|
|
24938
|
-
* @param {Number} charIndex
|
|
24939
|
-
* @return {Number} widthBeforeCursor width before cursor
|
|
24994
|
+
/**
|
|
24995
|
+
* Finds the width in pixels before the cursor on the same line
|
|
24996
|
+
* @private
|
|
24997
|
+
* @param {Number} lineIndex
|
|
24998
|
+
* @param {Number} charIndex
|
|
24999
|
+
* @return {Number} widthBeforeCursor width before cursor
|
|
24940
25000
|
*/
|
|
24941
25001
|
_getWidthBeforeCursor(lineIndex, charIndex) {
|
|
24942
25002
|
let widthBeforeCursor = this._getLineLeftOffset(lineIndex),
|
|
@@ -24948,11 +25008,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24948
25008
|
return widthBeforeCursor;
|
|
24949
25009
|
}
|
|
24950
25010
|
|
|
24951
|
-
/**
|
|
24952
|
-
* Gets start offset of a selection
|
|
24953
|
-
* @param {KeyboardEvent} e Event object
|
|
24954
|
-
* @param {Boolean} isRight
|
|
24955
|
-
* @return {Number}
|
|
25011
|
+
/**
|
|
25012
|
+
* Gets start offset of a selection
|
|
25013
|
+
* @param {KeyboardEvent} e Event object
|
|
25014
|
+
* @param {Boolean} isRight
|
|
25015
|
+
* @return {Number}
|
|
24956
25016
|
*/
|
|
24957
25017
|
getDownCursorOffset(e, isRight) {
|
|
24958
25018
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -24970,12 +25030,12 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24970
25030
|
return textAfterCursor.length + indexOnOtherLine + 1 + this.missingNewlineOffset(lineIndex);
|
|
24971
25031
|
}
|
|
24972
25032
|
|
|
24973
|
-
/**
|
|
24974
|
-
* private
|
|
24975
|
-
* Helps finding if the offset should be counted from Start or End
|
|
24976
|
-
* @param {KeyboardEvent} e Event object
|
|
24977
|
-
* @param {Boolean} isRight
|
|
24978
|
-
* @return {Number}
|
|
25033
|
+
/**
|
|
25034
|
+
* private
|
|
25035
|
+
* Helps finding if the offset should be counted from Start or End
|
|
25036
|
+
* @param {KeyboardEvent} e Event object
|
|
25037
|
+
* @param {Boolean} isRight
|
|
25038
|
+
* @return {Number}
|
|
24979
25039
|
*/
|
|
24980
25040
|
_getSelectionForOffset(e, isRight) {
|
|
24981
25041
|
if (e.shiftKey && this.selectionStart !== this.selectionEnd && isRight) {
|
|
@@ -24985,10 +25045,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
24985
25045
|
}
|
|
24986
25046
|
}
|
|
24987
25047
|
|
|
24988
|
-
/**
|
|
24989
|
-
* @param {KeyboardEvent} e Event object
|
|
24990
|
-
* @param {Boolean} isRight
|
|
24991
|
-
* @return {Number}
|
|
25048
|
+
/**
|
|
25049
|
+
* @param {KeyboardEvent} e Event object
|
|
25050
|
+
* @param {Boolean} isRight
|
|
25051
|
+
* @return {Number}
|
|
24992
25052
|
*/
|
|
24993
25053
|
getUpCursorOffset(e, isRight) {
|
|
24994
25054
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -25007,9 +25067,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25007
25067
|
return -this._textLines[lineIndex - 1].length + indexOnOtherLine - textBeforeCursor.length + (1 - missingNewlineOffset);
|
|
25008
25068
|
}
|
|
25009
25069
|
|
|
25010
|
-
/**
|
|
25011
|
-
* for a given width it founds the matching character.
|
|
25012
|
-
* @private
|
|
25070
|
+
/**
|
|
25071
|
+
* for a given width it founds the matching character.
|
|
25072
|
+
* @private
|
|
25013
25073
|
*/
|
|
25014
25074
|
_getIndexOnLine(lineIndex, width) {
|
|
25015
25075
|
const line = this._textLines[lineIndex],
|
|
@@ -25039,9 +25099,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25039
25099
|
return indexOnLine;
|
|
25040
25100
|
}
|
|
25041
25101
|
|
|
25042
|
-
/**
|
|
25043
|
-
* Moves cursor down
|
|
25044
|
-
* @param {KeyboardEvent} e Event object
|
|
25102
|
+
/**
|
|
25103
|
+
* Moves cursor down
|
|
25104
|
+
* @param {KeyboardEvent} e Event object
|
|
25045
25105
|
*/
|
|
25046
25106
|
moveCursorDown(e) {
|
|
25047
25107
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25050,9 +25110,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25050
25110
|
this._moveCursorUpOrDown('Down', e);
|
|
25051
25111
|
}
|
|
25052
25112
|
|
|
25053
|
-
/**
|
|
25054
|
-
* Moves cursor up
|
|
25055
|
-
* @param {KeyboardEvent} e Event object
|
|
25113
|
+
/**
|
|
25114
|
+
* Moves cursor up
|
|
25115
|
+
* @param {KeyboardEvent} e Event object
|
|
25056
25116
|
*/
|
|
25057
25117
|
moveCursorUp(e) {
|
|
25058
25118
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25061,10 +25121,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25061
25121
|
this._moveCursorUpOrDown('Up', e);
|
|
25062
25122
|
}
|
|
25063
25123
|
|
|
25064
|
-
/**
|
|
25065
|
-
* Moves cursor up or down, fires the events
|
|
25066
|
-
* @param {String} direction 'Up' or 'Down'
|
|
25067
|
-
* @param {KeyboardEvent} e Event object
|
|
25124
|
+
/**
|
|
25125
|
+
* Moves cursor up or down, fires the events
|
|
25126
|
+
* @param {String} direction 'Up' or 'Down'
|
|
25127
|
+
* @param {KeyboardEvent} e Event object
|
|
25068
25128
|
*/
|
|
25069
25129
|
_moveCursorUpOrDown(direction, e) {
|
|
25070
25130
|
const offset = this[`get${direction}CursorOffset`](e, this._selectionDirection === RIGHT);
|
|
@@ -25086,9 +25146,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25086
25146
|
}
|
|
25087
25147
|
}
|
|
25088
25148
|
|
|
25089
|
-
/**
|
|
25090
|
-
* Moves cursor with shift
|
|
25091
|
-
* @param {Number} offset
|
|
25149
|
+
/**
|
|
25150
|
+
* Moves cursor with shift
|
|
25151
|
+
* @param {Number} offset
|
|
25092
25152
|
*/
|
|
25093
25153
|
moveCursorWithShift(offset) {
|
|
25094
25154
|
const newSelection = this._selectionDirection === LEFT ? this.selectionStart + offset : this.selectionEnd + offset;
|
|
@@ -25096,9 +25156,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25096
25156
|
return offset !== 0;
|
|
25097
25157
|
}
|
|
25098
25158
|
|
|
25099
|
-
/**
|
|
25100
|
-
* Moves cursor up without shift
|
|
25101
|
-
* @param {Number} offset
|
|
25159
|
+
/**
|
|
25160
|
+
* Moves cursor up without shift
|
|
25161
|
+
* @param {Number} offset
|
|
25102
25162
|
*/
|
|
25103
25163
|
moveCursorWithoutShift(offset) {
|
|
25104
25164
|
if (offset < 0) {
|
|
@@ -25111,9 +25171,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25111
25171
|
return offset !== 0;
|
|
25112
25172
|
}
|
|
25113
25173
|
|
|
25114
|
-
/**
|
|
25115
|
-
* Moves cursor left
|
|
25116
|
-
* @param {KeyboardEvent} e Event object
|
|
25174
|
+
/**
|
|
25175
|
+
* Moves cursor left
|
|
25176
|
+
* @param {KeyboardEvent} e Event object
|
|
25117
25177
|
*/
|
|
25118
25178
|
moveCursorLeft(e) {
|
|
25119
25179
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25122,11 +25182,11 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25122
25182
|
this._moveCursorLeftOrRight('Left', e);
|
|
25123
25183
|
}
|
|
25124
25184
|
|
|
25125
|
-
/**
|
|
25126
|
-
* @private
|
|
25127
|
-
* @return {Boolean} true if a change happened
|
|
25128
|
-
*
|
|
25129
|
-
* @todo refactor not to use method name composition
|
|
25185
|
+
/**
|
|
25186
|
+
* @private
|
|
25187
|
+
* @return {Boolean} true if a change happened
|
|
25188
|
+
*
|
|
25189
|
+
* @todo refactor not to use method name composition
|
|
25130
25190
|
*/
|
|
25131
25191
|
_move(e, prop, direction) {
|
|
25132
25192
|
let newValue;
|
|
@@ -25145,23 +25205,23 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25145
25205
|
return false;
|
|
25146
25206
|
}
|
|
25147
25207
|
|
|
25148
|
-
/**
|
|
25149
|
-
* @private
|
|
25208
|
+
/**
|
|
25209
|
+
* @private
|
|
25150
25210
|
*/
|
|
25151
25211
|
_moveLeft(e, prop) {
|
|
25152
25212
|
return this._move(e, prop, 'Left');
|
|
25153
25213
|
}
|
|
25154
25214
|
|
|
25155
|
-
/**
|
|
25156
|
-
* @private
|
|
25215
|
+
/**
|
|
25216
|
+
* @private
|
|
25157
25217
|
*/
|
|
25158
25218
|
_moveRight(e, prop) {
|
|
25159
25219
|
return this._move(e, prop, 'Right');
|
|
25160
25220
|
}
|
|
25161
25221
|
|
|
25162
|
-
/**
|
|
25163
|
-
* Moves cursor left without keeping selection
|
|
25164
|
-
* @param {KeyboardEvent} e
|
|
25222
|
+
/**
|
|
25223
|
+
* Moves cursor left without keeping selection
|
|
25224
|
+
* @param {KeyboardEvent} e
|
|
25165
25225
|
*/
|
|
25166
25226
|
moveCursorLeftWithoutShift(e) {
|
|
25167
25227
|
let change = true;
|
|
@@ -25176,9 +25236,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25176
25236
|
return change;
|
|
25177
25237
|
}
|
|
25178
25238
|
|
|
25179
|
-
/**
|
|
25180
|
-
* Moves cursor left while keeping selection
|
|
25181
|
-
* @param {KeyboardEvent} e
|
|
25239
|
+
/**
|
|
25240
|
+
* Moves cursor left while keeping selection
|
|
25241
|
+
* @param {KeyboardEvent} e
|
|
25182
25242
|
*/
|
|
25183
25243
|
moveCursorLeftWithShift(e) {
|
|
25184
25244
|
if (this._selectionDirection === RIGHT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25189,9 +25249,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25189
25249
|
}
|
|
25190
25250
|
}
|
|
25191
25251
|
|
|
25192
|
-
/**
|
|
25193
|
-
* Moves cursor right
|
|
25194
|
-
* @param {KeyboardEvent} e Event object
|
|
25252
|
+
/**
|
|
25253
|
+
* Moves cursor right
|
|
25254
|
+
* @param {KeyboardEvent} e Event object
|
|
25195
25255
|
*/
|
|
25196
25256
|
moveCursorRight(e) {
|
|
25197
25257
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25200,10 +25260,10 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25200
25260
|
this._moveCursorLeftOrRight('Right', e);
|
|
25201
25261
|
}
|
|
25202
25262
|
|
|
25203
|
-
/**
|
|
25204
|
-
* Moves cursor right or Left, fires event
|
|
25205
|
-
* @param {String} direction 'Left', 'Right'
|
|
25206
|
-
* @param {KeyboardEvent} e Event object
|
|
25263
|
+
/**
|
|
25264
|
+
* Moves cursor right or Left, fires event
|
|
25265
|
+
* @param {String} direction 'Left', 'Right'
|
|
25266
|
+
* @param {KeyboardEvent} e Event object
|
|
25207
25267
|
*/
|
|
25208
25268
|
_moveCursorLeftOrRight(direction, e) {
|
|
25209
25269
|
const actionName = `moveCursor${direction}${e.shiftKey ? 'WithShift' : 'WithoutShift'}`;
|
|
@@ -25218,9 +25278,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25218
25278
|
}
|
|
25219
25279
|
}
|
|
25220
25280
|
|
|
25221
|
-
/**
|
|
25222
|
-
* Moves cursor right while keeping selection
|
|
25223
|
-
* @param {KeyboardEvent} e
|
|
25281
|
+
/**
|
|
25282
|
+
* Moves cursor right while keeping selection
|
|
25283
|
+
* @param {KeyboardEvent} e
|
|
25224
25284
|
*/
|
|
25225
25285
|
moveCursorRightWithShift(e) {
|
|
25226
25286
|
if (this._selectionDirection === LEFT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25231,9 +25291,9 @@ class ITextKeyBehavior extends ITextBehavior {
|
|
|
25231
25291
|
}
|
|
25232
25292
|
}
|
|
25233
25293
|
|
|
25234
|
-
/**
|
|
25235
|
-
* Moves cursor right without keeping selection
|
|
25236
|
-
* @param {KeyboardEvent} e Event object
|
|
25294
|
+
/**
|
|
25295
|
+
* Moves cursor right without keeping selection
|
|
25296
|
+
* @param {KeyboardEvent} e Event object
|
|
25237
25297
|
*/
|
|
25238
25298
|
moveCursorRightWithoutShift(e) {
|
|
25239
25299
|
let changed = true;
|