I'm creating a chrome extension that can replace text snippets in a contenteditable div from a content script.
This for example works fine:
var elem = document.activeElement.innerHTML;
elem = elem.replace("foo", "bar");
document.activeElement.innerHTML = elem;
But when a website uses React, it still replaces the text but only temporarily. As soon as you type another character it jumps back to the original content. My guess is that this happens because the text is stored as a prop of a React component instead. Because when I change the text with the React chrome extension, it does keep the new value.
So I need to change the property of a React component from my content script, is this possible? If yes, how?