@tiptap/extensions 3.20.3 → 3.20.4

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.
Files changed (55) hide show
  1. package/dist/character-count/index.cjs +129 -0
  2. package/dist/character-count/index.cjs.map +1 -0
  3. package/dist/character-count/index.d.cts +62 -0
  4. package/dist/character-count/index.d.ts +62 -0
  5. package/dist/character-count/index.js +102 -0
  6. package/dist/character-count/index.js.map +1 -0
  7. package/dist/drop-cursor/index.cjs +47 -0
  8. package/dist/drop-cursor/index.cjs.map +1 -0
  9. package/dist/drop-cursor/index.d.cts +31 -0
  10. package/dist/drop-cursor/index.d.ts +31 -0
  11. package/dist/drop-cursor/index.js +20 -0
  12. package/dist/drop-cursor/index.js.map +1 -0
  13. package/dist/focus/index.cjs +95 -0
  14. package/dist/focus/index.cjs.map +1 -0
  15. package/dist/focus/index.d.cts +28 -0
  16. package/dist/focus/index.d.ts +28 -0
  17. package/dist/focus/index.js +68 -0
  18. package/dist/focus/index.js.map +1 -0
  19. package/dist/gap-cursor/index.cjs +51 -0
  20. package/dist/gap-cursor/index.cjs.map +1 -0
  21. package/dist/gap-cursor/index.d.cts +25 -0
  22. package/dist/gap-cursor/index.d.ts +25 -0
  23. package/dist/gap-cursor/index.js +24 -0
  24. package/dist/gap-cursor/index.js.map +1 -0
  25. package/dist/index.cjs +437 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +284 -0
  28. package/dist/index.d.ts +284 -0
  29. package/dist/index.js +402 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/placeholder/index.cjs +99 -0
  32. package/dist/placeholder/index.cjs.map +1 -0
  33. package/dist/placeholder/index.d.cts +71 -0
  34. package/dist/placeholder/index.d.ts +71 -0
  35. package/dist/placeholder/index.js +71 -0
  36. package/dist/placeholder/index.js.map +1 -0
  37. package/dist/selection/index.cjs +63 -0
  38. package/dist/selection/index.cjs.map +1 -0
  39. package/dist/selection/index.d.cts +17 -0
  40. package/dist/selection/index.d.ts +17 -0
  41. package/dist/selection/index.js +36 -0
  42. package/dist/selection/index.js.map +1 -0
  43. package/dist/trailing-node/index.cjs +83 -0
  44. package/dist/trailing-node/index.cjs.map +1 -0
  45. package/dist/trailing-node/index.d.cts +28 -0
  46. package/dist/trailing-node/index.d.ts +28 -0
  47. package/dist/trailing-node/index.js +56 -0
  48. package/dist/trailing-node/index.js.map +1 -0
  49. package/dist/undo-redo/index.cjs +66 -0
  50. package/dist/undo-redo/index.cjs.map +1 -0
  51. package/dist/undo-redo/index.d.cts +44 -0
  52. package/dist/undo-redo/index.d.ts +44 -0
  53. package/dist/undo-redo/index.js +39 -0
  54. package/dist/undo-redo/index.js.map +1 -0
  55. package/package.json +5 -5
