modern-text 1.10.3 → 1.10.4
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.
|
@@ -486,9 +486,9 @@ class TextEditor extends HTMLElement {
|
|
|
486
486
|
this._textarea.addEventListener("focus", this._onFocus.bind(this));
|
|
487
487
|
this._textarea.addEventListener("blur", this._onBlur.bind(this));
|
|
488
488
|
if (SUPPORTS_POINTER_EVENTS) {
|
|
489
|
-
this._textarea.addEventListener("pointerdown", this.
|
|
489
|
+
this._textarea.addEventListener("pointerdown", this.pointerDown.bind(this));
|
|
490
490
|
} else {
|
|
491
|
-
this._textarea.addEventListener("mousedown", this.
|
|
491
|
+
this._textarea.addEventListener("mousedown", this.pointerDown.bind(this));
|
|
492
492
|
}
|
|
493
493
|
["keyup", "mouseup", "input", "paste", "cut"].forEach((key) => {
|
|
494
494
|
this._textarea.addEventListener(key, () => {
|
|
@@ -496,7 +496,7 @@ class TextEditor extends HTMLElement {
|
|
|
496
496
|
});
|
|
497
497
|
});
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
pointerDown(e) {
|
|
500
500
|
if (e && e.button !== 0) {
|
|
501
501
|
e.preventDefault();
|
|
502
502
|
e.stopPropagation();
|
|
@@ -522,7 +522,7 @@ class TextEditor extends HTMLElement {
|
|
|
522
522
|
const index = this._findNearest({ x: offsetX, y: offsetY });
|
|
523
523
|
this.selection = [index, index];
|
|
524
524
|
this._updateDomSelection();
|
|
525
|
-
if (e &&
|
|
525
|
+
if (e && ["mousedown", "pointerdown"].includes(e.type)) {
|
|
526
526
|
const onMove = (e2) => {
|
|
527
527
|
const offsetX2 = (e2.clientX - rect.left) / scaleX;
|
|
528
528
|
const offsetY2 = (e2.clientY - rect.top) / scaleY;
|
|
@@ -552,6 +552,10 @@ class TextEditor extends HTMLElement {
|
|
|
552
552
|
this._textarea.focus();
|
|
553
553
|
return true;
|
|
554
554
|
}
|
|
555
|
+
selectAll() {
|
|
556
|
+
this._textarea.focus();
|
|
557
|
+
this._textarea.select();
|
|
558
|
+
}
|
|
555
559
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
556
560
|
this[name] = newValue;
|
|
557
561
|
}
|
|
@@ -74,7 +74,8 @@ declare class TextEditor extends HTMLElement implements PropertyAccessor {
|
|
|
74
74
|
protected _updateDomSelection(): void;
|
|
75
75
|
protected _update(): void;
|
|
76
76
|
protected _bindEventListeners(): void;
|
|
77
|
-
|
|
77
|
+
pointerDown(e?: MouseEvent | PointerEvent): boolean;
|
|
78
|
+
selectAll(): void;
|
|
78
79
|
attributeChangedCallback(name: string, _oldValue: any, newValue: any): void;
|
|
79
80
|
protected _emit(type: string, detail?: any): boolean;
|
|
80
81
|
protected _renderSelectRange(): void;
|
|
@@ -74,7 +74,8 @@ declare class TextEditor extends HTMLElement implements PropertyAccessor {
|
|
|
74
74
|
protected _updateDomSelection(): void;
|
|
75
75
|
protected _update(): void;
|
|
76
76
|
protected _bindEventListeners(): void;
|
|
77
|
-
|
|
77
|
+
pointerDown(e?: MouseEvent | PointerEvent): boolean;
|
|
78
|
+
selectAll(): void;
|
|
78
79
|
attributeChangedCallback(name: string, _oldValue: any, newValue: any): void;
|
|
79
80
|
protected _emit(type: string, detail?: any): boolean;
|
|
80
81
|
protected _renderSelectRange(): void;
|
|
@@ -74,7 +74,8 @@ declare class TextEditor extends HTMLElement implements PropertyAccessor {
|
|
|
74
74
|
protected _updateDomSelection(): void;
|
|
75
75
|
protected _update(): void;
|
|
76
76
|
protected _bindEventListeners(): void;
|
|
77
|
-
|
|
77
|
+
pointerDown(e?: MouseEvent | PointerEvent): boolean;
|
|
78
|
+
selectAll(): void;
|
|
78
79
|
attributeChangedCallback(name: string, _oldValue: any, newValue: any): void;
|
|
79
80
|
protected _emit(type: string, detail?: any): boolean;
|
|
80
81
|
protected _renderSelectRange(): void;
|
|
@@ -484,9 +484,9 @@ class TextEditor extends HTMLElement {
|
|
|
484
484
|
this._textarea.addEventListener("focus", this._onFocus.bind(this));
|
|
485
485
|
this._textarea.addEventListener("blur", this._onBlur.bind(this));
|
|
486
486
|
if (SUPPORTS_POINTER_EVENTS) {
|
|
487
|
-
this._textarea.addEventListener("pointerdown", this.
|
|
487
|
+
this._textarea.addEventListener("pointerdown", this.pointerDown.bind(this));
|
|
488
488
|
} else {
|
|
489
|
-
this._textarea.addEventListener("mousedown", this.
|
|
489
|
+
this._textarea.addEventListener("mousedown", this.pointerDown.bind(this));
|
|
490
490
|
}
|
|
491
491
|
["keyup", "mouseup", "input", "paste", "cut"].forEach((key) => {
|
|
492
492
|
this._textarea.addEventListener(key, () => {
|
|
@@ -494,7 +494,7 @@ class TextEditor extends HTMLElement {
|
|
|
494
494
|
});
|
|
495
495
|
});
|
|
496
496
|
}
|
|
497
|
-
|
|
497
|
+
pointerDown(e) {
|
|
498
498
|
if (e && e.button !== 0) {
|
|
499
499
|
e.preventDefault();
|
|
500
500
|
e.stopPropagation();
|
|
@@ -520,7 +520,7 @@ class TextEditor extends HTMLElement {
|
|
|
520
520
|
const index = this._findNearest({ x: offsetX, y: offsetY });
|
|
521
521
|
this.selection = [index, index];
|
|
522
522
|
this._updateDomSelection();
|
|
523
|
-
if (e &&
|
|
523
|
+
if (e && ["mousedown", "pointerdown"].includes(e.type)) {
|
|
524
524
|
const onMove = (e2) => {
|
|
525
525
|
const offsetX2 = (e2.clientX - rect.left) / scaleX;
|
|
526
526
|
const offsetY2 = (e2.clientY - rect.top) / scaleY;
|
|
@@ -550,6 +550,10 @@ class TextEditor extends HTMLElement {
|
|
|
550
550
|
this._textarea.focus();
|
|
551
551
|
return true;
|
|
552
552
|
}
|
|
553
|
+
selectAll() {
|
|
554
|
+
this._textarea.focus();
|
|
555
|
+
this._textarea.select();
|
|
556
|
+
}
|
|
553
557
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
554
558
|
this[name] = newValue;
|
|
555
559
|
}
|