You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

import { Extension } from '@tiptap/core';
import { undo, redo, history } from 'prosemirror-history';
const History = Extension.create({
name: 'history',
addOptions() {
return {
depth: 100,
newGroupDelay: 500,
};
},
addCommands() {
return {
undo: () => ({ state, dispatch }) => {
return undo(state, dispatch);
},
redo: () => ({ state, dispatch }) => {
return redo(state, dispatch);
},
};
},
addProseMirrorPlugins() {
return [
history(this.options),
];
},
addKeyboardShortcuts() {
return {
'Mod-z': () => this.editor.commands.undo(),
'Mod-y': () => this.editor.commands.redo(),
'Shift-Mod-z': () => this.editor.commands.redo(),
// Russian keyboard layouts
'Mod-я': () => this.editor.commands.undo(),
'Shift-Mod-я': () => this.editor.commands.redo(),
};
},
});
export { History, History as default };
//# sourceMappingURL=tiptap-extension-history.esm.js.map