Does anyone know how grammarly extension managed to change discord’s message input/text field content, i need some help
i am creating a chrome extension that will modify the text inside the discord’s message input/text field (means if user typed ‘hellow’, my extension will remove the word ‘hellow’ from the discord’s message box and insert a new word ‘hello’ at that place). But looks like discord is using slate.js (a rich text editor) and slate store all the user typed words in a JSON like format in somewhere react’s virtual DOM i guess, that slate internal data looks like this this: [{“type”:”paragraph”,”children”:[{“text”:”hellow”}]}],
so even if my vanilla javascript extension code try to change the DOM input field’s content using “element.textContetnt = ‘new modifed text’“, it is not going to work, because as soon as user start typing another/next word, slate.js will revert all the DOM changes to its original JSON content (means everthing revert back to ‘hellow’ word), i have no idea how can i access that JSON data or react’s virtual DOM using my extension, i tried .innerHTML, .textContetnt, appendChild, execCommand, but seems like they are limited to DOM. but grammarly is easily changing/inserting new text when i click on red underlined words on message field on discord website
how these chrome extensions managed to easily modify react’s virtual DOM, i am new to this…