@tiptap/extensions 3.30.2 → 3.30.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 (73) hide show
  1. package/dist/character-count/index.cjs +84 -128
  2. package/dist/character-count/index.cjs.map +1 -1
  3. package/dist/character-count/index.d.cts +59 -58
  4. package/dist/character-count/index.d.cts.map +1 -0
  5. package/dist/character-count/index.d.ts +59 -58
  6. package/dist/character-count/index.d.ts.map +1 -0
  7. package/dist/character-count/index.js +82 -100
  8. package/dist/character-count/index.js.map +1 -1
  9. package/dist/drop-cursor/index.cjs +24 -44
  10. package/dist/drop-cursor/index.cjs.map +1 -1
  11. package/dist/drop-cursor/index.d.cts +23 -22
  12. package/dist/drop-cursor/index.d.cts.map +1 -0
  13. package/dist/drop-cursor/index.d.ts +23 -22
  14. package/dist/drop-cursor/index.d.ts.map +1 -0
  15. package/dist/drop-cursor/index.js +22 -16
  16. package/dist/drop-cursor/index.js.map +1 -1
  17. package/dist/focus/index.cjs +45 -92
  18. package/dist/focus/index.cjs.map +1 -1
  19. package/dist/focus/index.d.cts +22 -21
  20. package/dist/focus/index.d.cts.map +1 -0
  21. package/dist/focus/index.d.ts +22 -21
  22. package/dist/focus/index.d.ts.map +1 -0
  23. package/dist/focus/index.js +42 -63
  24. package/dist/focus/index.js.map +1 -1
  25. package/dist/gap-cursor/index.cjs +26 -48
  26. package/dist/gap-cursor/index.cjs.map +1 -1
  27. package/dist/gap-cursor/index.d.cts +16 -15
  28. package/dist/gap-cursor/index.d.cts.map +1 -0
  29. package/dist/gap-cursor/index.d.ts +16 -15
  30. package/dist/gap-cursor/index.d.ts.map +1 -0
  31. package/dist/gap-cursor/index.js +25 -21
  32. package/dist/gap-cursor/index.js.map +1 -1
  33. package/dist/index.cjs +667 -742
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +231 -220
  36. package/dist/index.d.cts.map +1 -0
  37. package/dist/index.d.ts +231 -220
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +654 -703
  40. package/dist/index.js.map +1 -1
  41. package/dist/placeholder/index.cjs +344 -376
  42. package/dist/placeholder/index.cjs.map +1 -1
  43. package/dist/placeholder/index.d.cts +73 -69
  44. package/dist/placeholder/index.d.cts.map +1 -0
  45. package/dist/placeholder/index.d.ts +73 -69
  46. package/dist/placeholder/index.d.ts.map +1 -0
  47. package/dist/placeholder/index.js +340 -346
  48. package/dist/placeholder/index.js.map +1 -1
  49. package/dist/selection/index.cjs +62 -86
  50. package/dist/selection/index.cjs.map +1 -1
  51. package/dist/selection/index.d.cts +11 -10
  52. package/dist/selection/index.d.cts.map +1 -0
  53. package/dist/selection/index.d.ts +11 -10
  54. package/dist/selection/index.d.ts.map +1 -0
  55. package/dist/selection/index.js +58 -56
  56. package/dist/selection/index.js.map +1 -1
  57. package/dist/trailing-node/index.cjs +59 -89
  58. package/dist/trailing-node/index.cjs.map +1 -1
  59. package/dist/trailing-node/index.d.cts +17 -16
  60. package/dist/trailing-node/index.d.cts.map +1 -0
  61. package/dist/trailing-node/index.d.ts +17 -16
  62. package/dist/trailing-node/index.d.ts.map +1 -0
  63. package/dist/trailing-node/index.js +55 -59
  64. package/dist/trailing-node/index.js.map +1 -1
  65. package/dist/undo-redo/index.cjs +45 -63
  66. package/dist/undo-redo/index.cjs.map +1 -1
  67. package/dist/undo-redo/index.d.cts +31 -30
  68. package/dist/undo-redo/index.d.cts.map +1 -0
  69. package/dist/undo-redo/index.d.ts +31 -30
  70. package/dist/undo-redo/index.d.ts.map +1 -0
  71. package/dist/undo-redo/index.js +43 -35
  72. package/dist/undo-redo/index.js.map +1 -1
  73. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/focus/index.ts","../../src/focus/focus.ts"],"sourcesContent":["export * from './focus.js'\n","import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport interface FocusOptions {\n /**\n * The class name that should be added to the focused node.\n * @default 'has-focus'\n * @example 'is-focused'\n */\n className: string\n\n /**\n * The mode by which the focused node is determined.\n * - All: All nodes are marked as focused.\n * - Deepest: Only the deepest node is marked as focused.\n * - Shallowest: Only the shallowest node is marked as focused.\n *\n * @default 'all'\n * @example 'deepest'\n * @example 'shallowest'\n */\n mode: 'all' | 'deepest' | 'shallowest'\n}\n\n/**\n * This extension allows you to add a class to the focused node.\n * @see https://www.tiptap.dev/api/extensions/focus\n */\nexport const Focus = Extension.create<FocusOptions>({\n name: 'focus',\n\n addOptions() {\n return {\n className: 'has-focus',\n mode: 'all',\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('focus'),\n props: {\n decorations: ({ doc, selection }) => {\n const { isEditable, isFocused } = this.editor\n const { anchor } = selection\n const decorations: Decoration[] = []\n\n if (!isEditable || !isFocused) {\n return DecorationSet.create(doc, [])\n }\n\n // Maximum Levels\n let maxLevels = 0\n\n if (this.options.mode === 'deepest') {\n doc.descendants((node, pos) => {\n if (node.isText) {\n return\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n maxLevels += 1\n })\n }\n\n // Loop through current\n let currentLevel = 0\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n return false\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n currentLevel += 1\n\n const outOfScope =\n (this.options.mode === 'deepest' && maxLevels - currentLevel > 0) ||\n (this.options.mode === 'shallowest' && currentLevel > 1)\n\n if (outOfScope) {\n return this.options.mode === 'deepest'\n }\n\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className,\n }),\n )\n })\n\n return DecorationSet.create(doc, decorations)\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA0B;AAC1B,mBAAkC;AAClC,kBAA0C;AA2BnC,IAAM,QAAQ,sBAAU,OAAqB;AAAA,EAClD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,WAAW;AAAA,MACX,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,oBAAO;AAAA,QACT,KAAK,IAAI,uBAAU,OAAO;AAAA,QAC1B,OAAO;AAAA,UACL,aAAa,CAAC,EAAE,KAAK,UAAU,MAAM;AACnC,kBAAM,EAAE,YAAY,UAAU,IAAI,KAAK;AACvC,kBAAM,EAAE,OAAO,IAAI;AACnB,kBAAM,cAA4B,CAAC;AAEnC,gBAAI,CAAC,cAAc,CAAC,WAAW;AAC7B,qBAAO,0BAAc,OAAO,KAAK,CAAC,CAAC;AAAA,YACrC;AAGA,gBAAI,YAAY;AAEhB,gBAAI,KAAK,QAAQ,SAAS,WAAW;AACnC,kBAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,oBAAI,KAAK,QAAQ;AACf;AAAA,gBACF;AAEA,sBAAM,YAAY,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW;AAEnE,oBAAI,CAAC,WAAW;AACd,yBAAO;AAAA,gBACT;AAEA,6BAAa;AAAA,cACf,CAAC;AAAA,YACH;AAGA,gBAAI,eAAe;AAEnB,gBAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,kBAAI,KAAK,QAAQ;AACf,uBAAO;AAAA,cACT;AAEA,oBAAM,YAAY,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW;AAEnE,kBAAI,CAAC,WAAW;AACd,uBAAO;AAAA,cACT;AAEA,8BAAgB;AAEhB,oBAAM,aACH,KAAK,QAAQ,SAAS,aAAa,YAAY,eAAe,KAC9D,KAAK,QAAQ,SAAS,gBAAgB,eAAe;AAExD,kBAAI,YAAY;AACd,uBAAO,KAAK,QAAQ,SAAS;AAAA,cAC/B;AAEA,0BAAY;AAAA,gBACV,uBAAW,KAAK,KAAK,MAAM,KAAK,UAAU;AAAA,kBACxC,OAAO,KAAK,QAAQ;AAAA,gBACtB,CAAC;AAAA,cACH;AAAA,YACF,CAAC;AAED,mBAAO,0BAAc,OAAO,KAAK,WAAW;AAAA,UAC9C;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"file":"index.cjs","names":["Extension","Plugin","PluginKey","DecorationSet","Decoration"],"sources":["../../src/focus/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport interface FocusOptions {\n /**\n * The class name that should be added to the focused node.\n * @default 'has-focus'\n * @example 'is-focused'\n */\n className: string\n\n /**\n * The mode by which the focused node is determined.\n * - All: All nodes are marked as focused.\n * - Deepest: Only the deepest node is marked as focused.\n * - Shallowest: Only the shallowest node is marked as focused.\n *\n * @default 'all'\n * @example 'deepest'\n * @example 'shallowest'\n */\n mode: 'all' | 'deepest' | 'shallowest'\n}\n\n/**\n * This extension allows you to add a class to the focused node.\n * @see https://www.tiptap.dev/api/extensions/focus\n */\nexport const Focus = Extension.create<FocusOptions>({\n name: 'focus',\n\n addOptions() {\n return {\n className: 'has-focus',\n mode: 'all',\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('focus'),\n props: {\n decorations: ({ doc, selection }) => {\n const { isEditable, isFocused } = this.editor\n const { anchor } = selection\n const decorations: Decoration[] = []\n\n if (!isEditable || !isFocused) {\n return DecorationSet.create(doc, [])\n }\n\n // Maximum Levels\n let maxLevels = 0\n\n if (this.options.mode === 'deepest') {\n doc.descendants((node, pos) => {\n if (node.isText) {\n return\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n maxLevels += 1\n })\n }\n\n // Loop through current\n let currentLevel = 0\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n return false\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n currentLevel += 1\n\n const outOfScope =\n (this.options.mode === 'deepest' && maxLevels - currentLevel > 0) ||\n (this.options.mode === 'shallowest' && currentLevel > 1)\n\n if (outOfScope) {\n return this.options.mode === 'deepest'\n }\n\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className,\n }),\n )\n })\n\n return DecorationSet.create(doc, decorations)\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;AA6BA,MAAa,QAAQA,aAAAA,UAAU,OAAqB;CAClD,MAAM;CAEN,aAAa;EACX,OAAO;GACL,WAAW;GACX,MAAM;EACR;CACF;CAEA,wBAAwB;EACtB,OAAO,CACL,IAAIC,iBAAAA,OAAO;GACT,KAAK,IAAIC,iBAAAA,UAAU,OAAO;GAC1B,OAAO,EACL,cAAc,EAAE,KAAK,gBAAgB;IACnC,MAAM,EAAE,YAAY,cAAc,KAAK;IACvC,MAAM,EAAE,WAAW;IACnB,MAAM,cAA4B,CAAC;IAEnC,IAAI,CAAC,cAAc,CAAC,WAClB,OAAOC,gBAAAA,cAAc,OAAO,KAAK,CAAC,CAAC;IAIrC,IAAI,YAAY;IAEhB,IAAI,KAAK,QAAQ,SAAS,WACxB,IAAI,aAAa,MAAM,QAAQ;KAC7B,IAAI,KAAK,QACP;KAKF,IAAI,EAFc,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW,IAGjE,OAAO;KAGT,aAAa;IACf,CAAC;IAIH,IAAI,eAAe;IAEnB,IAAI,aAAa,MAAM,QAAQ;KAC7B,IAAI,KAAK,QACP,OAAO;KAKT,IAAI,EAFc,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW,IAGjE,OAAO;KAGT,gBAAgB;KAMhB,IAHG,KAAK,QAAQ,SAAS,aAAa,YAAY,eAAe,KAC9D,KAAK,QAAQ,SAAS,gBAAgB,eAAe,GAGtD,OAAO,KAAK,QAAQ,SAAS;KAG/B,YAAY,KACVC,gBAAAA,WAAW,KAAK,KAAK,MAAM,KAAK,UAAU,EACxC,OAAO,KAAK,QAAQ,UACtB,CAAC,CACH;IACF,CAAC;IAED,OAAOD,gBAAAA,cAAc,OAAO,KAAK,WAAW;GAC9C,EACF;EACF,CAAC,CACH;CACF;AACF,CAAC"}
@@ -1,28 +1,29 @@
1
- import { Extension } from '@tiptap/core';
2
-
1
+ import { Extension } from "@tiptap/core";
2
+ //#region src/focus/focus.d.ts
3
3
  interface FocusOptions {
4
- /**
5
- * The class name that should be added to the focused node.
6
- * @default 'has-focus'
7
- * @example 'is-focused'
8
- */
9
- className: string;
10
- /**
11
- * The mode by which the focused node is determined.
12
- * - All: All nodes are marked as focused.
13
- * - Deepest: Only the deepest node is marked as focused.
14
- * - Shallowest: Only the shallowest node is marked as focused.
15
- *
16
- * @default 'all'
17
- * @example 'deepest'
18
- * @example 'shallowest'
19
- */
20
- mode: 'all' | 'deepest' | 'shallowest';
4
+ /**
5
+ * The class name that should be added to the focused node.
6
+ * @default 'has-focus'
7
+ * @example 'is-focused'
8
+ */
9
+ className: string;
10
+ /**
11
+ * The mode by which the focused node is determined.
12
+ * - All: All nodes are marked as focused.
13
+ * - Deepest: Only the deepest node is marked as focused.
14
+ * - Shallowest: Only the shallowest node is marked as focused.
15
+ *
16
+ * @default 'all'
17
+ * @example 'deepest'
18
+ * @example 'shallowest'
19
+ */
20
+ mode: 'all' | 'deepest' | 'shallowest';
21
21
  }
22
22
  /**
23
23
  * This extension allows you to add a class to the focused node.
24
24
  * @see https://www.tiptap.dev/api/extensions/focus
25
25
  */
26
26
  declare const Focus: Extension<FocusOptions, any>;
27
-
28
- export { Focus, type FocusOptions };
27
+ //#endregion
28
+ export { Focus, FocusOptions };
29
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/focus/focus.ts"],"mappings":";;UAIiB;;;;;;EAMf;;;;;;;;;;;EAYA;;;;;;cAOW,OAAK,UAAA"}
@@ -1,28 +1,29 @@
1
- import { Extension } from '@tiptap/core';
2
-
1
+ import { Extension } from "@tiptap/core";
2
+ //#region src/focus/focus.d.ts
3
3
  interface FocusOptions {
4
- /**
5
- * The class name that should be added to the focused node.
6
- * @default 'has-focus'
7
- * @example 'is-focused'
8
- */
9
- className: string;
10
- /**
11
- * The mode by which the focused node is determined.
12
- * - All: All nodes are marked as focused.
13
- * - Deepest: Only the deepest node is marked as focused.
14
- * - Shallowest: Only the shallowest node is marked as focused.
15
- *
16
- * @default 'all'
17
- * @example 'deepest'
18
- * @example 'shallowest'
19
- */
20
- mode: 'all' | 'deepest' | 'shallowest';
4
+ /**
5
+ * The class name that should be added to the focused node.
6
+ * @default 'has-focus'
7
+ * @example 'is-focused'
8
+ */
9
+ className: string;
10
+ /**
11
+ * The mode by which the focused node is determined.
12
+ * - All: All nodes are marked as focused.
13
+ * - Deepest: Only the deepest node is marked as focused.
14
+ * - Shallowest: Only the shallowest node is marked as focused.
15
+ *
16
+ * @default 'all'
17
+ * @example 'deepest'
18
+ * @example 'shallowest'
19
+ */
20
+ mode: 'all' | 'deepest' | 'shallowest';
21
21
  }
22
22
  /**
23
23
  * This extension allows you to add a class to the focused node.
24
24
  * @see https://www.tiptap.dev/api/extensions/focus
25
25
  */
26
26
  declare const Focus: Extension<FocusOptions, any>;
27
-
28
- export { Focus, type FocusOptions };
27
+ //#endregion
28
+ export { Focus, FocusOptions };
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/focus/focus.ts"],"mappings":";;UAIiB;;;;;;EAMf;;;;;;;;;;;EAYA;;;;;;cAOW,OAAK,UAAA"}
@@ -1,68 +1,47 @@
1
- // src/focus/focus.ts
2
1
  import { Extension } from "@tiptap/core";
3
2
  import { Plugin, PluginKey } from "@tiptap/pm/state";
4
3
  import { Decoration, DecorationSet } from "@tiptap/pm/view";
5
- var Focus = Extension.create({
6
- name: "focus",
7
- addOptions() {
8
- return {
9
- className: "has-focus",
10
- mode: "all"
11
- };
12
- },
13
- addProseMirrorPlugins() {
14
- return [
15
- new Plugin({
16
- key: new PluginKey("focus"),
17
- props: {
18
- decorations: ({ doc, selection }) => {
19
- const { isEditable, isFocused } = this.editor;
20
- const { anchor } = selection;
21
- const decorations = [];
22
- if (!isEditable || !isFocused) {
23
- return DecorationSet.create(doc, []);
24
- }
25
- let maxLevels = 0;
26
- if (this.options.mode === "deepest") {
27
- doc.descendants((node, pos) => {
28
- if (node.isText) {
29
- return;
30
- }
31
- const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;
32
- if (!isCurrent) {
33
- return false;
34
- }
35
- maxLevels += 1;
36
- });
37
- }
38
- let currentLevel = 0;
39
- doc.descendants((node, pos) => {
40
- if (node.isText) {
41
- return false;
42
- }
43
- const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;
44
- if (!isCurrent) {
45
- return false;
46
- }
47
- currentLevel += 1;
48
- const outOfScope = this.options.mode === "deepest" && maxLevels - currentLevel > 0 || this.options.mode === "shallowest" && currentLevel > 1;
49
- if (outOfScope) {
50
- return this.options.mode === "deepest";
51
- }
52
- decorations.push(
53
- Decoration.node(pos, pos + node.nodeSize, {
54
- class: this.options.className
55
- })
56
- );
57
- });
58
- return DecorationSet.create(doc, decorations);
59
- }
60
- }
61
- })
62
- ];
63
- }
4
+ //#region src/focus/focus.ts
5
+ /**
6
+ * This extension allows you to add a class to the focused node.
7
+ * @see https://www.tiptap.dev/api/extensions/focus
8
+ */
9
+ const Focus = Extension.create({
10
+ name: "focus",
11
+ addOptions() {
12
+ return {
13
+ className: "has-focus",
14
+ mode: "all"
15
+ };
16
+ },
17
+ addProseMirrorPlugins() {
18
+ return [new Plugin({
19
+ key: new PluginKey("focus"),
20
+ props: { decorations: ({ doc, selection }) => {
21
+ const { isEditable, isFocused } = this.editor;
22
+ const { anchor } = selection;
23
+ const decorations = [];
24
+ if (!isEditable || !isFocused) return DecorationSet.create(doc, []);
25
+ let maxLevels = 0;
26
+ if (this.options.mode === "deepest") doc.descendants((node, pos) => {
27
+ if (node.isText) return;
28
+ if (!(anchor >= pos && anchor <= pos + node.nodeSize - 1)) return false;
29
+ maxLevels += 1;
30
+ });
31
+ let currentLevel = 0;
32
+ doc.descendants((node, pos) => {
33
+ if (node.isText) return false;
34
+ if (!(anchor >= pos && anchor <= pos + node.nodeSize - 1)) return false;
35
+ currentLevel += 1;
36
+ if (this.options.mode === "deepest" && maxLevels - currentLevel > 0 || this.options.mode === "shallowest" && currentLevel > 1) return this.options.mode === "deepest";
37
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, { class: this.options.className }));
38
+ });
39
+ return DecorationSet.create(doc, decorations);
40
+ } }
41
+ })];
42
+ }
64
43
  });
65
- export {
66
- Focus
67
- };
44
+ //#endregion
45
+ export { Focus };
46
+
68
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/focus/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport interface FocusOptions {\n /**\n * The class name that should be added to the focused node.\n * @default 'has-focus'\n * @example 'is-focused'\n */\n className: string\n\n /**\n * The mode by which the focused node is determined.\n * - All: All nodes are marked as focused.\n * - Deepest: Only the deepest node is marked as focused.\n * - Shallowest: Only the shallowest node is marked as focused.\n *\n * @default 'all'\n * @example 'deepest'\n * @example 'shallowest'\n */\n mode: 'all' | 'deepest' | 'shallowest'\n}\n\n/**\n * This extension allows you to add a class to the focused node.\n * @see https://www.tiptap.dev/api/extensions/focus\n */\nexport const Focus = Extension.create<FocusOptions>({\n name: 'focus',\n\n addOptions() {\n return {\n className: 'has-focus',\n mode: 'all',\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('focus'),\n props: {\n decorations: ({ doc, selection }) => {\n const { isEditable, isFocused } = this.editor\n const { anchor } = selection\n const decorations: Decoration[] = []\n\n if (!isEditable || !isFocused) {\n return DecorationSet.create(doc, [])\n }\n\n // Maximum Levels\n let maxLevels = 0\n\n if (this.options.mode === 'deepest') {\n doc.descendants((node, pos) => {\n if (node.isText) {\n return\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n maxLevels += 1\n })\n }\n\n // Loop through current\n let currentLevel = 0\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n return false\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n currentLevel += 1\n\n const outOfScope =\n (this.options.mode === 'deepest' && maxLevels - currentLevel > 0) ||\n (this.options.mode === 'shallowest' && currentLevel > 1)\n\n if (outOfScope) {\n return this.options.mode === 'deepest'\n }\n\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className,\n }),\n )\n })\n\n return DecorationSet.create(doc, decorations)\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,iBAAiB;AAClC,SAAS,YAAY,qBAAqB;AA2BnC,IAAM,QAAQ,UAAU,OAAqB;AAAA,EAClD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,WAAW;AAAA,MACX,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,KAAK,IAAI,UAAU,OAAO;AAAA,QAC1B,OAAO;AAAA,UACL,aAAa,CAAC,EAAE,KAAK,UAAU,MAAM;AACnC,kBAAM,EAAE,YAAY,UAAU,IAAI,KAAK;AACvC,kBAAM,EAAE,OAAO,IAAI;AACnB,kBAAM,cAA4B,CAAC;AAEnC,gBAAI,CAAC,cAAc,CAAC,WAAW;AAC7B,qBAAO,cAAc,OAAO,KAAK,CAAC,CAAC;AAAA,YACrC;AAGA,gBAAI,YAAY;AAEhB,gBAAI,KAAK,QAAQ,SAAS,WAAW;AACnC,kBAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,oBAAI,KAAK,QAAQ;AACf;AAAA,gBACF;AAEA,sBAAM,YAAY,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW;AAEnE,oBAAI,CAAC,WAAW;AACd,yBAAO;AAAA,gBACT;AAEA,6BAAa;AAAA,cACf,CAAC;AAAA,YACH;AAGA,gBAAI,eAAe;AAEnB,gBAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,kBAAI,KAAK,QAAQ;AACf,uBAAO;AAAA,cACT;AAEA,oBAAM,YAAY,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW;AAEnE,kBAAI,CAAC,WAAW;AACd,uBAAO;AAAA,cACT;AAEA,8BAAgB;AAEhB,oBAAM,aACH,KAAK,QAAQ,SAAS,aAAa,YAAY,eAAe,KAC9D,KAAK,QAAQ,SAAS,gBAAgB,eAAe;AAExD,kBAAI,YAAY;AACd,uBAAO,KAAK,QAAQ,SAAS;AAAA,cAC/B;AAEA,0BAAY;AAAA,gBACV,WAAW,KAAK,KAAK,MAAM,KAAK,UAAU;AAAA,kBACxC,OAAO,KAAK,QAAQ;AAAA,gBACtB,CAAC;AAAA,cACH;AAAA,YACF,CAAC;AAED,mBAAO,cAAc,OAAO,KAAK,WAAW;AAAA,UAC9C;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/focus/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport interface FocusOptions {\n /**\n * The class name that should be added to the focused node.\n * @default 'has-focus'\n * @example 'is-focused'\n */\n className: string\n\n /**\n * The mode by which the focused node is determined.\n * - All: All nodes are marked as focused.\n * - Deepest: Only the deepest node is marked as focused.\n * - Shallowest: Only the shallowest node is marked as focused.\n *\n * @default 'all'\n * @example 'deepest'\n * @example 'shallowest'\n */\n mode: 'all' | 'deepest' | 'shallowest'\n}\n\n/**\n * This extension allows you to add a class to the focused node.\n * @see https://www.tiptap.dev/api/extensions/focus\n */\nexport const Focus = Extension.create<FocusOptions>({\n name: 'focus',\n\n addOptions() {\n return {\n className: 'has-focus',\n mode: 'all',\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('focus'),\n props: {\n decorations: ({ doc, selection }) => {\n const { isEditable, isFocused } = this.editor\n const { anchor } = selection\n const decorations: Decoration[] = []\n\n if (!isEditable || !isFocused) {\n return DecorationSet.create(doc, [])\n }\n\n // Maximum Levels\n let maxLevels = 0\n\n if (this.options.mode === 'deepest') {\n doc.descendants((node, pos) => {\n if (node.isText) {\n return\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n maxLevels += 1\n })\n }\n\n // Loop through current\n let currentLevel = 0\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n return false\n }\n\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1\n\n if (!isCurrent) {\n return false\n }\n\n currentLevel += 1\n\n const outOfScope =\n (this.options.mode === 'deepest' && maxLevels - currentLevel > 0) ||\n (this.options.mode === 'shallowest' && currentLevel > 1)\n\n if (outOfScope) {\n return this.options.mode === 'deepest'\n }\n\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className,\n }),\n )\n })\n\n return DecorationSet.create(doc, decorations)\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;AA6BA,MAAa,QAAQ,UAAU,OAAqB;CAClD,MAAM;CAEN,aAAa;EACX,OAAO;GACL,WAAW;GACX,MAAM;EACR;CACF;CAEA,wBAAwB;EACtB,OAAO,CACL,IAAI,OAAO;GACT,KAAK,IAAI,UAAU,OAAO;GAC1B,OAAO,EACL,cAAc,EAAE,KAAK,gBAAgB;IACnC,MAAM,EAAE,YAAY,cAAc,KAAK;IACvC,MAAM,EAAE,WAAW;IACnB,MAAM,cAA4B,CAAC;IAEnC,IAAI,CAAC,cAAc,CAAC,WAClB,OAAO,cAAc,OAAO,KAAK,CAAC,CAAC;IAIrC,IAAI,YAAY;IAEhB,IAAI,KAAK,QAAQ,SAAS,WACxB,IAAI,aAAa,MAAM,QAAQ;KAC7B,IAAI,KAAK,QACP;KAKF,IAAI,EAFc,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW,IAGjE,OAAO;KAGT,aAAa;IACf,CAAC;IAIH,IAAI,eAAe;IAEnB,IAAI,aAAa,MAAM,QAAQ;KAC7B,IAAI,KAAK,QACP,OAAO;KAKT,IAAI,EAFc,UAAU,OAAO,UAAU,MAAM,KAAK,WAAW,IAGjE,OAAO;KAGT,gBAAgB;KAMhB,IAHG,KAAK,QAAQ,SAAS,aAAa,YAAY,eAAe,KAC9D,KAAK,QAAQ,SAAS,gBAAgB,eAAe,GAGtD,OAAO,KAAK,QAAQ,SAAS;KAG/B,YAAY,KACV,WAAW,KAAK,KAAK,MAAM,KAAK,UAAU,EACxC,OAAO,KAAK,QAAQ,UACtB,CAAC,CACH;IACF,CAAC;IAED,OAAO,cAAc,OAAO,KAAK,WAAW;GAC9C,EACF;EACF,CAAC,CACH;CACF;AACF,CAAC"}
@@ -1,51 +1,29 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/gap-cursor/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Gapcursor: () => Gapcursor
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _tiptap_core = require("@tiptap/core");
3
+ let _tiptap_pm_gapcursor = require("@tiptap/pm/gapcursor");
4
+ //#region src/gap-cursor/gap-cursor.ts
5
+ /**
6
+ * This extension allows you to add a gap cursor to your editor.
7
+ * A gap cursor is a cursor that appears when you click on a place
8
+ * where no content is present, for example inbetween nodes.
9
+ * @see https://tiptap.dev/api/extensions/gapcursor
10
+ */
11
+ const Gapcursor = _tiptap_core.Extension.create({
12
+ name: "gapCursor",
13
+ addProseMirrorPlugins() {
14
+ return [(0, _tiptap_pm_gapcursor.gapCursor)()];
15
+ },
16
+ extendNodeSchema(extension) {
17
+ var _callOrReturn;
18
+ const context = {
19
+ name: extension.name,
20
+ options: extension.options,
21
+ storage: extension.storage
22
+ };
23
+ return { allowGapCursor: (_callOrReturn = (0, _tiptap_core.callOrReturn)((0, _tiptap_core.getExtensionField)(extension, "allowGapCursor", context))) !== null && _callOrReturn !== void 0 ? _callOrReturn : null };
24
+ }
24
25
  });
25
- module.exports = __toCommonJS(index_exports);
26
+ //#endregion
27
+ exports.Gapcursor = Gapcursor;
26
28
 
27
- // src/gap-cursor/gap-cursor.ts
28
- var import_core = require("@tiptap/core");
29
- var import_gapcursor = require("@tiptap/pm/gapcursor");
30
- var Gapcursor = import_core.Extension.create({
31
- name: "gapCursor",
32
- addProseMirrorPlugins() {
33
- return [(0, import_gapcursor.gapCursor)()];
34
- },
35
- extendNodeSchema(extension) {
36
- var _a;
37
- const context = {
38
- name: extension.name,
39
- options: extension.options,
40
- storage: extension.storage
41
- };
42
- return {
43
- allowGapCursor: (_a = (0, import_core.callOrReturn)((0, import_core.getExtensionField)(extension, "allowGapCursor", context))) != null ? _a : null
44
- };
45
- }
46
- });
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- Gapcursor
50
- });
51
29
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/gap-cursor/index.ts","../../src/gap-cursor/gap-cursor.ts"],"sourcesContent":["export * from './gap-cursor.js'\n","import type { ParentConfig } from '@tiptap/core'\nimport { callOrReturn, Extension, getExtensionField } from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string\n options: Options\n storage: Storage\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor']\n }) => boolean | null)\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [gapCursor()]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAA2D;AAC3D,uBAA0B;AA0BnB,IAAM,YAAY,sBAAU,OAAO;AAAA,EACxC,MAAM;AAAA,EAEN,wBAAwB;AACtB,WAAO,KAAC,4BAAU,CAAC;AAAA,EACrB;AAAA,EAEA,iBAAiB,WAAW;AAnC9B;AAoCI,UAAM,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,SAAS,UAAU;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,iBAAgB,uCAAa,+BAAkB,WAAW,kBAAkB,OAAO,CAAC,MAApE,YAAyE;AAAA,IAC3F;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"file":"index.cjs","names":["Extension","gapCursor","callOrReturn","getExtensionField"],"sources":["../../src/gap-cursor/gap-cursor.ts"],"sourcesContent":["import type { ParentConfig } from '@tiptap/core'\nimport { callOrReturn, Extension, getExtensionField } from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string\n options: Options\n storage: Storage\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor']\n }) => boolean | null)\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [gapCursor()]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,YAAYA,aAAAA,UAAU,OAAO;CACxC,MAAM;CAEN,wBAAwB;EACtB,OAAO,EAAA,GAACC,qBAAAA,UAAAA,CAAU,CAAC;CACrB;CAEA,iBAAiB,WAAW;;EAC1B,MAAM,UAAU;GACd,MAAM,UAAU;GAChB,SAAS,UAAU;GACnB,SAAS,UAAU;EACrB;EAEA,OAAO,EACL,iBAAA,iBAAA,GAAgBC,aAAAA,aAAAA,EAAAA,GAAaC,aAAAA,kBAAAA,CAAkB,WAAW,kBAAkB,OAAO,CAAC,OAAA,QAAA,kBAAA,KAAA,IAAA,gBAAK,KAC3F;CACF;AACF,CAAC"}
@@ -1,18 +1,18 @@
1
- import { ParentConfig, Extension } from '@tiptap/core';
2
-
1
+ import { Extension, ParentConfig } from "@tiptap/core";
2
+ //#region src/gap-cursor/gap-cursor.d.ts
3
3
  declare module '@tiptap/core' {
4
- interface NodeConfig<Options, Storage> {
5
- /**
6
- * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.
7
- * @default null
8
- */
9
- allowGapCursor?: boolean | null | ((this: {
10
- name: string;
11
- options: Options;
12
- storage: Storage;
13
- parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'];
14
- }) => boolean | null);
15
- }
4
+ interface NodeConfig<Options, Storage> {
5
+ /**
6
+ * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.
7
+ * @default null
8
+ */
9
+ allowGapCursor?: boolean | null | ((this: {
10
+ name: string;
11
+ options: Options;
12
+ storage: Storage;
13
+ parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'];
14
+ }) => boolean | null);
15
+ }
16
16
  }
17
17
  /**
18
18
  * This extension allows you to add a gap cursor to your editor.
@@ -21,5 +21,6 @@ declare module '@tiptap/core' {
21
21
  * @see https://tiptap.dev/api/extensions/gapcursor
22
22
  */
23
23
  declare const Gapcursor: Extension<any, any>;
24
-
24
+ //#endregion
25
25
  export { Gapcursor };
26
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/gap-cursor/gap-cursor.ts"],"mappings":";;;YAKY,WAAW,SAAS;;;;;IAK5B,oCAGM;MACA;MACA,SAAS;MACT,SAAS;MACT,QAAQ,aAAa,WAAW;;;;;;;;;;cAW7B,WAAS"}
@@ -1,18 +1,18 @@
1
- import { ParentConfig, Extension } from '@tiptap/core';
2
-
1
+ import { Extension, ParentConfig } from "@tiptap/core";
2
+ //#region src/gap-cursor/gap-cursor.d.ts
3
3
  declare module '@tiptap/core' {
4
- interface NodeConfig<Options, Storage> {
5
- /**
6
- * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.
7
- * @default null
8
- */
9
- allowGapCursor?: boolean | null | ((this: {
10
- name: string;
11
- options: Options;
12
- storage: Storage;
13
- parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'];
14
- }) => boolean | null);
15
- }
4
+ interface NodeConfig<Options, Storage> {
5
+ /**
6
+ * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.
7
+ * @default null
8
+ */
9
+ allowGapCursor?: boolean | null | ((this: {
10
+ name: string;
11
+ options: Options;
12
+ storage: Storage;
13
+ parent: ParentConfig<NodeConfig<Options>>['allowGapCursor'];
14
+ }) => boolean | null);
15
+ }
16
16
  }
17
17
  /**
18
18
  * This extension allows you to add a gap cursor to your editor.
@@ -21,5 +21,6 @@ declare module '@tiptap/core' {
21
21
  * @see https://tiptap.dev/api/extensions/gapcursor
22
22
  */
23
23
  declare const Gapcursor: Extension<any, any>;
24
-
24
+ //#endregion
25
25
  export { Gapcursor };
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/gap-cursor/gap-cursor.ts"],"mappings":";;;YAKY,WAAW,SAAS;;;;;IAK5B,oCAGM;MACA;MACA,SAAS;MACT,SAAS;MACT,QAAQ,aAAa,WAAW;;;;;;;;;;cAW7B,WAAS"}
@@ -1,24 +1,28 @@
1
- // src/gap-cursor/gap-cursor.ts
2
- import { callOrReturn, Extension, getExtensionField } from "@tiptap/core";
1
+ import { Extension, callOrReturn, getExtensionField } from "@tiptap/core";
3
2
  import { gapCursor } from "@tiptap/pm/gapcursor";
4
- var Gapcursor = Extension.create({
5
- name: "gapCursor",
6
- addProseMirrorPlugins() {
7
- return [gapCursor()];
8
- },
9
- extendNodeSchema(extension) {
10
- var _a;
11
- const context = {
12
- name: extension.name,
13
- options: extension.options,
14
- storage: extension.storage
15
- };
16
- return {
17
- allowGapCursor: (_a = callOrReturn(getExtensionField(extension, "allowGapCursor", context))) != null ? _a : null
18
- };
19
- }
3
+ //#region src/gap-cursor/gap-cursor.ts
4
+ /**
5
+ * This extension allows you to add a gap cursor to your editor.
6
+ * A gap cursor is a cursor that appears when you click on a place
7
+ * where no content is present, for example inbetween nodes.
8
+ * @see https://tiptap.dev/api/extensions/gapcursor
9
+ */
10
+ const Gapcursor = Extension.create({
11
+ name: "gapCursor",
12
+ addProseMirrorPlugins() {
13
+ return [gapCursor()];
14
+ },
15
+ extendNodeSchema(extension) {
16
+ var _callOrReturn;
17
+ const context = {
18
+ name: extension.name,
19
+ options: extension.options,
20
+ storage: extension.storage
21
+ };
22
+ return { allowGapCursor: (_callOrReturn = callOrReturn(getExtensionField(extension, "allowGapCursor", context))) !== null && _callOrReturn !== void 0 ? _callOrReturn : null };
23
+ }
20
24
  });
21
- export {
22
- Gapcursor
23
- };
25
+ //#endregion
26
+ export { Gapcursor };
27
+
24
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/gap-cursor/gap-cursor.ts"],"sourcesContent":["import type { ParentConfig } from '@tiptap/core'\nimport { callOrReturn, Extension, getExtensionField } from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string\n options: Options\n storage: Storage\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor']\n }) => boolean | null)\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [gapCursor()]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"mappings":";AACA,SAAS,cAAc,WAAW,yBAAyB;AAC3D,SAAS,iBAAiB;AA0BnB,IAAM,YAAY,UAAU,OAAO;AAAA,EACxC,MAAM;AAAA,EAEN,wBAAwB;AACtB,WAAO,CAAC,UAAU,CAAC;AAAA,EACrB;AAAA,EAEA,iBAAiB,WAAW;AAnC9B;AAoCI,UAAM,UAAU;AAAA,MACd,MAAM,UAAU;AAAA,MAChB,SAAS,UAAU;AAAA,MACnB,SAAS,UAAU;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,iBAAgB,kBAAa,kBAAkB,WAAW,kBAAkB,OAAO,CAAC,MAApE,YAAyE;AAAA,IAC3F;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/gap-cursor/gap-cursor.ts"],"sourcesContent":["import type { ParentConfig } from '@tiptap/core'\nimport { callOrReturn, Extension, getExtensionField } from '@tiptap/core'\nimport { gapCursor } from '@tiptap/pm/gapcursor'\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /**\n * A function to determine whether the gap cursor is allowed at the current position. Must return `true` or `false`.\n * @default null\n */\n allowGapCursor?:\n | boolean\n | null\n | ((this: {\n name: string\n options: Options\n storage: Storage\n parent: ParentConfig<NodeConfig<Options>>['allowGapCursor']\n }) => boolean | null)\n }\n}\n\n/**\n * This extension allows you to add a gap cursor to your editor.\n * A gap cursor is a cursor that appears when you click on a place\n * where no content is present, for example inbetween nodes.\n * @see https://tiptap.dev/api/extensions/gapcursor\n */\nexport const Gapcursor = Extension.create({\n name: 'gapCursor',\n\n addProseMirrorPlugins() {\n return [gapCursor()]\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }\n\n return {\n allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,\n }\n },\n})\n"],"mappings":";;;;;;;;;AA4BA,MAAa,YAAY,UAAU,OAAO;CACxC,MAAM;CAEN,wBAAwB;EACtB,OAAO,CAAC,UAAU,CAAC;CACrB;CAEA,iBAAiB,WAAW;;EAC1B,MAAM,UAAU;GACd,MAAM,UAAU;GAChB,SAAS,UAAU;GACnB,SAAS,UAAU;EACrB;EAEA,OAAO,EACL,iBAAA,gBAAgB,aAAa,kBAAkB,WAAW,kBAAkB,OAAO,CAAC,OAAA,QAAA,kBAAA,KAAA,IAAA,gBAAK,KAC3F;CACF;AACF,CAAC"}