Preview a change

What is the recommended way of doing the following: given a certain “string” and a “from” and “to” positions in the document, how can I temporarily replace the text between those positions to “string” and then revert it back when I need to? The important thing that I don’t want these changes to appear in the “sendableSteps” in the “dispatchTransaction”. So what I’m looking for is a some kind of a silent transaction, or a hidden step, or something like this. Or is it easier to do just by manipulating the dom directly?

All changes generating a transaction (and thus plugins always seeing the current editor state) is a fundamental principle behind the library’s design. That being said, depending on what kind of content you want to replace, you might be able to use an inline decoration to set some inline content to display: none + a widget decoration to show the replacement text in its place.