0
votes

How can i insertContent in the tinymce active editor without triggering the focus on editor ?

UseCase : When i execute insertContent on editor and the editor is outside of the view port It inserts the content and scrolls the editor into view - But i don't want the editor to be focused or scroll into view.

As per the docs, you can actually pass additional arguments to insertContent command setting skip_focus to true...but it doesn't seems to be working...

activeEditor?.insertContent(htmlContent as string, {skip_focus: true});

I have tried execCommand to insert content passing skip_focus to true as well...this time it didn't insert the content...

activeEditor.editorCommands.execCommand('mceInsertContent', false, htmlContent, {skip_focus: true});

Tinymce version : "tinymce": "^5.5.1", "@tinymce/tinymce-react": "^3.7.0"

1

1 Answers

0
votes

One way to accomplish this

activeEditor?.setContent(activeEditor.getContent() + htmlContent);

but looking for a better approach.