el-text-editor 0.0.71 → 0.0.72
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 +23 -23
- package/fesm2015/el-text-editor.mjs +22 -22
- package/fesm2015/el-text-editor.mjs.map +1 -1
- package/fesm2020/el-text-editor.mjs +22 -22
- package/fesm2020/el-text-editor.mjs.map +1 -1
- package/lib/el-text-editor.component.d.ts +1 -1
- package/package.json +1 -1
| @@ -640,22 +640,22 @@ class ElTextEditorComponent { | |
| 640 640 | 
             
                        }
         | 
| 641 641 | 
             
                        let editor = document.getElementById('editor');
         | 
| 642 642 | 
             
                        if (editor) {
         | 
| 643 | 
            -
                            this. | 
| 643 | 
            +
                            this.setCaretToEnd(editor);
         | 
| 644 644 | 
             
                        }
         | 
| 645 645 | 
             
                        this.placeHolderRemove.emit();
         | 
| 646 646 | 
             
                    }
         | 
| 647 647 | 
             
                }
         | 
| 648 648 | 
             
                //   // Move caret to the end of the editor content
         | 
| 649 | 
            -
                moveCaretToEnd(editor) {
         | 
| 650 | 
            -
             | 
| 651 | 
            -
             | 
| 652 | 
            -
             | 
| 653 | 
            -
             | 
| 654 | 
            -
             | 
| 655 | 
            -
             | 
| 656 | 
            -
             | 
| 657 | 
            -
             | 
| 658 | 
            -
                }
         | 
| 649 | 
            +
                //   private moveCaretToEnd(editor: HTMLElement) {
         | 
| 650 | 
            +
                //     const selection = window.getSelection();
         | 
| 651 | 
            +
                //     const range = document.createRange();
         | 
| 652 | 
            +
                //     if (editor.lastChild) {
         | 
| 653 | 
            +
                //       range.selectNodeContents(editor);
         | 
| 654 | 
            +
                //       range.collapse(false); // Collapse to the end
         | 
| 655 | 
            +
                //       selection?.removeAllRanges();
         | 
| 656 | 
            +
                //       selection?.addRange(range);
         | 
| 657 | 
            +
                //     }
         | 
| 658 | 
            +
                //   }
         | 
| 659 659 | 
             
                init_Func(html) {
         | 
| 660 660 | 
             
                    if (html) {
         | 
| 661 661 | 
             
                        let editor = document.getElementById('editor');
         | 
| @@ -665,7 +665,7 @@ class ElTextEditorComponent { | |
| 665 665 | 
             
                            // Set up a MutationObserver to handle content changes
         | 
| 666 666 | 
             
                            this.setupMutationObserver(editor);
         | 
| 667 667 | 
             
                            // Move the caret to the end after initial content setup
         | 
| 668 | 
            -
                            this. | 
| 668 | 
            +
                            this.setCaretToEnd(editor);
         | 
| 669 669 | 
             
                            //  Track caret position on mouse click
         | 
| 670 670 | 
             
                            editor.addEventListener('click', () => {
         | 
| 671 671 | 
             
                                if (editor) { // Ensure editor is not null
         | 
| @@ -695,16 +695,16 @@ class ElTextEditorComponent { | |
| 695 695 | 
             
                    });
         | 
| 696 696 | 
             
                    observer.observe(editor, { childList: true, subtree: true, characterData: true });
         | 
| 697 697 | 
             
                }
         | 
| 698 | 
            -
                 | 
| 699 | 
            -
             | 
| 700 | 
            -
             | 
| 701 | 
            -
             | 
| 702 | 
            -
             | 
| 703 | 
            -
             | 
| 704 | 
            -
             | 
| 705 | 
            -
             | 
| 706 | 
            -
             | 
| 707 | 
            -
                 | 
| 698 | 
            +
                moveCaretToEnd(editor) {
         | 
| 699 | 
            +
                    const selection = window.getSelection();
         | 
| 700 | 
            +
                    const range = document.createRange();
         | 
| 701 | 
            +
                    if (editor.lastChild) {
         | 
| 702 | 
            +
                        range.selectNodeContents(editor);
         | 
| 703 | 
            +
                        range.collapse(false); // Collapse to the end
         | 
| 704 | 
            +
                        selection?.removeAllRanges();
         | 
| 705 | 
            +
                        selection?.addRange(range);
         | 
| 706 | 
            +
                    }
         | 
| 707 | 
            +
                }
         | 
| 708 708 | 
             
                //   init_Func(html: any) {
         | 
| 709 709 | 
             
                //   if (html) {
         | 
| 710 710 | 
             
                //     let editor = document.getElementById('editor');
         |