Update WYSIWYG via JavaScript API


Matrix Version:
Our website has multiple broken links in the WYSIWYG HTML content. Manually fixing all of them seems impractical.

I can see the HTML content via this call:
js_api.getGeneral({“asset_id”:“xxx_id_num”, “get_attributes”:true, “dataCallback”:e=>(console.log(e.html))});
Let’s say it returns the following html code:
‘’’< a href=“http://404page.html”> Link < /a >’’’
My question is, which JS API allows me to update the WYSIWYG HTML to fix these broken links?


H there.

Have you tried “Search and Replace” tools option in Matrix?

Regarding your question about using JS API, yes you can use it to replace the value. For that you have to get the value first, use JS replace method to change the broken links and then set the new formatted value.

Can I know whether its a content container or from a custom component?