I’m a codemirror newbie.
I want to save history filed when change the content.
see the image.
tab1 content is “tab1”.
tab2 content is “tab2”.
when i change tab1 to tab2,the tab1 history filed should be saved,
becase next time when i change tab2 to tab1,it should undo tab1 history filed.
change content like this:
view.dispatch({
changes: { from: 0, to: view.state.doc.length, insert: text },
selection: { anchor: text.length },
annotations: Transaction.addToHistory.of(false),
})
The page only have one view instance.
i tried view.setState when setContent.but it doesn’t work.
what should i write the code?
thanks you very mush!