0

I am building a chrome extension where I want to update content in an existing TinyMCE instance on the page.

I can make it work if I manipulate DOM before scripts ("run_at": "document_end").

However I need to update the content based on user selection.

Any suggestions on which strategy I should investigate?

Michael Fromin
  • 13,131
  • 2
  • 20
  • 31
  • It's not clear what exactly doesn't work, but if you want to put some text into the editor you can focus its DOM element and use document.execCommand with 'insertText' parameter. And if you want to invoke TinyMCE's methods directly you'll have to [put that part of code into the page context](https://stackoverflow.com/a/9517879). – wOxxOm Dec 06 '18 at 13:29
  • I think i have to invoke TinyMCE methods. I need to update a text/html in an editer. injecting the code looks smart, if i inject code, will it run on page? or how can i invoke it? – Nikolai Bendix Dec 07 '18 at 11:46
  • yes, i am on it. think i have a solution! fantastic - thank you. – Nikolai Bendix Dec 07 '18 at 12:11

0 Answers0