@leapfrog/interactive-canvas 1.5.3 → 1.6.0
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.
|
@@ -1713,6 +1713,27 @@ var Text = /** @class */ (function (_super) {
|
|
|
1713
1713
|
this.data.userText = this.fabricObject.text;
|
|
1714
1714
|
this.text$.next(this.fabricObject.text);
|
|
1715
1715
|
};
|
|
1716
|
+
/**
|
|
1717
|
+
* @override
|
|
1718
|
+
* @inheritDoc
|
|
1719
|
+
*/
|
|
1720
|
+
Text.prototype.insertText = function (text, style, start, end) {
|
|
1721
|
+
this.fabricObject.insertChars(text, style, start, end);
|
|
1722
|
+
var newCursorLocation = start + text.length;
|
|
1723
|
+
this.fabricObject.selectionStart = newCursorLocation;
|
|
1724
|
+
this.fabricObject.selectionEnd = newCursorLocation;
|
|
1725
|
+
this.redraw();
|
|
1726
|
+
this.data.userText = this.fabricObject.text;
|
|
1727
|
+
this.text$.next(this.fabricObject.text);
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* @override
|
|
1731
|
+
* @inheritDoc
|
|
1732
|
+
*/
|
|
1733
|
+
Text.prototype.insertTextAtSelection = function (text, style) {
|
|
1734
|
+
var selection = this.getTextSelection();
|
|
1735
|
+
this.insertText(text, style, selection.start, selection.end);
|
|
1736
|
+
};
|
|
1716
1737
|
/**
|
|
1717
1738
|
* @override
|
|
1718
1739
|
* @inheritDoc
|
|
@@ -1715,6 +1715,27 @@ var Text = /** @class */ (function (_super) {
|
|
|
1715
1715
|
this.data.userText = this.fabricObject.text;
|
|
1716
1716
|
this.text$.next(this.fabricObject.text);
|
|
1717
1717
|
};
|
|
1718
|
+
/**
|
|
1719
|
+
* @override
|
|
1720
|
+
* @inheritDoc
|
|
1721
|
+
*/
|
|
1722
|
+
Text.prototype.insertText = function (text, style, start, end) {
|
|
1723
|
+
this.fabricObject.insertChars(text, style, start, end);
|
|
1724
|
+
var newCursorLocation = start + text.length;
|
|
1725
|
+
this.fabricObject.selectionStart = newCursorLocation;
|
|
1726
|
+
this.fabricObject.selectionEnd = newCursorLocation;
|
|
1727
|
+
this.redraw();
|
|
1728
|
+
this.data.userText = this.fabricObject.text;
|
|
1729
|
+
this.text$.next(this.fabricObject.text);
|
|
1730
|
+
};
|
|
1731
|
+
/**
|
|
1732
|
+
* @override
|
|
1733
|
+
* @inheritDoc
|
|
1734
|
+
*/
|
|
1735
|
+
Text.prototype.insertTextAtSelection = function (text, style) {
|
|
1736
|
+
var selection = this.getTextSelection();
|
|
1737
|
+
this.insertText(text, style, selection.start, selection.end);
|
|
1738
|
+
};
|
|
1718
1739
|
/**
|
|
1719
1740
|
* @override
|
|
1720
1741
|
* @inheritDoc
|
|
@@ -24,6 +24,26 @@ export interface IMutableText extends ICanvasObject {
|
|
|
24
24
|
* @param replacement Replacement fragment.
|
|
25
25
|
*/
|
|
26
26
|
replaceText(target: string, replacement: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Taken from the fabric JSDOC:
|
|
29
|
+
* Insert characters at start position, before start position.
|
|
30
|
+
* start equal 1 it means the text get inserted between actual grapheme 0 and 1
|
|
31
|
+
* if style array is provided, it must be as the same length of text in graphemes
|
|
32
|
+
* if end is provided and is bigger than start, old text is replaced.
|
|
33
|
+
* start/end ar per grapheme position in _text array.
|
|
34
|
+
*
|
|
35
|
+
* @param text text to insert
|
|
36
|
+
* @param style array of style objects
|
|
37
|
+
* @param start
|
|
38
|
+
* @param end default to start + 1
|
|
39
|
+
*/
|
|
40
|
+
insertText(text: string, style?: any[], start?: number, end?: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* {@link #insertText} but at the current cursor location.
|
|
43
|
+
* @param text
|
|
44
|
+
* @param style
|
|
45
|
+
*/
|
|
46
|
+
insertTextAtSelection(text: string, style?: any[]): void;
|
|
27
47
|
/**
|
|
28
48
|
* Is the text bulleted?
|
|
29
49
|
*/
|
|
@@ -71,6 +71,16 @@ export declare class Text extends AbstractCanvasObject<fabric.Textbox> implement
|
|
|
71
71
|
* @inheritDoc
|
|
72
72
|
*/
|
|
73
73
|
replaceText(target: string, replacement: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* @override
|
|
76
|
+
* @inheritDoc
|
|
77
|
+
*/
|
|
78
|
+
insertText(text: string, style?: any[], start?: number, end?: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* @override
|
|
81
|
+
* @inheritDoc
|
|
82
|
+
*/
|
|
83
|
+
insertTextAtSelection(text: string, style?: any[]): void;
|
|
74
84
|
/**
|
|
75
85
|
* @override
|
|
76
86
|
* @inheritDoc
|