Set selection in Google Docs from Chrome extension?

Would it be possible, from a Chrome extension, to select some text in a Google Docs document.
Specifically, I have the position of the caret, and want to select from a number of characters before that, to a number of characters after.

Update Google Docs content from Chrome Extension

I want to integrate my Chrome extension with Google Docs, as to make it able to replace text. If I just replace text by working with DOM, it has no effect. This could be helpful in many situations. One such use case is the autocorrect extension. My understanding is that Google Docs code is written in ClosureScript or something like this.

Finding text inside the editor is not too complicated. It is marked with kix classes such as kix-appview-editor and similar.
How could I trigger an update from inside the JavaScript extension script? I don’t want to use Google App Script. I know that what I need is possible, because I found an extension changing text inside GDocs from JavaScript. The extension is called Blaze Text and it has no problem working with Google Docs. Unfortunately, the code is obfuscated so determining how they do this is not easy.

I found a trick that does this for React 15 and later. I am using it to for React.JS compatibility. How could I “force an update” on Google Docs?