el-text-editor 0.0.74 → 0.0.75
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/esm2020/lib/el-text-editor.component.mjs +25 -25
- package/fesm2015/el-text-editor.mjs +24 -24
- package/fesm2015/el-text-editor.mjs.map +1 -1
- package/fesm2020/el-text-editor.mjs +24 -24
- package/fesm2020/el-text-editor.mjs.map +1 -1
- package/lib/el-text-editor.component.d.ts +0 -1
- package/package.json +1 -1
@@ -91,6 +91,16 @@ class ElTextEditorComponent {
|
|
91
91
|
this.isOpen.emit(this.IsOpen);
|
92
92
|
}
|
93
93
|
};
|
94
|
+
// private setCaretToEnd(element: HTMLElement) {
|
95
|
+
// const range = document.createRange();
|
96
|
+
// const sel = window.getSelection();
|
97
|
+
// if (sel) {
|
98
|
+
// range.selectNodeContents(element);
|
99
|
+
// range.collapse(false);
|
100
|
+
// sel.removeAllRanges();
|
101
|
+
// sel.addRange(range);
|
102
|
+
// }
|
103
|
+
// }
|
94
104
|
// openColorPicker(inputId: string) {
|
95
105
|
// const inputElement = document.getElementById(inputId);
|
96
106
|
// if (inputElement) {
|
@@ -626,20 +636,20 @@ class ElTextEditorComponent {
|
|
626
636
|
const tempDiv = document.createElement('div');
|
627
637
|
tempDiv.innerHTML = newData;
|
628
638
|
// Append the new data to the fragment (supports HTML insertion)
|
629
|
-
while (tempDiv.firstChild) {
|
630
|
-
|
631
|
-
}
|
632
|
-
// Insert the fragment at the caret position
|
633
|
-
range.deleteContents(); // Remove any selected content if applicable
|
634
|
-
range.insertNode(fragment);
|
635
|
-
// Move the caret after the inserted content
|
636
|
-
const lastChild = fragment.lastChild;
|
637
|
-
if (lastChild) {
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
}
|
639
|
+
// while (tempDiv.firstChild) {
|
640
|
+
// fragment.appendChild(tempDiv.firstChild);
|
641
|
+
// }
|
642
|
+
// // Insert the fragment at the caret position
|
643
|
+
// range.deleteContents(); // Remove any selected content if applicable
|
644
|
+
// range.insertNode(fragment);
|
645
|
+
// // Move the caret after the inserted content
|
646
|
+
// const lastChild = fragment.lastChild;
|
647
|
+
// if (lastChild) {
|
648
|
+
// range.setStartAfter(lastChild);
|
649
|
+
// range.setEndAfter(lastChild);
|
650
|
+
// selection.removeAllRanges();
|
651
|
+
// selection.addRange(range);
|
652
|
+
// }
|
643
653
|
let editor = document.getElementById('editor');
|
644
654
|
if (editor) {
|
645
655
|
this.moveCaretToEnd(editor);
|
@@ -1159,16 +1169,6 @@ class ElTextEditorComponent {
|
|
1159
1169
|
}
|
1160
1170
|
}
|
1161
1171
|
}
|
1162
|
-
setCaretToEnd(element) {
|
1163
|
-
const range = document.createRange();
|
1164
|
-
const sel = window.getSelection();
|
1165
|
-
if (sel) {
|
1166
|
-
range.selectNodeContents(element);
|
1167
|
-
range.collapse(false);
|
1168
|
-
sel.removeAllRanges();
|
1169
|
-
sel.addRange(range);
|
1170
|
-
}
|
1171
|
-
}
|
1172
1172
|
openColorPicker(inputId) {
|
1173
1173
|
const inputElement = document.getElementById(inputId);
|
1174
1174
|
if (inputElement) {
|