我相信editor.clearHistory();在CodeMirror 5工作,但是CodeMirror 6呢?
发布于 2022-06-25 16:40:45
interface HistoryConfig {
/**
The minimum depth (amount of events) to store. Defaults to 100.
*/
minDepth?: number;
/**
The maximum time (in milliseconds) that adjacent events can be
apart and still be grouped together. Defaults to 500.
*/
newGroupDelay?: number;
}
/**
Create a history extension with the given configuration.
*/
declare function history(config?: HistoryConfig): Extension;import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { history } from '@codemirror/commands';
const state = EditorState.create({
doc: 'my source code',
extensions: [history({ minDepth: 10 })],
});
const view = new EditorView({
parent: document.querySelector('#editor'),
state,
});https://stackoverflow.com/questions/72754532
复制相似问题