Angular 15 Ckeditor 5 scroll to bottom or to current cursor position

17 Views Asked by At

I'm inserting dynamic text into ckeditor 5 and setting the cursor position, but its not scrolling into current cursor position. below is what I tried. didn't seem to work

this.noteEditor.editorInstance.setData(editorData.replace(regExMatch, res.Result.Text.trim()));
          this.noteEditor.editorInstance.model.change((writer:any) => {
            writer.setSelection(writer.createPositionAt( this.noteEditor.editorInstance.model.document.getRoot(), 'end' ));
            // this.noteEditor.editorInstance.editing.view.scrollToTheSelection({viewportOffset:300,alignToTop:false})
            // console.log(`consult-notes.component::this.noteEditor.editorInstance - `,this.noteEditor.editorInstance);
            // document.getElementById("ck-scroll").scrollIntoView();
          });

Note. I just want to scroll to bottom of the ckeditor view on dynamic content addition.

not scrolling

stackblitz link to the issue -> https://stackblitz.com/edit/stackblitz-starters-jjjltl?file=src%2Fmain.ts

0

There are 0 best solutions below