@tiptap/extensions 3.30.2 → 3.30.3
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/character-count/index.cjs +84 -128
- package/dist/character-count/index.cjs.map +1 -1
- package/dist/character-count/index.d.cts +59 -58
- package/dist/character-count/index.d.cts.map +1 -0
- package/dist/character-count/index.d.ts +59 -58
- package/dist/character-count/index.d.ts.map +1 -0
- package/dist/character-count/index.js +82 -100
- package/dist/character-count/index.js.map +1 -1
- package/dist/drop-cursor/index.cjs +24 -44
- package/dist/drop-cursor/index.cjs.map +1 -1
- package/dist/drop-cursor/index.d.cts +23 -22
- package/dist/drop-cursor/index.d.cts.map +1 -0
- package/dist/drop-cursor/index.d.ts +23 -22
- package/dist/drop-cursor/index.d.ts.map +1 -0
- package/dist/drop-cursor/index.js +22 -16
- package/dist/drop-cursor/index.js.map +1 -1
- package/dist/focus/index.cjs +45 -92
- package/dist/focus/index.cjs.map +1 -1
- package/dist/focus/index.d.cts +22 -21
- package/dist/focus/index.d.cts.map +1 -0
- package/dist/focus/index.d.ts +22 -21
- package/dist/focus/index.d.ts.map +1 -0
- package/dist/focus/index.js +42 -63
- package/dist/focus/index.js.map +1 -1
- package/dist/gap-cursor/index.cjs +25 -48
- package/dist/gap-cursor/index.cjs.map +1 -1
- package/dist/gap-cursor/index.d.cts +16 -15
- package/dist/gap-cursor/index.d.cts.map +1 -0
- package/dist/gap-cursor/index.d.ts +16 -15
- package/dist/gap-cursor/index.d.ts.map +1 -0
- package/dist/gap-cursor/index.js +24 -21
- package/dist/gap-cursor/index.js.map +1 -1
- package/dist/index.cjs +666 -742
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -220
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +231 -220
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +653 -703
- package/dist/index.js.map +1 -1
- package/dist/placeholder/index.cjs +344 -376
- package/dist/placeholder/index.cjs.map +1 -1
- package/dist/placeholder/index.d.cts +73 -69
- package/dist/placeholder/index.d.cts.map +1 -0
- package/dist/placeholder/index.d.ts +73 -69
- package/dist/placeholder/index.d.ts.map +1 -0
- package/dist/placeholder/index.js +340 -346
- package/dist/placeholder/index.js.map +1 -1
- package/dist/selection/index.cjs +62 -86
- package/dist/selection/index.cjs.map +1 -1
- package/dist/selection/index.d.cts +11 -10
- package/dist/selection/index.d.cts.map +1 -0
- package/dist/selection/index.d.ts +11 -10
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.js +58 -56
- package/dist/selection/index.js.map +1 -1
- package/dist/trailing-node/index.cjs +59 -89
- package/dist/trailing-node/index.cjs.map +1 -1
- package/dist/trailing-node/index.d.cts +17 -16
- package/dist/trailing-node/index.d.cts.map +1 -0
- package/dist/trailing-node/index.d.ts +17 -16
- package/dist/trailing-node/index.d.ts.map +1 -0
- package/dist/trailing-node/index.js +55 -59
- package/dist/trailing-node/index.js.map +1 -1
- package/dist/undo-redo/index.cjs +45 -63
- package/dist/undo-redo/index.cjs.map +1 -1
- package/dist/undo-redo/index.d.cts +31 -30
- package/dist/undo-redo/index.d.cts.map +1 -0
- package/dist/undo-redo/index.d.ts +31 -30
- package/dist/undo-redo/index.d.ts.map +1 -0
- package/dist/undo-redo/index.js +43 -35
- package/dist/undo-redo/index.js.map +1 -1
- package/package.json +6 -6
package/dist/focus/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
package/dist/focus/index.d.cts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { Extension } from
|
|
2
|
-
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
//#region src/focus/focus.d.ts
|
|
3
3
|
interface FocusOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
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"}
|
package/dist/focus/index.d.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { Extension } from
|
|
2
|
-
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
//#region src/focus/focus.d.ts
|
|
3
3
|
interface FocusOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
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"}
|
package/dist/focus/index.js
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Focus };
|
|
46
|
+
|
|
68
47
|
//# sourceMappingURL=index.js.map
|
package/dist/focus/index.js.map
CHANGED
|
@@ -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":"
|
|
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,28 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
return { allowGapCursor: (_callOrReturn = (0, _tiptap_core.callOrReturn)((0, _tiptap_core.getExtensionField)(extension, "allowGapCursor", {
|
|
19
|
+
name: extension.name,
|
|
20
|
+
options: extension.options,
|
|
21
|
+
storage: extension.storage
|
|
22
|
+
}))) !== null && _callOrReturn !== void 0 ? _callOrReturn : null };
|
|
23
|
+
}
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.Gapcursor = Gapcursor;
|
|
26
27
|
|
|
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
28
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Extension"],"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,GAAA,qBAAA,UAAA,CAAW,CAAC;CACrB;CAEA,iBAAiB,WAAW;;EAO1B,OAAO,EACL,iBAAA,iBAAA,GAAA,aAAA,aAAA,EAAA,GAAA,aAAA,kBAAA,CAA+C,WAAW,kBAAkB;GAN5E,MAAM,UAAU;GAChB,SAAS,UAAU;GACnB,SAAS,UAAU;EAI+D,CAAC,CAAC,OAAA,QAAA,kBAAA,KAAA,IAAA,gBAAK,KAC3F;CACF;AACF,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Extension, ParentConfig } from "@tiptap/core";
|
|
2
|
+
//#region src/gap-cursor/gap-cursor.d.ts
|
|
3
3
|
declare module '@tiptap/core' {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 {
|
|
2
|
-
|
|
1
|
+
import { Extension, ParentConfig } from "@tiptap/core";
|
|
2
|
+
//#region src/gap-cursor/gap-cursor.d.ts
|
|
3
3
|
declare module '@tiptap/core' {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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"}
|
package/dist/gap-cursor/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
return { allowGapCursor: (_callOrReturn = callOrReturn(getExtensionField(extension, "allowGapCursor", {
|
|
18
|
+
name: extension.name,
|
|
19
|
+
options: extension.options,
|
|
20
|
+
storage: extension.storage
|
|
21
|
+
}))) !== null && _callOrReturn !== void 0 ? _callOrReturn : null };
|
|
22
|
+
}
|
|
20
23
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Gapcursor };
|
|
26
|
+
|
|
24
27
|
//# 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":"
|
|
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;;EAO1B,OAAO,EACL,iBAAA,gBAAgB,aAAa,kBAAkB,WAAW,kBAAkB;GAN5E,MAAM,UAAU;GAChB,SAAS,UAAU;GACnB,SAAS,UAAU;EAI+D,CAAC,CAAC,OAAA,QAAA,kBAAA,KAAA,IAAA,gBAAK,KAC3F;CACF;AACF,CAAC"}
|