@tiptap/extension-history 2.3.2 → 2.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5,6 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var core = require('@tiptap/core');
6
6
  var history = require('@tiptap/pm/history');
7
7
 
8
+ /**
9
+ * This extension allows you to undo and redo recent changes.
10
+ * @see https://www.tiptap.dev/api/extensions/history
11
+ *
12
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
13
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
14
+ *
15
+ * `@tiptap/extension-collaboration` uses its own history implementation.
16
+ */
8
17
  const History = core.Extension.create({
9
18
  name: 'history',
10
19
  addOptions() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;YACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;SACF,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAAC,eAAO,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,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;YAG1C,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;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface HistoryOptions {\n /**\n * The amount of history events that are collected before the oldest events are discarded.\n * @default 100\n * @example 50\n */\n depth: number,\n\n /**\n * The delay (in milliseconds) between changes after which a new group should be started.\n * @default 500\n * @example 1000\n */\n newGroupDelay: number,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n * @example editor.commands.undo()\n */\n undo: () => ReturnType,\n /**\n * Reapply reverted changes\n * @example editor.commands.redo()\n */\n redo: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to undo and redo recent changes.\n * @see https://www.tiptap.dev/api/extensions/history\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `history` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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":";;;;;;;AAoCA;;;;;;;;AAQG;AACU,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,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;YACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;SACF,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAAC,eAAO,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,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;YAG1C,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;;;;;"}
package/dist/index.js CHANGED
@@ -1,6 +1,15 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import { undo, redo, history } from '@tiptap/pm/history';
3
3
 
4
+ /**
5
+ * This extension allows you to undo and redo recent changes.
6
+ * @see https://www.tiptap.dev/api/extensions/history
7
+ *
8
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
9
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
10
+ *
11
+ * `@tiptap/extension-collaboration` uses its own history implementation.
12
+ */
4
13
  const History = Extension.create({
5
14
  name: 'history',
6
15
  addOptions() {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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":[],"mappings":";;;AAuBa,MAAA,OAAO,GAAG,SAAS,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,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;YACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;SACF,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAA,OAAO,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,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;YAG1C,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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface HistoryOptions {\n /**\n * The amount of history events that are collected before the oldest events are discarded.\n * @default 100\n * @example 50\n */\n depth: number,\n\n /**\n * The delay (in milliseconds) between changes after which a new group should be started.\n * @default 500\n * @example 1000\n */\n newGroupDelay: number,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n * @example editor.commands.undo()\n */\n undo: () => ReturnType,\n /**\n * Reapply reverted changes\n * @example editor.commands.redo()\n */\n redo: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to undo and redo recent changes.\n * @see https://www.tiptap.dev/api/extensions/history\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `history` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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":[],"mappings":";;;AAoCA;;;;;;;;AAQG;AACU,MAAA,OAAO,GAAG,SAAS,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,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;YACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;AAClC,gBAAA,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aAC7B;SACF,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAA,OAAO,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,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;YAG1C,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;;;;"}
package/dist/index.umd.js CHANGED
@@ -4,6 +4,15 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-history"] = {}, global.core, global.history));
5
5
  })(this, (function (exports, core, history) { 'use strict';
6
6
 
7
+ /**
8
+ * This extension allows you to undo and redo recent changes.
9
+ * @see https://www.tiptap.dev/api/extensions/history
10
+ *
11
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
12
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
13
+ *
14
+ * `@tiptap/extension-collaboration` uses its own history implementation.
15
+ */
7
16
  const History = core.Extension.create({
8
17
  name: 'history',
9
18
  addOptions() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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,QAAA,OAAO,GAAGA,cAAS,CAAC,MAAM,CAAiB;EACtD,IAAA,IAAI,EAAE,SAAS;MAEf,UAAU,GAAA;UACR,OAAO;EACL,YAAA,KAAK,EAAE,GAAG;EACV,YAAA,aAAa,EAAE,GAAG;WACnB,CAAA;OACF;MAED,WAAW,GAAA;UACT,OAAO;cACL,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;EAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;eAC7B;cACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;EAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;eAC7B;WACF,CAAA;OACF;MAED,qBAAqB,GAAA;UACnB,OAAO;EACL,YAAAC,eAAO,CAAC,IAAI,CAAC,OAAO,CAAC;WACtB,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;cAG1C,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;WACjD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface HistoryOptions {\n /**\n * The amount of history events that are collected before the oldest events are discarded.\n * @default 100\n * @example 50\n */\n depth: number,\n\n /**\n * The delay (in milliseconds) between changes after which a new group should be started.\n * @default 500\n * @example 1000\n */\n newGroupDelay: number,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n * @example editor.commands.undo()\n */\n undo: () => ReturnType,\n /**\n * Reapply reverted changes\n * @example editor.commands.redo()\n */\n redo: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to undo and redo recent changes.\n * @see https://www.tiptap.dev/api/extensions/history\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `history` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\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 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => 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":";;;;;;EAoCA;;;;;;;;EAQG;AACU,QAAA,OAAO,GAAGA,cAAS,CAAC,MAAM,CAAiB;EACtD,IAAA,IAAI,EAAE,SAAS;MAEf,UAAU,GAAA;UACR,OAAO;EACL,YAAA,KAAK,EAAE,GAAG;EACV,YAAA,aAAa,EAAE,GAAG;WACnB,CAAA;OACF;MAED,WAAW,GAAA;UACT,OAAO;cACL,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;EAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;eAC7B;cACD,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;EAClC,gBAAA,OAAOC,YAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;eAC7B;WACF,CAAA;OACF;MAED,qBAAqB,GAAA;UACnB,OAAO;EACL,YAAAC,eAAO,CAAC,IAAI,CAAC,OAAO,CAAC;WACtB,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAChD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;;cAG1C,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;cAC1C,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;WACjD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
@@ -1,6 +1,16 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  export interface HistoryOptions {
3
+ /**
4
+ * The amount of history events that are collected before the oldest events are discarded.
5
+ * @default 100
6
+ * @example 50
7
+ */
3
8
  depth: number;
9
+ /**
10
+ * The delay (in milliseconds) between changes after which a new group should be started.
11
+ * @default 500
12
+ * @example 1000
13
+ */
4
14
  newGroupDelay: number;
5
15
  }
6
16
  declare module '@tiptap/core' {
@@ -8,13 +18,24 @@ declare module '@tiptap/core' {
8
18
  history: {
9
19
  /**
10
20
  * Undo recent changes
21
+ * @example editor.commands.undo()
11
22
  */
12
23
  undo: () => ReturnType;
13
24
  /**
14
25
  * Reapply reverted changes
26
+ * @example editor.commands.redo()
15
27
  */
16
28
  redo: () => ReturnType;
17
29
  };
18
30
  }
19
31
  }
32
+ /**
33
+ * This extension allows you to undo and redo recent changes.
34
+ * @see https://www.tiptap.dev/api/extensions/history
35
+ *
36
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
37
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
38
+ *
39
+ * `@tiptap/extension-collaboration` uses its own history implementation.
40
+ */
20
41
  export declare const History: Extension<HistoryOptions, any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-history",
3
3
  "description": "history extension for tiptap",
4
- "version": "2.3.2",
4
+ "version": "2.5.0-beta.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -29,8 +29,8 @@
29
29
  "dist"
30
30
  ],
31
31
  "devDependencies": {
32
- "@tiptap/core": "^2.3.2",
33
- "@tiptap/pm": "^2.3.2"
32
+ "@tiptap/core": "^2.5.0-beta.0",
33
+ "@tiptap/pm": "^2.5.0-beta.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@tiptap/core": "^2.0.0",
package/src/history.ts CHANGED
@@ -2,7 +2,18 @@ import { Extension } from '@tiptap/core'
2
2
  import { history, redo, undo } from '@tiptap/pm/history'
3
3
 
4
4
  export interface HistoryOptions {
5
+ /**
6
+ * The amount of history events that are collected before the oldest events are discarded.
7
+ * @default 100
8
+ * @example 50
9
+ */
5
10
  depth: number,
11
+
12
+ /**
13
+ * The delay (in milliseconds) between changes after which a new group should be started.
14
+ * @default 500
15
+ * @example 1000
16
+ */
6
17
  newGroupDelay: number,
7
18
  }
8
19
 
@@ -11,16 +22,27 @@ declare module '@tiptap/core' {
11
22
  history: {
12
23
  /**
13
24
  * Undo recent changes
25
+ * @example editor.commands.undo()
14
26
  */
15
27
  undo: () => ReturnType,
16
28
  /**
17
29
  * Reapply reverted changes
30
+ * @example editor.commands.redo()
18
31
  */
19
32
  redo: () => ReturnType,
20
33
  }
21
34
  }
22
35
  }
23
36
 
37
+ /**
38
+ * This extension allows you to undo and redo recent changes.
39
+ * @see https://www.tiptap.dev/api/extensions/history
40
+ *
41
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
42
+ * the `history` extension, as it is not compatible with the `collaboration` extension.
43
+ *
44
+ * `@tiptap/extension-collaboration` uses its own history implementation.
45
+ */
24
46
  export const History = Extension.create<HistoryOptions>({
25
47
  name: 'history',
26
48