How do I use isolateHistory?

Hi :slight_smile:

Here’s my problem:
In my use case, the editor receives some changes from an external source. Those changes should not be mixed with the ones performed by the user.

For example, if the editor is blank and my code inserts “Hello world”, the user should not be able to revert to blank with Ctrl+z.

I figured out isolateHistory may be the answer, however, I can’t get it to work.

Here’s my code:

cm.dispatch({
 annotations: [new Annotation("myannotation", true), isolateHistory.of("full")],
 changes: { from: 0, to: 0, insert: "hello world" },
})

What am I missing?

What you want is Transaction.addToHistory.of(false).

(Also new Annotation("myannotation", true) is definitely a type error.)

Thanks :slight_smile:
Now it works perfectly!