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.
1 line
2.3 KiB
1 line
2.3 KiB
{"version":3,"file":"tiptap-extension-history.cjs","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from 'prosemirror-history'\n\nexport interface HistoryOptions {\n depth: number,\n newGroupDelay: number,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n */\n undo: () => ReturnType,\n /**\n * Reapply reverted changes\n */\n redo: () => ReturnType,\n }\n }\n}\n\nexport const History = Extension.create<HistoryOptions>({\n name: 'history',\n\n addOptions() {\n return {\n depth: 100,\n newGroupDelay: 500,\n }\n },\n\n addCommands() {\n return {\n undo: () => ({ state, dispatch }) => {\n return undo(state, dispatch)\n },\n redo: () => ({ state, dispatch }) => {\n return redo(state, dispatch)\n },\n }\n },\n\n addProseMirrorPlugins() {\n return [\n history(this.options),\n ]\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-z': () => this.editor.commands.undo(),\n 'Mod-y': () => this.editor.commands.redo(),\n 'Shift-Mod-z': () => this.editor.commands.redo(),\n\n // Russian keyboard layouts\n 'Mod-я': () => this.editor.commands.undo(),\n 'Shift-Mod-я': () => this.editor.commands.redo(),\n }\n },\n})\n"],"names":["Extension","undo","redo","history"],"mappings":";;;;;;;AAuBa,MAAA,OAAO,GAAGA,cAAS,CAAC,MAAM,CAAiB;AACtD,IAAA,IAAI,EAAE,SAAS;IAEf,UAAU,GAAA;QACR,OAAO;AACL,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,aAAa,EAAE,GAAG;SACnB,CAAA;KACF;IAED,WAAW,GAAA;QACT,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAOC,uBAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;YACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAOC,uBAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;SACF,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAAC,0BAAO,CAAC,IAAI,CAAC,OAAO,CAAC;SACtB,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAC1C,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;YAGhD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;SACjD,CAAA;KACF;AACF,CAAA;;;;;"} |