@@ -0,0 +1,44 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ interface UndoRedoOptions {
4
+ /**
5
+ * The amount of history events that are collected before the oldest events are discarded.
6
+ * @default 100
7
+ * @example 50
8
+ */
9
+ depth: number;
10
+ /**
11
+ * The delay (in milliseconds) between changes after which a new group should be started.
12
+ * @default 500
13
+ * @example 1000
14
+ */
15
+ newGroupDelay: number;
16
+ }
17
+ declare module '@tiptap/core' {
18
+ interface Commands<ReturnType> {
19
+ undoRedo: {
20
+ /**
21
+ * Undo recent changes
22
+ * @example editor.commands.undo()
23
+ */
24
+ undo: () => ReturnType;
25
+ /**
26
+ * Reapply reverted changes
27
+ * @example editor.commands.redo()
28
+ */
29
+ redo: () => ReturnType;
30
+ };
31
+ }
32
+ }
33
+ /**
34
+ * This extension allows you to undo and redo recent changes.
35
+ * @see https://www.tiptap.dev/api/extensions/undo-redo
36
+ *
37
+ * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
38
+ * the `undo-redo` extension, as it is not compatible with the `collaboration` extension.
39
+ *
40
+ * `@tiptap/extension-collaboration` uses its own history implementation.
41
+ */
42
+ declare const UndoRedo: Extension<UndoRedoOptions, any>;
43
+
44
+ export { UndoRedo, type UndoRedoOptions };
@@ -0,0 +1,39 @@
1
+ // src/undo-redo/undo-redo.ts
2
+ import { Extension } from "@tiptap/core";
3
+ import { history, redo, undo } from "@tiptap/pm/history";
4
+ var UndoRedo = Extension.create({
5
+ name: "undoRedo",
6
+ addOptions() {
7
+ return {
8
+ depth: 100,
9
+ newGroupDelay: 500
10
+ };
11
+ },
12
+ addCommands() {
13
+ return {
14
+ undo: () => ({ state, dispatch }) => {
15
+ return undo(state, dispatch);
16
+ },
17
+ redo: () => ({ state, dispatch }) => {
18
+ return redo(state, dispatch);
19
+ }
20
+ };
21
+ },
22
+ addProseMirrorPlugins() {
23
+ return [history(this.options)];
24
+ },
25
+ addKeyboardShortcuts() {
26
+ return {
27
+ "Mod-z": () => this.editor.commands.undo(),
28
+ "Shift-Mod-z": () => this.editor.commands.redo(),
29
+ "Mod-y": () => this.editor.commands.redo(),
30
+ // Russian keyboard layouts
31
+ "Mod-\u044F": () => this.editor.commands.undo(),
32
+ "Shift-Mod-\u044F": () => this.editor.commands.redo()
33
+ };
34
+ }
35
+ });
36
+ export {
37
+ UndoRedo
38
+ };
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/undo-redo/undo-redo.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface UndoRedoOptions {\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 undoRedo: {\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/undo-redo\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `undo-redo` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\n */\nexport const UndoRedo = Extension.create<UndoRedoOptions>({\n name: 'undoRedo',\n\n addOptions() {\n return {\n depth: 100,\n newGroupDelay: 500,\n }\n },\n\n addCommands() {\n return {\n undo:\n () =>\n ({ state, dispatch }) => {\n return undo(state, dispatch)\n },\n redo:\n () =>\n ({ state, dispatch }) => {\n return redo(state, dispatch)\n },\n }\n },\n\n addProseMirrorPlugins() {\n return [history(this.options)]\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"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,MAAM,YAAY;AA4C7B,IAAM,WAAW,UAAU,OAAwB;AAAA,EACxD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO;AAAA,MACP,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,MACE,MACA,CAAC,EAAE,OAAO,SAAS,MAAM;AACvB,eAAO,KAAK,OAAO,QAAQ;AAAA,MAC7B;AAAA,MACF,MACE,MACA,CAAC,EAAE,OAAO,SAAS,MAAM;AACvB,eAAO,KAAK,OAAO,QAAQ;AAAA,MAC7B;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAAA,EAC/B;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,SAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MACzC,eAAe,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MAC/C,SAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA;AAAA,MAGzC,cAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MACzC,oBAAe,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,IACjD;AAAA,EACF;AACF,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extensions",
3
3
  "description": "various extensions for tiptap",
4
- "version": "3.20.3",
4
+ "version": "3.20.4",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -95,12 +95,12 @@
95
95
  "dist"
96
96
  ],
97
97
  "devDependencies": {
98
- "@tiptap/core": "^3.20.3",
99
- "@tiptap/pm": "^3.20.3"
98
+ "@tiptap/core": "^3.20.4",
99
+ "@tiptap/pm": "^3.20.4"
100
100
  },
101
101
  "peerDependencies": {
102
- "@tiptap/core": "^3.20.3",
103
- "@tiptap/pm": "^3.20.3"
102
+ "@tiptap/core": "^3.20.4",
103
+ "@tiptap/pm": "^3.20.4"
104
104
  },
105
105
  "repository": {
106
106
  "type": "git",