@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.js
CHANGED
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
}
|
|
361
361
|
const cache = new Cache();
|
|
362
362
|
|
|
363
|
-
var version = "7.0.1-
|
|
363
|
+
var version = "7.0.1-beta11";
|
|
364
364
|
|
|
365
365
|
// use this syntax so babel plugin see this import here
|
|
366
366
|
const VERSION = version;
|
|
@@ -4807,7 +4807,7 @@
|
|
|
4807
4807
|
const fontProperties = ['fontSize', 'fontWeight', 'fontFamily', 'fontStyle'];
|
|
4808
4808
|
const textDecorationProperties = ['underline', 'overline', 'linethrough'];
|
|
4809
4809
|
const textLayoutProperties = [...fontProperties, 'lineHeight', 'text', 'charSpacing', 'textAlign', 'styles', 'path', 'pathStartOffset', 'pathSide', 'pathAlign', 'wrap', 'ellipsis', 'letterSpacing', 'enableAdvancedLayout', 'verticalAlign'];
|
|
4810
|
-
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS];
|
|
4810
|
+
const additionalProps = [...textLayoutProperties, ...textDecorationProperties, 'textBackgroundColor', 'direction', TEXT_DECORATION_THICKNESS, 'useOverlayEditing'];
|
|
4811
4811
|
const styleProperties = [...fontProperties, ...textDecorationProperties, STROKE, 'strokeWidth', FILL, 'deltaY', 'textBackgroundColor', TEXT_DECORATION_THICKNESS];
|
|
4812
4812
|
|
|
4813
4813
|
// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype
|
|
@@ -22385,6 +22385,10 @@
|
|
|
22385
22385
|
textObject._usingBrowserWrapping = true;
|
|
22386
22386
|
console.log(`🔤 STV font: Forcing browser wrapping flag during JSON load`);
|
|
22387
22387
|
|
|
22388
|
+
// Enable overlay editing for STV fonts to use native browser text handling
|
|
22389
|
+
textObject.useOverlayEditing = true;
|
|
22390
|
+
console.log(`🔤 STV font: Enabling overlay editing during JSON load`);
|
|
22391
|
+
|
|
22388
22392
|
// Multiple initialization attempts for STV fonts
|
|
22389
22393
|
const reinitWithDelay = attempt => {
|
|
22390
22394
|
if (textObject.forceTextReinitialization) {
|
|
@@ -24157,10 +24161,20 @@
|
|
|
24157
24161
|
* @private
|
|
24158
24162
|
*/
|
|
24159
24163
|
_updateTextarea() {
|
|
24164
|
+
console.log('🔤 _updateTextarea called with fabric text:', this.text);
|
|
24160
24165
|
this.cursorOffsetCache = {};
|
|
24161
24166
|
if (!this.hiddenTextarea) {
|
|
24162
24167
|
return;
|
|
24163
24168
|
}
|
|
24169
|
+
|
|
24170
|
+
// Sync textarea content with fabric text to prevent double-keypress issues
|
|
24171
|
+
const currentFabricText = this.text;
|
|
24172
|
+
if (this.hiddenTextarea.value !== currentFabricText) {
|
|
24173
|
+
console.log('🔤 _updateTextarea: syncing textarea to fabric text');
|
|
24174
|
+
console.log('🔤 _updateTextarea: textarea was:', this.hiddenTextarea.value);
|
|
24175
|
+
console.log('🔤 _updateTextarea: fabric is:', currentFabricText);
|
|
24176
|
+
this.hiddenTextarea.value = currentFabricText;
|
|
24177
|
+
}
|
|
24164
24178
|
if (!this.inCompositionMode) {
|
|
24165
24179
|
const newSelection = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text);
|
|
24166
24180
|
this.hiddenTextarea.selectionStart = newSelection.selectionStart;
|
|
@@ -24662,36 +24676,36 @@
|
|
|
24662
24676
|
}
|
|
24663
24677
|
|
|
24664
24678
|
class ITextKeyBehavior extends ITextBehavior {
|
|
24665
|
-
/**
|
|
24666
|
-
* For functionalities on keyDown
|
|
24667
|
-
* Map a special key to a function of the instance/prototype
|
|
24668
|
-
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24669
|
-
* this map setting the name of a function that you build on the IText or
|
|
24670
|
-
* your prototype.
|
|
24671
|
-
* the map change will affect all Instances unless you need for only some text Instances
|
|
24672
|
-
* in that case you have to clone this object and assign your Instance.
|
|
24673
|
-
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24674
|
-
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24679
|
+
/**
|
|
24680
|
+
* For functionalities on keyDown
|
|
24681
|
+
* Map a special key to a function of the instance/prototype
|
|
24682
|
+
* If you need different behavior for ESC or TAB or arrows, you have to change
|
|
24683
|
+
* this map setting the name of a function that you build on the IText or
|
|
24684
|
+
* your prototype.
|
|
24685
|
+
* the map change will affect all Instances unless you need for only some text Instances
|
|
24686
|
+
* in that case you have to clone this object and assign your Instance.
|
|
24687
|
+
* this.keysMap = Object.assign({}, this.keysMap);
|
|
24688
|
+
* The function must be in IText.prototype.myFunction And will receive event as args[0]
|
|
24675
24689
|
*/
|
|
24676
24690
|
|
|
24677
|
-
/**
|
|
24678
|
-
* For functionalities on keyUp + ctrl || cmd
|
|
24691
|
+
/**
|
|
24692
|
+
* For functionalities on keyUp + ctrl || cmd
|
|
24679
24693
|
*/
|
|
24680
24694
|
|
|
24681
|
-
/**
|
|
24682
|
-
* For functionalities on keyDown + ctrl || cmd
|
|
24695
|
+
/**
|
|
24696
|
+
* For functionalities on keyDown + ctrl || cmd
|
|
24683
24697
|
*/
|
|
24684
24698
|
|
|
24685
|
-
/**
|
|
24686
|
-
* DOM container to append the hiddenTextarea.
|
|
24687
|
-
* An alternative to attaching to the document.body.
|
|
24688
|
-
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24689
|
-
* also with modals event capturing that won't let the textarea take focus.
|
|
24690
|
-
* @type HTMLElement
|
|
24699
|
+
/**
|
|
24700
|
+
* DOM container to append the hiddenTextarea.
|
|
24701
|
+
* An alternative to attaching to the document.body.
|
|
24702
|
+
* Useful to reduce laggish redraw of the full document.body tree and
|
|
24703
|
+
* also with modals event capturing that won't let the textarea take focus.
|
|
24704
|
+
* @type HTMLElement
|
|
24691
24705
|
*/
|
|
24692
24706
|
|
|
24693
|
-
/**
|
|
24694
|
-
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24707
|
+
/**
|
|
24708
|
+
* Initializes hidden textarea (needed to bring up keyboard in iOS)
|
|
24695
24709
|
*/
|
|
24696
24710
|
initHiddenTextarea() {
|
|
24697
24711
|
const doc = this.canvas && getDocumentFromElement(this.canvas.getElement()) || getFabricDocument();
|
|
@@ -24734,17 +24748,17 @@
|
|
|
24734
24748
|
this.hiddenTextarea = textarea;
|
|
24735
24749
|
}
|
|
24736
24750
|
|
|
24737
|
-
/**
|
|
24738
|
-
* Override this method to customize cursor behavior on textbox blur
|
|
24751
|
+
/**
|
|
24752
|
+
* Override this method to customize cursor behavior on textbox blur
|
|
24739
24753
|
*/
|
|
24740
24754
|
blur() {
|
|
24741
24755
|
this.abortCursorAnimation();
|
|
24742
24756
|
}
|
|
24743
24757
|
|
|
24744
|
-
/**
|
|
24745
|
-
* Handles keydown event
|
|
24746
|
-
* only used for arrows and combination of modifier keys.
|
|
24747
|
-
* @param {KeyboardEvent} e Event object
|
|
24758
|
+
/**
|
|
24759
|
+
* Handles keydown event
|
|
24760
|
+
* only used for arrows and combination of modifier keys.
|
|
24761
|
+
* @param {KeyboardEvent} e Event object
|
|
24748
24762
|
*/
|
|
24749
24763
|
onKeyDown(e) {
|
|
24750
24764
|
if (!this.isEditing) {
|
|
@@ -24770,11 +24784,11 @@
|
|
|
24770
24784
|
}
|
|
24771
24785
|
}
|
|
24772
24786
|
|
|
24773
|
-
/**
|
|
24774
|
-
* Handles keyup event
|
|
24775
|
-
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24776
|
-
* if a copy/cut event fired, keyup is dismissed
|
|
24777
|
-
* @param {KeyboardEvent} e Event object
|
|
24787
|
+
/**
|
|
24788
|
+
* Handles keyup event
|
|
24789
|
+
* We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
|
24790
|
+
* if a copy/cut event fired, keyup is dismissed
|
|
24791
|
+
* @param {KeyboardEvent} e Event object
|
|
24778
24792
|
*/
|
|
24779
24793
|
onKeyUp(e) {
|
|
24780
24794
|
if (!this.isEditing || this._copyDone || this.inCompositionMode) {
|
|
@@ -24791,9 +24805,9 @@
|
|
|
24791
24805
|
this.canvas && this.canvas.requestRenderAll();
|
|
24792
24806
|
}
|
|
24793
24807
|
|
|
24794
|
-
/**
|
|
24795
|
-
* Handles onInput event
|
|
24796
|
-
* @param {Event} e Event object
|
|
24808
|
+
/**
|
|
24809
|
+
* Handles onInput event
|
|
24810
|
+
* @param {Event} e Event object
|
|
24797
24811
|
*/
|
|
24798
24812
|
onInput(e) {
|
|
24799
24813
|
const fromPaste = this.fromPaste;
|
|
@@ -24807,6 +24821,52 @@
|
|
|
24807
24821
|
if (!this.isEditing) {
|
|
24808
24822
|
return;
|
|
24809
24823
|
}
|
|
24824
|
+
|
|
24825
|
+
// Debug log to track the double keypress issue
|
|
24826
|
+
console.log('🔤 onInput debug:', {
|
|
24827
|
+
fabricText: this.text,
|
|
24828
|
+
textareaValue: value,
|
|
24829
|
+
fabricSelection: {
|
|
24830
|
+
start: this.selectionStart,
|
|
24831
|
+
end: this.selectionEnd
|
|
24832
|
+
},
|
|
24833
|
+
textareaSelection: {
|
|
24834
|
+
start: selectionStart,
|
|
24835
|
+
end: selectionEnd
|
|
24836
|
+
},
|
|
24837
|
+
fromPaste,
|
|
24838
|
+
inComposition: this.inCompositionMode
|
|
24839
|
+
});
|
|
24840
|
+
|
|
24841
|
+
// Immediate sync for simple character replacement - fix for double keypress issue
|
|
24842
|
+
if (this.text !== value && !this.inCompositionMode) {
|
|
24843
|
+
console.log('🔤 Immediate sync: fabric text differs from textarea, syncing immediately');
|
|
24844
|
+
console.log('🔤 Before sync - fabric text:', this.text);
|
|
24845
|
+
console.log('🔤 Before sync - textarea value:', value);
|
|
24846
|
+
console.log('🔤 fromPaste:', fromPaste);
|
|
24847
|
+
|
|
24848
|
+
// Clear all relevant caches that might prevent visual updates
|
|
24849
|
+
this.cursorOffsetCache = {};
|
|
24850
|
+
this._browserWrapCache = null;
|
|
24851
|
+
this._lastDimensionState = null;
|
|
24852
|
+
this._forceClearCache = true;
|
|
24853
|
+
console.log('🔤 Cleared all caches');
|
|
24854
|
+
|
|
24855
|
+
// Use the same logic as updateAndFire but immediately
|
|
24856
|
+
this.updateFromTextArea();
|
|
24857
|
+
this.fire(CHANGED);
|
|
24858
|
+
if (this.canvas) {
|
|
24859
|
+
this.canvas.fire('text:changed', {
|
|
24860
|
+
target: this
|
|
24861
|
+
});
|
|
24862
|
+
// ONLY use synchronous rendering to avoid race conditions
|
|
24863
|
+
// Remove requestRenderAll() which queues for next animation frame
|
|
24864
|
+
this.canvas.renderAll();
|
|
24865
|
+
}
|
|
24866
|
+
console.log('🔤 After updateFromTextArea - fabric text:', this.text);
|
|
24867
|
+
console.log('🔤 Sync complete, caches cleared, synchronous render only');
|
|
24868
|
+
return;
|
|
24869
|
+
}
|
|
24810
24870
|
const updateAndFire = () => {
|
|
24811
24871
|
this.updateFromTextArea();
|
|
24812
24872
|
this.fire(CHANGED);
|
|
@@ -24884,15 +24944,15 @@
|
|
|
24884
24944
|
updateAndFire();
|
|
24885
24945
|
}
|
|
24886
24946
|
|
|
24887
|
-
/**
|
|
24888
|
-
* Composition start
|
|
24947
|
+
/**
|
|
24948
|
+
* Composition start
|
|
24889
24949
|
*/
|
|
24890
24950
|
onCompositionStart() {
|
|
24891
24951
|
this.inCompositionMode = true;
|
|
24892
24952
|
}
|
|
24893
24953
|
|
|
24894
|
-
/**
|
|
24895
|
-
* Composition end
|
|
24954
|
+
/**
|
|
24955
|
+
* Composition end
|
|
24896
24956
|
*/
|
|
24897
24957
|
onCompositionEnd() {
|
|
24898
24958
|
this.inCompositionMode = false;
|
|
@@ -24910,8 +24970,8 @@
|
|
|
24910
24970
|
this.updateTextareaPosition();
|
|
24911
24971
|
}
|
|
24912
24972
|
|
|
24913
|
-
/**
|
|
24914
|
-
* Copies selected text
|
|
24973
|
+
/**
|
|
24974
|
+
* Copies selected text
|
|
24915
24975
|
*/
|
|
24916
24976
|
copy() {
|
|
24917
24977
|
if (this.selectionStart === this.selectionEnd) {
|
|
@@ -24930,19 +24990,19 @@
|
|
|
24930
24990
|
this._copyDone = true;
|
|
24931
24991
|
}
|
|
24932
24992
|
|
|
24933
|
-
/**
|
|
24934
|
-
* Pastes text
|
|
24993
|
+
/**
|
|
24994
|
+
* Pastes text
|
|
24935
24995
|
*/
|
|
24936
24996
|
paste() {
|
|
24937
24997
|
this.fromPaste = true;
|
|
24938
24998
|
}
|
|
24939
24999
|
|
|
24940
|
-
/**
|
|
24941
|
-
* Finds the width in pixels before the cursor on the same line
|
|
24942
|
-
* @private
|
|
24943
|
-
* @param {Number} lineIndex
|
|
24944
|
-
* @param {Number} charIndex
|
|
24945
|
-
* @return {Number} widthBeforeCursor width before cursor
|
|
25000
|
+
/**
|
|
25001
|
+
* Finds the width in pixels before the cursor on the same line
|
|
25002
|
+
* @private
|
|
25003
|
+
* @param {Number} lineIndex
|
|
25004
|
+
* @param {Number} charIndex
|
|
25005
|
+
* @return {Number} widthBeforeCursor width before cursor
|
|
24946
25006
|
*/
|
|
24947
25007
|
_getWidthBeforeCursor(lineIndex, charIndex) {
|
|
24948
25008
|
let widthBeforeCursor = this._getLineLeftOffset(lineIndex),
|
|
@@ -24954,11 +25014,11 @@
|
|
|
24954
25014
|
return widthBeforeCursor;
|
|
24955
25015
|
}
|
|
24956
25016
|
|
|
24957
|
-
/**
|
|
24958
|
-
* Gets start offset of a selection
|
|
24959
|
-
* @param {KeyboardEvent} e Event object
|
|
24960
|
-
* @param {Boolean} isRight
|
|
24961
|
-
* @return {Number}
|
|
25017
|
+
/**
|
|
25018
|
+
* Gets start offset of a selection
|
|
25019
|
+
* @param {KeyboardEvent} e Event object
|
|
25020
|
+
* @param {Boolean} isRight
|
|
25021
|
+
* @return {Number}
|
|
24962
25022
|
*/
|
|
24963
25023
|
getDownCursorOffset(e, isRight) {
|
|
24964
25024
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -24976,12 +25036,12 @@
|
|
|
24976
25036
|
return textAfterCursor.length + indexOnOtherLine + 1 + this.missingNewlineOffset(lineIndex);
|
|
24977
25037
|
}
|
|
24978
25038
|
|
|
24979
|
-
/**
|
|
24980
|
-
* private
|
|
24981
|
-
* Helps finding if the offset should be counted from Start or End
|
|
24982
|
-
* @param {KeyboardEvent} e Event object
|
|
24983
|
-
* @param {Boolean} isRight
|
|
24984
|
-
* @return {Number}
|
|
25039
|
+
/**
|
|
25040
|
+
* private
|
|
25041
|
+
* Helps finding if the offset should be counted from Start or End
|
|
25042
|
+
* @param {KeyboardEvent} e Event object
|
|
25043
|
+
* @param {Boolean} isRight
|
|
25044
|
+
* @return {Number}
|
|
24985
25045
|
*/
|
|
24986
25046
|
_getSelectionForOffset(e, isRight) {
|
|
24987
25047
|
if (e.shiftKey && this.selectionStart !== this.selectionEnd && isRight) {
|
|
@@ -24991,10 +25051,10 @@
|
|
|
24991
25051
|
}
|
|
24992
25052
|
}
|
|
24993
25053
|
|
|
24994
|
-
/**
|
|
24995
|
-
* @param {KeyboardEvent} e Event object
|
|
24996
|
-
* @param {Boolean} isRight
|
|
24997
|
-
* @return {Number}
|
|
25054
|
+
/**
|
|
25055
|
+
* @param {KeyboardEvent} e Event object
|
|
25056
|
+
* @param {Boolean} isRight
|
|
25057
|
+
* @return {Number}
|
|
24998
25058
|
*/
|
|
24999
25059
|
getUpCursorOffset(e, isRight) {
|
|
25000
25060
|
const selectionProp = this._getSelectionForOffset(e, isRight),
|
|
@@ -25013,9 +25073,9 @@
|
|
|
25013
25073
|
return -this._textLines[lineIndex - 1].length + indexOnOtherLine - textBeforeCursor.length + (1 - missingNewlineOffset);
|
|
25014
25074
|
}
|
|
25015
25075
|
|
|
25016
|
-
/**
|
|
25017
|
-
* for a given width it founds the matching character.
|
|
25018
|
-
* @private
|
|
25076
|
+
/**
|
|
25077
|
+
* for a given width it founds the matching character.
|
|
25078
|
+
* @private
|
|
25019
25079
|
*/
|
|
25020
25080
|
_getIndexOnLine(lineIndex, width) {
|
|
25021
25081
|
const line = this._textLines[lineIndex],
|
|
@@ -25045,9 +25105,9 @@
|
|
|
25045
25105
|
return indexOnLine;
|
|
25046
25106
|
}
|
|
25047
25107
|
|
|
25048
|
-
/**
|
|
25049
|
-
* Moves cursor down
|
|
25050
|
-
* @param {KeyboardEvent} e Event object
|
|
25108
|
+
/**
|
|
25109
|
+
* Moves cursor down
|
|
25110
|
+
* @param {KeyboardEvent} e Event object
|
|
25051
25111
|
*/
|
|
25052
25112
|
moveCursorDown(e) {
|
|
25053
25113
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25056,9 +25116,9 @@
|
|
|
25056
25116
|
this._moveCursorUpOrDown('Down', e);
|
|
25057
25117
|
}
|
|
25058
25118
|
|
|
25059
|
-
/**
|
|
25060
|
-
* Moves cursor up
|
|
25061
|
-
* @param {KeyboardEvent} e Event object
|
|
25119
|
+
/**
|
|
25120
|
+
* Moves cursor up
|
|
25121
|
+
* @param {KeyboardEvent} e Event object
|
|
25062
25122
|
*/
|
|
25063
25123
|
moveCursorUp(e) {
|
|
25064
25124
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25067,10 +25127,10 @@
|
|
|
25067
25127
|
this._moveCursorUpOrDown('Up', e);
|
|
25068
25128
|
}
|
|
25069
25129
|
|
|
25070
|
-
/**
|
|
25071
|
-
* Moves cursor up or down, fires the events
|
|
25072
|
-
* @param {String} direction 'Up' or 'Down'
|
|
25073
|
-
* @param {KeyboardEvent} e Event object
|
|
25130
|
+
/**
|
|
25131
|
+
* Moves cursor up or down, fires the events
|
|
25132
|
+
* @param {String} direction 'Up' or 'Down'
|
|
25133
|
+
* @param {KeyboardEvent} e Event object
|
|
25074
25134
|
*/
|
|
25075
25135
|
_moveCursorUpOrDown(direction, e) {
|
|
25076
25136
|
const offset = this[`get${direction}CursorOffset`](e, this._selectionDirection === RIGHT);
|
|
@@ -25092,9 +25152,9 @@
|
|
|
25092
25152
|
}
|
|
25093
25153
|
}
|
|
25094
25154
|
|
|
25095
|
-
/**
|
|
25096
|
-
* Moves cursor with shift
|
|
25097
|
-
* @param {Number} offset
|
|
25155
|
+
/**
|
|
25156
|
+
* Moves cursor with shift
|
|
25157
|
+
* @param {Number} offset
|
|
25098
25158
|
*/
|
|
25099
25159
|
moveCursorWithShift(offset) {
|
|
25100
25160
|
const newSelection = this._selectionDirection === LEFT ? this.selectionStart + offset : this.selectionEnd + offset;
|
|
@@ -25102,9 +25162,9 @@
|
|
|
25102
25162
|
return offset !== 0;
|
|
25103
25163
|
}
|
|
25104
25164
|
|
|
25105
|
-
/**
|
|
25106
|
-
* Moves cursor up without shift
|
|
25107
|
-
* @param {Number} offset
|
|
25165
|
+
/**
|
|
25166
|
+
* Moves cursor up without shift
|
|
25167
|
+
* @param {Number} offset
|
|
25108
25168
|
*/
|
|
25109
25169
|
moveCursorWithoutShift(offset) {
|
|
25110
25170
|
if (offset < 0) {
|
|
@@ -25117,9 +25177,9 @@
|
|
|
25117
25177
|
return offset !== 0;
|
|
25118
25178
|
}
|
|
25119
25179
|
|
|
25120
|
-
/**
|
|
25121
|
-
* Moves cursor left
|
|
25122
|
-
* @param {KeyboardEvent} e Event object
|
|
25180
|
+
/**
|
|
25181
|
+
* Moves cursor left
|
|
25182
|
+
* @param {KeyboardEvent} e Event object
|
|
25123
25183
|
*/
|
|
25124
25184
|
moveCursorLeft(e) {
|
|
25125
25185
|
if (this.selectionStart === 0 && this.selectionEnd === 0) {
|
|
@@ -25128,11 +25188,11 @@
|
|
|
25128
25188
|
this._moveCursorLeftOrRight('Left', e);
|
|
25129
25189
|
}
|
|
25130
25190
|
|
|
25131
|
-
/**
|
|
25132
|
-
* @private
|
|
25133
|
-
* @return {Boolean} true if a change happened
|
|
25134
|
-
*
|
|
25135
|
-
* @todo refactor not to use method name composition
|
|
25191
|
+
/**
|
|
25192
|
+
* @private
|
|
25193
|
+
* @return {Boolean} true if a change happened
|
|
25194
|
+
*
|
|
25195
|
+
* @todo refactor not to use method name composition
|
|
25136
25196
|
*/
|
|
25137
25197
|
_move(e, prop, direction) {
|
|
25138
25198
|
let newValue;
|
|
@@ -25151,23 +25211,23 @@
|
|
|
25151
25211
|
return false;
|
|
25152
25212
|
}
|
|
25153
25213
|
|
|
25154
|
-
/**
|
|
25155
|
-
* @private
|
|
25214
|
+
/**
|
|
25215
|
+
* @private
|
|
25156
25216
|
*/
|
|
25157
25217
|
_moveLeft(e, prop) {
|
|
25158
25218
|
return this._move(e, prop, 'Left');
|
|
25159
25219
|
}
|
|
25160
25220
|
|
|
25161
|
-
/**
|
|
25162
|
-
* @private
|
|
25221
|
+
/**
|
|
25222
|
+
* @private
|
|
25163
25223
|
*/
|
|
25164
25224
|
_moveRight(e, prop) {
|
|
25165
25225
|
return this._move(e, prop, 'Right');
|
|
25166
25226
|
}
|
|
25167
25227
|
|
|
25168
|
-
/**
|
|
25169
|
-
* Moves cursor left without keeping selection
|
|
25170
|
-
* @param {KeyboardEvent} e
|
|
25228
|
+
/**
|
|
25229
|
+
* Moves cursor left without keeping selection
|
|
25230
|
+
* @param {KeyboardEvent} e
|
|
25171
25231
|
*/
|
|
25172
25232
|
moveCursorLeftWithoutShift(e) {
|
|
25173
25233
|
let change = true;
|
|
@@ -25182,9 +25242,9 @@
|
|
|
25182
25242
|
return change;
|
|
25183
25243
|
}
|
|
25184
25244
|
|
|
25185
|
-
/**
|
|
25186
|
-
* Moves cursor left while keeping selection
|
|
25187
|
-
* @param {KeyboardEvent} e
|
|
25245
|
+
/**
|
|
25246
|
+
* Moves cursor left while keeping selection
|
|
25247
|
+
* @param {KeyboardEvent} e
|
|
25188
25248
|
*/
|
|
25189
25249
|
moveCursorLeftWithShift(e) {
|
|
25190
25250
|
if (this._selectionDirection === RIGHT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25195,9 +25255,9 @@
|
|
|
25195
25255
|
}
|
|
25196
25256
|
}
|
|
25197
25257
|
|
|
25198
|
-
/**
|
|
25199
|
-
* Moves cursor right
|
|
25200
|
-
* @param {KeyboardEvent} e Event object
|
|
25258
|
+
/**
|
|
25259
|
+
* Moves cursor right
|
|
25260
|
+
* @param {KeyboardEvent} e Event object
|
|
25201
25261
|
*/
|
|
25202
25262
|
moveCursorRight(e) {
|
|
25203
25263
|
if (this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length) {
|
|
@@ -25206,10 +25266,10 @@
|
|
|
25206
25266
|
this._moveCursorLeftOrRight('Right', e);
|
|
25207
25267
|
}
|
|
25208
25268
|
|
|
25209
|
-
/**
|
|
25210
|
-
* Moves cursor right or Left, fires event
|
|
25211
|
-
* @param {String} direction 'Left', 'Right'
|
|
25212
|
-
* @param {KeyboardEvent} e Event object
|
|
25269
|
+
/**
|
|
25270
|
+
* Moves cursor right or Left, fires event
|
|
25271
|
+
* @param {String} direction 'Left', 'Right'
|
|
25272
|
+
* @param {KeyboardEvent} e Event object
|
|
25213
25273
|
*/
|
|
25214
25274
|
_moveCursorLeftOrRight(direction, e) {
|
|
25215
25275
|
const actionName = `moveCursor${direction}${e.shiftKey ? 'WithShift' : 'WithoutShift'}`;
|
|
@@ -25224,9 +25284,9 @@
|
|
|
25224
25284
|
}
|
|
25225
25285
|
}
|
|
25226
25286
|
|
|
25227
|
-
/**
|
|
25228
|
-
* Moves cursor right while keeping selection
|
|
25229
|
-
* @param {KeyboardEvent} e
|
|
25287
|
+
/**
|
|
25288
|
+
* Moves cursor right while keeping selection
|
|
25289
|
+
* @param {KeyboardEvent} e
|
|
25230
25290
|
*/
|
|
25231
25291
|
moveCursorRightWithShift(e) {
|
|
25232
25292
|
if (this._selectionDirection === LEFT && this.selectionStart !== this.selectionEnd) {
|
|
@@ -25237,9 +25297,9 @@
|
|
|
25237
25297
|
}
|
|
25238
25298
|
}
|
|
25239
25299
|
|
|
25240
|
-
/**
|
|
25241
|
-
* Moves cursor right without keeping selection
|
|
25242
|
-
* @param {KeyboardEvent} e Event object
|
|
25300
|
+
/**
|
|
25301
|
+
* Moves cursor right without keeping selection
|
|
25302
|
+
* @param {KeyboardEvent} e Event object
|
|
25243
25303
|
*/
|
|
25244
25304
|
moveCursorRightWithoutShift(e) {
|
|
25245
25305
|
let changed = true;
|