Home › Forums › ACF PRO › Manipulating WYSIWYG / TinyMCE Content via AJAX for acf_form › Reply To: Manipulating WYSIWYG / TinyMCE Content via AJAX for acf_form
It has been a long time since I’ve done this, but yes, I know that it’s possible, but you need to target the tinyMCE object of the specific field.
I made a modification to another plugin once that was not working with multiple editors and I added this loop to the plugin. The plugin as Sortcodes Ultimate and I added this loop so that it could find the correct editor.
for (i=0; i<tinyMCE.editors.length; i++) {
if (window.su_generator_target == tinyMCE.editors[i].id) {
$editor = tinyMCE.editors[i];
}
}
mce_selection = $editor.selection.getContent();
But that’s the only reference I can find, it was over 2 years ago that I looked at this. Bottom line is that it is possible to manipulate the content of the editor using JS, I just don’t know if you’ll find much help doing it and I don’t know if this information will help you or not.
You may also want to look at the ACF JS API https://www.advancedcustomfields.com/resources/javascript-api/ that has methods to get and set field values. The developer has done quite a bit of work on this and updating fields using the ACF method generally works, but I have not tried it with wysiwyg fields.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.