mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
03fe74710c
* fix: Undo/redo events duplicated * fix: Guard history use Prevent cross polination of editors * Remove unused check
30 lines
701 B
TypeScript
30 lines
701 B
TypeScript
import { history, undo, redo } from "prosemirror-history";
|
|
import type { Command } from "prosemirror-state";
|
|
import type { CommandFactory } from "../lib/Extension";
|
|
import Extension from "../lib/Extension";
|
|
|
|
export default class History extends Extension {
|
|
get name() {
|
|
return "history";
|
|
}
|
|
|
|
commands(): Record<string, CommandFactory> {
|
|
return {
|
|
undo: () => undo,
|
|
redo: () => redo,
|
|
};
|
|
}
|
|
|
|
keys(): Record<string, Command | CommandFactory> {
|
|
return {
|
|
"Mod-z": () => this.editor.commands.undo(),
|
|
"Mod-y": () => this.editor.commands.redo(),
|
|
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
};
|
|
}
|
|
|
|
get plugins() {
|
|
return [history()];
|
|
}
|
|
}
|