TinyMCE functions outside of editor?

I am using TinyMCE as an editor on a webpage. I would like to know if using a menu command from another application/script is possible. I usually go to the editor and use the menus to get to Format > Clear Formatting. I want to use this from a different part of a webpage to loop through many pages. From there, I will clear the formatting on all. Is this possible? I do not see any clear example of doing so on their website documentation. Could someone point me in the right direction if they know? Thanks

Hi,

With tinymce V6:

tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('body'), '');

https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.dom.domutils/#setHTML

Hey, thanks for the reply. I have been looking at upgrading to V6. I am doing it soon. I did some more research and see that all the commands are here. I did not find them without digging. They also seem to be for version 6. I am using version 5, and they seem to all work. I have tested them in my init function. I am curious how I can use them in other scripts. I will begin testing and report back. Thanks so much!

Yes, we often have to dig a bit to find things in the documentation. I’m converting a plugin from the V5 to V6 and the latest API seems so far less confusing than the previous. Thanks to you & good luck with your project.

Hi, how is your project going, I hope well? I am using the constructs that we discussed with no problems. I am impressed with what can be accomplished. Do you have any information on making a text selection? Maybe I should ask, do you know how to do this? I mean for a specific word. I would then want to loop and select all similar words. From there, I would perform TinyMCE functions on the words. Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.