CodeMirror 6 cm.clearHistory() equivalent

Hello! What is the cm.clearHistory() equivalent in CM6? Couldn’t find any info in the docs and in the sources.

Thanks in advance.

There is no such thing, directly. If you’re loading a new document, the recommendation is to create a fresh EditorState, which will start with an empty history. If you have another use case, I’m curious to hear it.

Everything is clear, thank you.

as Excel has a lot of cells - every one of them has its own functions.
When a user selects one of them - we can change the value and use one set for everyone.
In this case, when we can not clear the history - it is not possible - need every time to run a new code mirror.

No, just a new editor state, which, if I understand what you’re doing correctly, would be a reasonable thing to create anyway.

yes. you are right.
the first time i tired to do -

const insert = 'new text from props'
const cm = codeMirror.current;
   changes: {from: 0, to: cm.state.doc.length, insert},

and now i am using this ( but need also verify changes inside function - dependency in memo) -

      extensions: [
        placeholder('Type formula here...'),
        EditorView.clickAddsSelectionRange.of(() => false),
        EditorView.updateListener.of((mirror: ViewUpdate) => {
          widgetHighlighting(mirror, widgetsTitle, activePage.title);
          console.log(preservedValue, mirror.state.doc.toString());
          setDataStatus(preservedValue !== mirror.state.doc.toString());
          override: [widgetAutocomplete, myFunction],
          maxRenderedOptions: 8,
          defaultKeymap: true,

but previously i liked idea to changing state settings in this way ( as in your documentation is ) -

      effects: keyAction.reconfigure(dummyKeymap(isCodeEditorOpen)),

i don`t say - that it is bad or something else - it works fast and i am happy to use it.
but i thought that should use an easier way of updating the state.
but if you told me that it is okay - i am using it.