el-text-editor 0.0.71 → 0.0.73
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 +29 -21
- package/fesm2015/el-text-editor.mjs +28 -20
- package/fesm2015/el-text-editor.mjs.map +1 -1
- package/fesm2020/el-text-editor.mjs +28 -20
- package/fesm2020/el-text-editor.mjs.map +1 -1
- package/lib/el-text-editor.component.d.ts +1 -1
- package/package.json +1 -1
@@ -648,16 +648,16 @@ class ElTextEditorComponent {
|
|
648
648
|
}
|
649
649
|
}
|
650
650
|
// // Move caret to the end of the editor content
|
651
|
-
moveCaretToEnd(editor) {
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
}
|
651
|
+
// private moveCaretToEnd(editor: HTMLElement) {
|
652
|
+
// const selection = window.getSelection();
|
653
|
+
// const range = document.createRange();
|
654
|
+
// if (editor.lastChild) {
|
655
|
+
// range.selectNodeContents(editor);
|
656
|
+
// range.collapse(false); // Collapse to the end
|
657
|
+
// selection?.removeAllRanges();
|
658
|
+
// selection?.addRange(range);
|
659
|
+
// }
|
660
|
+
// }
|
661
661
|
init_Func(html) {
|
662
662
|
if (html) {
|
663
663
|
let editor = document.getElementById('editor');
|
@@ -697,16 +697,24 @@ class ElTextEditorComponent {
|
|
697
697
|
});
|
698
698
|
observer.observe(editor, { childList: true, subtree: true, characterData: true });
|
699
699
|
}
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
700
|
+
moveCaretToEnd(editor) {
|
701
|
+
// const selection = window.getSelection();
|
702
|
+
// const range = document.createRange();
|
703
|
+
// if (editor.lastChild) {
|
704
|
+
// range.selectNodeContents(editor);
|
705
|
+
// range.collapse(false); // Collapse to the end
|
706
|
+
// selection?.removeAllRanges();
|
707
|
+
// selection?.addRange(range);
|
708
|
+
// }
|
709
|
+
const selection = window.getSelection();
|
710
|
+
if (selection === null || selection === void 0 ? void 0 : selection.rangeCount) {
|
711
|
+
const range = selection.getRangeAt(0);
|
712
|
+
if (editor.contains(range.commonAncestorContainer)) {
|
713
|
+
return range.cloneRange(); // Return the current caret range
|
714
|
+
}
|
715
|
+
}
|
716
|
+
return null;
|
717
|
+
}
|
710
718
|
// init_Func(html: any) {
|
711
719
|
// if (html) {
|
712
720
|
// let editor = document.getElementById('editor');
|