@tiptap/extensions 3.0.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/LICENSE.md +21 -0
- package/README.md +18 -0
- package/dist/character-count/index.cjs +129 -0
- package/dist/character-count/index.cjs.map +1 -0
- package/dist/character-count/index.d.cts +62 -0
- package/dist/character-count/index.d.ts +62 -0
- package/dist/character-count/index.js +102 -0
- package/dist/character-count/index.js.map +1 -0
- package/dist/drop-cursor/index.cjs +47 -0
- package/dist/drop-cursor/index.cjs.map +1 -0
- package/dist/drop-cursor/index.d.cts +31 -0
- package/dist/drop-cursor/index.d.ts +31 -0
- package/dist/drop-cursor/index.js +20 -0
- package/dist/drop-cursor/index.js.map +1 -0
- package/dist/focus/index.cjs +95 -0
- package/dist/focus/index.cjs.map +1 -0
- package/dist/focus/index.d.cts +28 -0
- package/dist/focus/index.d.ts +28 -0
- package/dist/focus/index.js +68 -0
- package/dist/focus/index.js.map +1 -0
- package/dist/gap-cursor/index.cjs +51 -0
- package/dist/gap-cursor/index.cjs.map +1 -0
- package/dist/gap-cursor/index.d.cts +25 -0
- package/dist/gap-cursor/index.d.ts +25 -0
- package/dist/gap-cursor/index.js +24 -0
- package/dist/gap-cursor/index.js.map +1 -0
- package/dist/index.cjs +421 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +272 -0
- package/dist/index.d.ts +272 -0
- package/dist/index.js +387 -0
- package/dist/index.js.map +1 -0
- package/dist/placeholder/index.cjs +88 -0
- package/dist/placeholder/index.cjs.map +1 -0
- package/dist/placeholder/index.d.cts +59 -0
- package/dist/placeholder/index.d.ts +59 -0
- package/dist/placeholder/index.js +61 -0
- package/dist/placeholder/index.js.map +1 -0
- package/dist/selection/index.cjs +63 -0
- package/dist/selection/index.cjs.map +1 -0
- package/dist/selection/index.d.cts +17 -0
- package/dist/selection/index.d.ts +17 -0
- package/dist/selection/index.js +36 -0
- package/dist/selection/index.js.map +1 -0
- package/dist/trailing-node/index.cjs +78 -0
- package/dist/trailing-node/index.cjs.map +1 -0
- package/dist/trailing-node/index.d.cts +28 -0
- package/dist/trailing-node/index.d.ts +28 -0
- package/dist/trailing-node/index.js +51 -0
- package/dist/trailing-node/index.js.map +1 -0
- package/dist/undo-redo/index.cjs +66 -0
- package/dist/undo-redo/index.cjs.map +1 -0
- package/dist/undo-redo/index.d.cts +44 -0
- package/dist/undo-redo/index.d.ts +44 -0
- package/dist/undo-redo/index.js +39 -0
- package/dist/undo-redo/index.js.map +1 -0
- package/package.json +114 -0
- package/src/character-count/character-count.ts +195 -0
- package/src/character-count/index.ts +1 -0
- package/src/drop-cursor/drop-cursor.ts +47 -0
- package/src/drop-cursor/index.ts +1 -0
- package/src/focus/focus.ts +110 -0
- package/src/focus/index.ts +1 -0
- package/src/gap-cursor/gap-cursor.ts +47 -0
- package/src/gap-cursor/index.ts +1 -0
- package/src/index.ts +8 -0
- package/src/placeholder/index.ts +1 -0
- package/src/placeholder/placeholder.ts +129 -0
- package/src/selection/index.ts +1 -0
- package/src/selection/selection.ts +51 -0
- package/src/trailing-node/index.ts +1 -0
- package/src/trailing-node/trailing-node.ts +84 -0
- package/src/undo-redo/index.ts +1 -0
- package/src/undo-redo/undo-redo.ts +86 -0
|
@@ -0,0 +1,95 @@
|
|
|
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/focus/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Focus: () => Focus
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/focus/focus.ts
|
|
28
|
+
var import_core = require("@tiptap/core");
|
|
29
|
+
var import_state = require("@tiptap/pm/state");
|
|
30
|
+
var import_view = require("@tiptap/pm/view");
|
|
31
|
+
var Focus = import_core.Extension.create({
|
|
32
|
+
name: "focus",
|
|
33
|
+
addOptions() {
|
|
34
|
+
return {
|
|
35
|
+
className: "has-focus",
|
|
36
|
+
mode: "all"
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
addProseMirrorPlugins() {
|
|
40
|
+
return [
|
|
41
|
+
new import_state.Plugin({
|
|
42
|
+
key: new import_state.PluginKey("focus"),
|
|
43
|
+
props: {
|
|
44
|
+
decorations: ({ doc, selection }) => {
|
|
45
|
+
const { isEditable, isFocused } = this.editor;
|
|
46
|
+
const { anchor } = selection;
|
|
47
|
+
const decorations = [];
|
|
48
|
+
if (!isEditable || !isFocused) {
|
|
49
|
+
return import_view.DecorationSet.create(doc, []);
|
|
50
|
+
}
|
|
51
|
+
let maxLevels = 0;
|
|
52
|
+
if (this.options.mode === "deepest") {
|
|
53
|
+
doc.descendants((node, pos) => {
|
|
54
|
+
if (node.isText) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;
|
|
58
|
+
if (!isCurrent) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
maxLevels += 1;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
let currentLevel = 0;
|
|
65
|
+
doc.descendants((node, pos) => {
|
|
66
|
+
if (node.isText) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;
|
|
70
|
+
if (!isCurrent) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
currentLevel += 1;
|
|
74
|
+
const outOfScope = this.options.mode === "deepest" && maxLevels - currentLevel > 0 || this.options.mode === "shallowest" && currentLevel > 1;
|
|
75
|
+
if (outOfScope) {
|
|
76
|
+
return this.options.mode === "deepest";
|
|
77
|
+
}
|
|
78
|
+
decorations.push(
|
|
79
|
+
import_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
80
|
+
class: this.options.className
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
return import_view.DecorationSet.create(doc, decorations);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
Focus
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
|
|
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';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This extension allows you to add a class to the focused node.
|
|
24
|
+
* @see https://www.tiptap.dev/api/extensions/focus
|
|
25
|
+
*/
|
|
26
|
+
declare const Focus: Extension<FocusOptions, any>;
|
|
27
|
+
|
|
28
|
+
export { Focus, type FocusOptions };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
|
|
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';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This extension allows you to add a class to the focused node.
|
|
24
|
+
* @see https://www.tiptap.dev/api/extensions/focus
|
|
25
|
+
*/
|
|
26
|
+
declare const Focus: Extension<FocusOptions, any>;
|
|
27
|
+
|
|
28
|
+
export { Focus, type FocusOptions };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/focus/focus.ts
|
|
2
|
+
import { Extension } from "@tiptap/core";
|
|
3
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
4
|
+
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
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
Focus
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
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
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ParentConfig, Extension } from '@tiptap/core';
|
|
2
|
+
|
|
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
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This extension allows you to add a gap cursor to your editor.
|
|
19
|
+
* A gap cursor is a cursor that appears when you click on a place
|
|
20
|
+
* where no content is present, for example inbetween nodes.
|
|
21
|
+
* @see https://tiptap.dev/api/extensions/gapcursor
|
|
22
|
+
*/
|
|
23
|
+
declare const Gapcursor: Extension<any, any>;
|
|
24
|
+
|
|
25
|
+
export { Gapcursor };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ParentConfig, Extension } from '@tiptap/core';
|
|
2
|
+
|
|
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
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This extension allows you to add a gap cursor to your editor.
|
|
19
|
+
* A gap cursor is a cursor that appears when you click on a place
|
|
20
|
+
* where no content is present, for example inbetween nodes.
|
|
21
|
+
* @see https://tiptap.dev/api/extensions/gapcursor
|
|
22
|
+
*/
|
|
23
|
+
declare const Gapcursor: Extension<any, any>;
|
|
24
|
+
|
|
25
|
+
export { Gapcursor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/gap-cursor/gap-cursor.ts
|
|
2
|
+
import { callOrReturn, Extension, getExtensionField } from "@tiptap/core";
|
|
3
|
+
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
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
Gapcursor
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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":[]}
|