@tiptap/extensions 3.0.0-next.4 → 3.0.0-next.5
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 +1 -1
- 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/history/index.cjs +66 -0
- package/dist/history/index.cjs.map +1 -0
- package/dist/history/index.d.cts +44 -0
- package/dist/history/index.d.ts +44 -0
- package/dist/history/index.js +39 -0
- package/dist/history/index.js.map +1 -0
- package/dist/index.cjs +222 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +157 -2
- package/dist/index.d.ts +157 -2
- package/dist/index.js +218 -22
- package/dist/index.js.map +1 -1
- 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/package.json +27 -3
- package/src/character-count/character-count.ts +195 -0
- package/src/character-count/index.ts +1 -0
- package/src/history/history.ts +86 -0
- package/src/history/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/placeholder/index.ts +1 -0
- package/src/placeholder/placeholder.ts +128 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface HistoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The amount of history events that are collected before the oldest events are discarded.
|
|
6
|
+
* @default 100
|
|
7
|
+
* @example 50
|
|
8
|
+
*/
|
|
9
|
+
depth: number;
|
|
10
|
+
/**
|
|
11
|
+
* The delay (in milliseconds) between changes after which a new group should be started.
|
|
12
|
+
* @default 500
|
|
13
|
+
* @example 1000
|
|
14
|
+
*/
|
|
15
|
+
newGroupDelay: number;
|
|
16
|
+
}
|
|
17
|
+
declare module '@tiptap/core' {
|
|
18
|
+
interface Commands<ReturnType> {
|
|
19
|
+
history: {
|
|
20
|
+
/**
|
|
21
|
+
* Undo recent changes
|
|
22
|
+
* @example editor.commands.undo()
|
|
23
|
+
*/
|
|
24
|
+
undo: () => ReturnType;
|
|
25
|
+
/**
|
|
26
|
+
* Reapply reverted changes
|
|
27
|
+
* @example editor.commands.redo()
|
|
28
|
+
*/
|
|
29
|
+
redo: () => ReturnType;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This extension allows you to undo and redo recent changes.
|
|
35
|
+
* @see https://www.tiptap.dev/api/extensions/history
|
|
36
|
+
*
|
|
37
|
+
* **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
|
|
38
|
+
* the `history` extension, as it is not compatible with the `collaboration` extension.
|
|
39
|
+
*
|
|
40
|
+
* `@tiptap/extension-collaboration` uses its own history implementation.
|
|
41
|
+
*/
|
|
42
|
+
declare const History: Extension<HistoryOptions, any>;
|
|
43
|
+
|
|
44
|
+
export { History, type HistoryOptions };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface HistoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The amount of history events that are collected before the oldest events are discarded.
|
|
6
|
+
* @default 100
|
|
7
|
+
* @example 50
|
|
8
|
+
*/
|
|
9
|
+
depth: number;
|
|
10
|
+
/**
|
|
11
|
+
* The delay (in milliseconds) between changes after which a new group should be started.
|
|
12
|
+
* @default 500
|
|
13
|
+
* @example 1000
|
|
14
|
+
*/
|
|
15
|
+
newGroupDelay: number;
|
|
16
|
+
}
|
|
17
|
+
declare module '@tiptap/core' {
|
|
18
|
+
interface Commands<ReturnType> {
|
|
19
|
+
history: {
|
|
20
|
+
/**
|
|
21
|
+
* Undo recent changes
|
|
22
|
+
* @example editor.commands.undo()
|
|
23
|
+
*/
|
|
24
|
+
undo: () => ReturnType;
|
|
25
|
+
/**
|
|
26
|
+
* Reapply reverted changes
|
|
27
|
+
* @example editor.commands.redo()
|
|
28
|
+
*/
|
|
29
|
+
redo: () => ReturnType;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This extension allows you to undo and redo recent changes.
|
|
35
|
+
* @see https://www.tiptap.dev/api/extensions/history
|
|
36
|
+
*
|
|
37
|
+
* **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
|
|
38
|
+
* the `history` extension, as it is not compatible with the `collaboration` extension.
|
|
39
|
+
*
|
|
40
|
+
* `@tiptap/extension-collaboration` uses its own history implementation.
|
|
41
|
+
*/
|
|
42
|
+
declare const History: Extension<HistoryOptions, any>;
|
|
43
|
+
|
|
44
|
+
export { History, type HistoryOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/history/history.ts
|
|
2
|
+
import { Extension } from "@tiptap/core";
|
|
3
|
+
import { history, redo, undo } from "@tiptap/pm/history";
|
|
4
|
+
var History = Extension.create({
|
|
5
|
+
name: "history",
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
depth: 100,
|
|
9
|
+
newGroupDelay: 500
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
addCommands() {
|
|
13
|
+
return {
|
|
14
|
+
undo: () => ({ state, dispatch }) => {
|
|
15
|
+
return undo(state, dispatch);
|
|
16
|
+
},
|
|
17
|
+
redo: () => ({ state, dispatch }) => {
|
|
18
|
+
return redo(state, dispatch);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
addProseMirrorPlugins() {
|
|
23
|
+
return [history(this.options)];
|
|
24
|
+
},
|
|
25
|
+
addKeyboardShortcuts() {
|
|
26
|
+
return {
|
|
27
|
+
"Mod-z": () => this.editor.commands.undo(),
|
|
28
|
+
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
29
|
+
"Mod-y": () => this.editor.commands.redo(),
|
|
30
|
+
// Russian keyboard layouts
|
|
31
|
+
"Mod-\u044F": () => this.editor.commands.undo(),
|
|
32
|
+
"Shift-Mod-\u044F": () => this.editor.commands.redo()
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
History
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/history/history.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface HistoryOptions {\n /**\n * The amount of history events that are collected before the oldest events are discarded.\n * @default 100\n * @example 50\n */\n depth: number\n\n /**\n * The delay (in milliseconds) between changes after which a new group should be started.\n * @default 500\n * @example 1000\n */\n newGroupDelay: number\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n * @example editor.commands.undo()\n */\n undo: () => ReturnType\n /**\n * Reapply reverted changes\n * @example editor.commands.redo()\n */\n redo: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to undo and redo recent changes.\n * @see https://www.tiptap.dev/api/extensions/history\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `history` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\n */\nexport const History = Extension.create<HistoryOptions>({\n name: 'history',\n\n addOptions() {\n return {\n depth: 100,\n newGroupDelay: 500,\n }\n },\n\n addCommands() {\n return {\n undo:\n () =>\n ({ state, dispatch }) => {\n return undo(state, dispatch)\n },\n redo:\n () =>\n ({ state, dispatch }) => {\n return redo(state, dispatch)\n },\n }\n },\n\n addProseMirrorPlugins() {\n return [history(this.options)]\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-z': () => this.editor.commands.undo(),\n 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => this.editor.commands.redo(),\n\n // Russian keyboard layouts\n 'Mod-я': () => this.editor.commands.undo(),\n 'Shift-Mod-я': () => this.editor.commands.redo(),\n }\n },\n})\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,MAAM,YAAY;AA4C7B,IAAM,UAAU,UAAU,OAAuB;AAAA,EACtD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO;AAAA,MACP,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,MACE,MACA,CAAC,EAAE,OAAO,SAAS,MAAM;AACvB,eAAO,KAAK,OAAO,QAAQ;AAAA,MAC7B;AAAA,MACF,MACE,MACA,CAAC,EAAE,OAAO,SAAS,MAAM;AACvB,eAAO,KAAK,OAAO,QAAQ;AAAA,MAC7B;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAAA,EAC/B;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,SAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MACzC,eAAe,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MAC/C,SAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA;AAAA,MAGzC,cAAS,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,MACzC,oBAAe,MAAM,KAAK,OAAO,SAAS,KAAK;AAAA,IACjD;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -20,18 +20,120 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
CharacterCount: () => CharacterCount,
|
|
23
24
|
Dropcursor: () => Dropcursor,
|
|
24
25
|
Focus: () => Focus,
|
|
25
26
|
Gapcursor: () => Gapcursor,
|
|
27
|
+
History: () => History,
|
|
28
|
+
Placeholder: () => Placeholder,
|
|
26
29
|
Selection: () => Selection,
|
|
27
30
|
TrailingNode: () => TrailingNode
|
|
28
31
|
});
|
|
29
32
|
module.exports = __toCommonJS(index_exports);
|
|
30
33
|
|
|
31
|
-
// src/
|
|
34
|
+
// src/character-count/character-count.ts
|
|
32
35
|
var import_core = require("@tiptap/core");
|
|
36
|
+
var import_state = require("@tiptap/pm/state");
|
|
37
|
+
var CharacterCount = import_core.Extension.create({
|
|
38
|
+
name: "characterCount",
|
|
39
|
+
addOptions() {
|
|
40
|
+
return {
|
|
41
|
+
limit: null,
|
|
42
|
+
mode: "textSize",
|
|
43
|
+
textCounter: (text) => text.length,
|
|
44
|
+
wordCounter: (text) => text.split(" ").filter((word) => word !== "").length
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
addStorage() {
|
|
48
|
+
return {
|
|
49
|
+
characters: () => 0,
|
|
50
|
+
words: () => 0
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
onBeforeCreate() {
|
|
54
|
+
this.storage.characters = (options) => {
|
|
55
|
+
const node = (options == null ? void 0 : options.node) || this.editor.state.doc;
|
|
56
|
+
const mode = (options == null ? void 0 : options.mode) || this.options.mode;
|
|
57
|
+
if (mode === "textSize") {
|
|
58
|
+
const text = node.textBetween(0, node.content.size, void 0, " ");
|
|
59
|
+
return this.options.textCounter(text);
|
|
60
|
+
}
|
|
61
|
+
return node.nodeSize;
|
|
62
|
+
};
|
|
63
|
+
this.storage.words = (options) => {
|
|
64
|
+
const node = (options == null ? void 0 : options.node) || this.editor.state.doc;
|
|
65
|
+
const text = node.textBetween(0, node.content.size, " ", " ");
|
|
66
|
+
return this.options.wordCounter(text);
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
addProseMirrorPlugins() {
|
|
70
|
+
let initialEvaluationDone = false;
|
|
71
|
+
return [
|
|
72
|
+
new import_state.Plugin({
|
|
73
|
+
key: new import_state.PluginKey("characterCount"),
|
|
74
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
75
|
+
if (initialEvaluationDone) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const limit = this.options.limit;
|
|
79
|
+
if (limit === null || limit === void 0 || limit === 0) {
|
|
80
|
+
initialEvaluationDone = true;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const initialContentSize = this.storage.characters({ node: newState.doc });
|
|
84
|
+
if (initialContentSize > limit) {
|
|
85
|
+
const over = initialContentSize - limit;
|
|
86
|
+
const from = 0;
|
|
87
|
+
const to = over;
|
|
88
|
+
console.warn(
|
|
89
|
+
`[CharacterCount] Initial content exceeded limit of ${limit} characters. Content was automatically trimmed.`
|
|
90
|
+
);
|
|
91
|
+
const tr = newState.tr.deleteRange(from, to);
|
|
92
|
+
initialEvaluationDone = true;
|
|
93
|
+
return tr;
|
|
94
|
+
}
|
|
95
|
+
initialEvaluationDone = true;
|
|
96
|
+
},
|
|
97
|
+
filterTransaction: (transaction, state) => {
|
|
98
|
+
const limit = this.options.limit;
|
|
99
|
+
if (!transaction.docChanged || limit === 0 || limit === null || limit === void 0) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
const oldSize = this.storage.characters({ node: state.doc });
|
|
103
|
+
const newSize = this.storage.characters({ node: transaction.doc });
|
|
104
|
+
if (newSize <= limit) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
if (oldSize > limit && newSize > limit && newSize <= oldSize) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (oldSize > limit && newSize > limit && newSize > oldSize) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const isPaste = transaction.getMeta("paste");
|
|
114
|
+
if (!isPaste) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const pos = transaction.selection.$head.pos;
|
|
118
|
+
const over = newSize - limit;
|
|
119
|
+
const from = pos - over;
|
|
120
|
+
const to = pos;
|
|
121
|
+
transaction.deleteRange(from, to);
|
|
122
|
+
const updatedSize = this.storage.characters({ node: transaction.doc });
|
|
123
|
+
if (updatedSize > limit) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/drop-cursor/drop-cursor.ts
|
|
134
|
+
var import_core2 = require("@tiptap/core");
|
|
33
135
|
var import_dropcursor = require("@tiptap/pm/dropcursor");
|
|
34
|
-
var Dropcursor =
|
|
136
|
+
var Dropcursor = import_core2.Extension.create({
|
|
35
137
|
name: "dropCursor",
|
|
36
138
|
addOptions() {
|
|
37
139
|
return {
|
|
@@ -46,10 +148,10 @@ var Dropcursor = import_core.Extension.create({
|
|
|
46
148
|
});
|
|
47
149
|
|
|
48
150
|
// src/focus/focus.ts
|
|
49
|
-
var
|
|
50
|
-
var
|
|
151
|
+
var import_core3 = require("@tiptap/core");
|
|
152
|
+
var import_state2 = require("@tiptap/pm/state");
|
|
51
153
|
var import_view = require("@tiptap/pm/view");
|
|
52
|
-
var Focus =
|
|
154
|
+
var Focus = import_core3.Extension.create({
|
|
53
155
|
name: "focus",
|
|
54
156
|
addOptions() {
|
|
55
157
|
return {
|
|
@@ -59,8 +161,8 @@ var Focus = import_core2.Extension.create({
|
|
|
59
161
|
},
|
|
60
162
|
addProseMirrorPlugins() {
|
|
61
163
|
return [
|
|
62
|
-
new
|
|
63
|
-
key: new
|
|
164
|
+
new import_state2.Plugin({
|
|
165
|
+
key: new import_state2.PluginKey("focus"),
|
|
64
166
|
props: {
|
|
65
167
|
decorations: ({ doc, selection }) => {
|
|
66
168
|
const { isEditable, isFocused } = this.editor;
|
|
@@ -111,9 +213,9 @@ var Focus = import_core2.Extension.create({
|
|
|
111
213
|
});
|
|
112
214
|
|
|
113
215
|
// src/gap-cursor/gap-cursor.ts
|
|
114
|
-
var
|
|
216
|
+
var import_core4 = require("@tiptap/core");
|
|
115
217
|
var import_gapcursor = require("@tiptap/pm/gapcursor");
|
|
116
|
-
var Gapcursor =
|
|
218
|
+
var Gapcursor = import_core4.Extension.create({
|
|
117
219
|
name: "gapCursor",
|
|
118
220
|
addProseMirrorPlugins() {
|
|
119
221
|
return [(0, import_gapcursor.gapCursor)()];
|
|
@@ -126,16 +228,110 @@ var Gapcursor = import_core3.Extension.create({
|
|
|
126
228
|
storage: extension.storage
|
|
127
229
|
};
|
|
128
230
|
return {
|
|
129
|
-
allowGapCursor: (_a = (0,
|
|
231
|
+
allowGapCursor: (_a = (0, import_core4.callOrReturn)((0, import_core4.getExtensionField)(extension, "allowGapCursor", context))) != null ? _a : null
|
|
130
232
|
};
|
|
131
233
|
}
|
|
132
234
|
});
|
|
133
235
|
|
|
134
|
-
// src/
|
|
135
|
-
var
|
|
136
|
-
var
|
|
236
|
+
// src/history/history.ts
|
|
237
|
+
var import_core5 = require("@tiptap/core");
|
|
238
|
+
var import_history = require("@tiptap/pm/history");
|
|
239
|
+
var History = import_core5.Extension.create({
|
|
240
|
+
name: "history",
|
|
241
|
+
addOptions() {
|
|
242
|
+
return {
|
|
243
|
+
depth: 100,
|
|
244
|
+
newGroupDelay: 500
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
addCommands() {
|
|
248
|
+
return {
|
|
249
|
+
undo: () => ({ state, dispatch }) => {
|
|
250
|
+
return (0, import_history.undo)(state, dispatch);
|
|
251
|
+
},
|
|
252
|
+
redo: () => ({ state, dispatch }) => {
|
|
253
|
+
return (0, import_history.redo)(state, dispatch);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
addProseMirrorPlugins() {
|
|
258
|
+
return [(0, import_history.history)(this.options)];
|
|
259
|
+
},
|
|
260
|
+
addKeyboardShortcuts() {
|
|
261
|
+
return {
|
|
262
|
+
"Mod-z": () => this.editor.commands.undo(),
|
|
263
|
+
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
264
|
+
"Mod-y": () => this.editor.commands.redo(),
|
|
265
|
+
// Russian keyboard layouts
|
|
266
|
+
"Mod-\u044F": () => this.editor.commands.undo(),
|
|
267
|
+
"Shift-Mod-\u044F": () => this.editor.commands.redo()
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// src/placeholder/placeholder.ts
|
|
273
|
+
var import_core6 = require("@tiptap/core");
|
|
274
|
+
var import_state3 = require("@tiptap/pm/state");
|
|
137
275
|
var import_view2 = require("@tiptap/pm/view");
|
|
138
|
-
var
|
|
276
|
+
var Placeholder = import_core6.Extension.create({
|
|
277
|
+
name: "placeholder",
|
|
278
|
+
addOptions() {
|
|
279
|
+
return {
|
|
280
|
+
emptyEditorClass: "is-editor-empty",
|
|
281
|
+
emptyNodeClass: "is-empty",
|
|
282
|
+
placeholder: "Write something \u2026",
|
|
283
|
+
showOnlyWhenEditable: true,
|
|
284
|
+
showOnlyCurrent: true,
|
|
285
|
+
includeChildren: false
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
addProseMirrorPlugins() {
|
|
289
|
+
return [
|
|
290
|
+
new import_state3.Plugin({
|
|
291
|
+
key: new import_state3.PluginKey("placeholder"),
|
|
292
|
+
props: {
|
|
293
|
+
decorations: ({ doc, selection }) => {
|
|
294
|
+
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
295
|
+
const { anchor } = selection;
|
|
296
|
+
const decorations = [];
|
|
297
|
+
if (!active) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
const isEmptyDoc = this.editor.isEmpty;
|
|
301
|
+
doc.descendants((node, pos) => {
|
|
302
|
+
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
303
|
+
const isEmpty = !node.isLeaf && (0, import_core6.isNodeEmpty)(node);
|
|
304
|
+
if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
|
|
305
|
+
const classes = [this.options.emptyNodeClass];
|
|
306
|
+
if (isEmptyDoc) {
|
|
307
|
+
classes.push(this.options.emptyEditorClass);
|
|
308
|
+
}
|
|
309
|
+
const decoration = import_view2.Decoration.node(pos, pos + node.nodeSize, {
|
|
310
|
+
class: classes.join(" "),
|
|
311
|
+
"data-placeholder": typeof this.options.placeholder === "function" ? this.options.placeholder({
|
|
312
|
+
editor: this.editor,
|
|
313
|
+
node,
|
|
314
|
+
pos,
|
|
315
|
+
hasAnchor
|
|
316
|
+
}) : this.options.placeholder
|
|
317
|
+
});
|
|
318
|
+
decorations.push(decoration);
|
|
319
|
+
}
|
|
320
|
+
return this.options.includeChildren;
|
|
321
|
+
});
|
|
322
|
+
return import_view2.DecorationSet.create(doc, decorations);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// src/selection/selection.ts
|
|
331
|
+
var import_core7 = require("@tiptap/core");
|
|
332
|
+
var import_state4 = require("@tiptap/pm/state");
|
|
333
|
+
var import_view3 = require("@tiptap/pm/view");
|
|
334
|
+
var Selection = import_core7.Extension.create({
|
|
139
335
|
name: "selection",
|
|
140
336
|
addOptions() {
|
|
141
337
|
return {
|
|
@@ -145,15 +341,15 @@ var Selection = import_core4.Extension.create({
|
|
|
145
341
|
addProseMirrorPlugins() {
|
|
146
342
|
const { editor, options } = this;
|
|
147
343
|
return [
|
|
148
|
-
new
|
|
149
|
-
key: new
|
|
344
|
+
new import_state4.Plugin({
|
|
345
|
+
key: new import_state4.PluginKey("selection"),
|
|
150
346
|
props: {
|
|
151
347
|
decorations(state) {
|
|
152
348
|
if (state.selection.empty || editor.isFocused) {
|
|
153
349
|
return null;
|
|
154
350
|
}
|
|
155
|
-
return
|
|
156
|
-
|
|
351
|
+
return import_view3.DecorationSet.create(state.doc, [
|
|
352
|
+
import_view3.Decoration.inline(state.selection.from, state.selection.to, {
|
|
157
353
|
class: options.className
|
|
158
354
|
})
|
|
159
355
|
]);
|
|
@@ -165,12 +361,12 @@ var Selection = import_core4.Extension.create({
|
|
|
165
361
|
});
|
|
166
362
|
|
|
167
363
|
// src/trailing-node/trailing-node.ts
|
|
168
|
-
var
|
|
169
|
-
var
|
|
364
|
+
var import_core8 = require("@tiptap/core");
|
|
365
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
170
366
|
function nodeEqualsType({ types, node }) {
|
|
171
367
|
return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;
|
|
172
368
|
}
|
|
173
|
-
var TrailingNode =
|
|
369
|
+
var TrailingNode = import_core8.Extension.create({
|
|
174
370
|
name: "trailingNode",
|
|
175
371
|
addOptions() {
|
|
176
372
|
return {
|
|
@@ -179,10 +375,10 @@ var TrailingNode = import_core5.Extension.create({
|
|
|
179
375
|
};
|
|
180
376
|
},
|
|
181
377
|
addProseMirrorPlugins() {
|
|
182
|
-
const plugin = new
|
|
378
|
+
const plugin = new import_state5.PluginKey(this.name);
|
|
183
379
|
const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => (this.options.notAfter || []).concat(this.options.node).includes(node.name));
|
|
184
380
|
return [
|
|
185
|
-
new
|
|
381
|
+
new import_state5.Plugin({
|
|
186
382
|
key: plugin,
|
|
187
383
|
appendTransaction: (_, __, state) => {
|
|
188
384
|
const { doc, tr, schema } = state;
|
|
@@ -213,9 +409,12 @@ var TrailingNode = import_core5.Extension.create({
|
|
|
213
409
|
});
|
|
214
410
|
// Annotate the CommonJS export names for ESM import in node:
|
|
215
411
|
0 && (module.exports = {
|
|
412
|
+
CharacterCount,
|
|
216
413
|
Dropcursor,
|
|
217
414
|
Focus,
|
|
218
415
|
Gapcursor,
|
|
416
|
+
History,
|
|
417
|
+
Placeholder,
|
|
219
418
|
Selection,
|
|
220
419
|
TrailingNode
|
|
221
420
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/drop-cursor/drop-cursor.ts","../src/focus/focus.ts","../src/gap-cursor/gap-cursor.ts","../src/selection/selection.ts","../src/trailing-node/trailing-node.ts"],"sourcesContent":["export * from './drop-cursor/index.js'\nexport * from './focus/index.js'\nexport * from './gap-cursor/index.js'\nexport * from './selection/index.js'\nexport * from './trailing-node/index.js'\n","import { Extension } from '@tiptap/core'\nimport { dropCursor } from '@tiptap/pm/dropcursor'\n\nexport interface DropcursorOptions {\n /**\n * The color of the drop cursor\n * @default 'currentColor'\n * @example 'red'\n */\n color: string | undefined\n\n /**\n * The width of the drop cursor\n * @default 1\n * @example 2\n */\n width: number | undefined\n\n /**\n * The class of the drop cursor\n * @default undefined\n * @example 'drop-cursor'\n */\n class: string | undefined\n}\n\n/**\n * This extension allows you to add a drop cursor to your editor.\n * A drop cursor is a line that appears when you drag and drop content\n * in-between nodes.\n * @see https://tiptap.dev/api/extensions/dropcursor\n */\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n addOptions() {\n return {\n color: 'currentColor',\n width: 1,\n class: undefined,\n }\n },\n\n addProseMirrorPlugins() {\n return [dropCursor(this.options)]\n },\n})\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","import { callOrReturn, Extension, getExtensionField, ParentConfig } 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","import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport type SelectionOptions = {\n /**\n * The class name that should be added to the selected text.\n * @default 'selection'\n * @example 'is-selected'\n */\n className: string\n}\n\n/**\n * This extension allows you to add a class to the selected text.\n * @see https://www.tiptap.dev/api/extensions/selection\n */\nexport const Selection = Extension.create({\n name: 'selection',\n\n addOptions() {\n return {\n className: 'selection',\n }\n },\n\n addProseMirrorPlugins() {\n const { editor, options } = this\n\n return [\n new Plugin({\n key: new PluginKey('selection'),\n props: {\n decorations(state) {\n if (state.selection.empty || editor.isFocused) {\n return null\n }\n\n return DecorationSet.create(state.doc, [\n Decoration.inline(state.selection.from, state.selection.to, {\n class: options.className,\n }),\n ])\n },\n },\n }),\n ]\n },\n})\n\nexport default Selection\n","import { Extension } from '@tiptap/core'\nimport { Node, NodeType } from '@tiptap/pm/model'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\n\nfunction nodeEqualsType({ types, node }: { types: NodeType | NodeType[]; node: Node | null | undefined }) {\n return (node && Array.isArray(types) && types.includes(node.type)) || node?.type === types\n}\n\n/**\n * Extension based on:\n * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js\n * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts\n */\n\nexport interface TrailingNodeOptions {\n /**\n * The node type that should be inserted at the end of the document.\n * @note the node will always be added to the `notAfter` lists to\n * prevent an infinite loop.\n * @default 'paragraph'\n */\n node: string\n /**\n * The node types after which the trailing node should not be inserted.\n * @default ['paragraph']\n */\n notAfter?: string | string[]\n}\n\n/**\n * This extension allows you to add an extra node at the end of the document.\n * @see https://www.tiptap.dev/api/extensions/trailing-node\n */\nexport const TrailingNode = Extension.create<TrailingNodeOptions>({\n name: 'trailingNode',\n\n addOptions() {\n return {\n node: 'paragraph',\n notAfter: [],\n }\n },\n\n addProseMirrorPlugins() {\n const plugin = new PluginKey(this.name)\n const disabledNodes = Object.entries(this.editor.schema.nodes)\n .map(([, value]) => value)\n .filter(node => (this.options.notAfter || []).concat(this.options.node).includes(node.name))\n\n return [\n new Plugin({\n key: plugin,\n appendTransaction: (_, __, state) => {\n const { doc, tr, schema } = state\n const shouldInsertNodeAtEnd = plugin.getState(state)\n const endPosition = doc.content.size\n const type = schema.nodes[this.options.node]\n\n if (!shouldInsertNodeAtEnd) {\n return\n }\n\n return tr.insert(endPosition, type.create())\n },\n state: {\n init: (_, state) => {\n const lastNode = state.tr.doc.lastChild\n\n return !nodeEqualsType({ node: lastNode, types: disabledNodes })\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value\n }\n\n const lastNode = tr.doc.lastChild\n\n return !nodeEqualsType({ node: lastNode, types: disabledNodes })\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA0B;AAC1B,wBAA2B;AA+BpB,IAAM,aAAa,sBAAU,OAA0B;AAAA,EAC5D,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,w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,mBAAO,CAAC,eAAe,EAAE,MAAM,UAAU,OAAO,cAAc,CAAC;AAAA,UACjE;AAAA,UACA,OAAO,CAAC,IAAI,UAAU;AACpB,gBAAI,CAAC,GAAG,YAAY;AAClB,qBAAO;AAAA,YACT;AAEA,kBAAM,WAAW,GAAG,IAAI;AAExB,mBAAO,CAAC,eAAe,EAAE,MAAM,UAAU,OAAO,cAAc,CAAC;AAAA,UACjE;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":["import_core","import_core","import_core","import_state","import_view","import_core","import_state"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/character-count/character-count.ts","../src/drop-cursor/drop-cursor.ts","../src/focus/focus.ts","../src/gap-cursor/gap-cursor.ts","../src/history/history.ts","../src/placeholder/placeholder.ts","../src/selection/selection.ts","../src/trailing-node/trailing-node.ts"],"sourcesContent":["export * from './character-count/index.js'\nexport * from './drop-cursor/index.js'\nexport * from './focus/index.js'\nexport * from './gap-cursor/index.js'\nexport * from './history/index.js'\nexport * from './placeholder/index.js'\nexport * from './selection/index.js'\nexport * from './trailing-node/index.js'\n","import { Extension } from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\n\nexport interface CharacterCountOptions {\n /**\n * The maximum number of characters that should be allowed. Defaults to `0`.\n * @default null\n * @example 180\n */\n limit: number | null | undefined\n /**\n * The mode by which the size is calculated. If set to `textSize`, the textContent of the document is used.\n * If set to `nodeSize`, the nodeSize of the document is used.\n * @default 'textSize'\n * @example 'textSize'\n */\n mode: 'textSize' | 'nodeSize'\n /**\n * The text counter function to use. Defaults to a simple character count.\n * @default (text) => text.length\n * @example (text) => [...new Intl.Segmenter().segment(text)].length\n */\n textCounter: (text: string) => number\n /**\n * The word counter function to use. Defaults to a simple word count.\n * @default (text) => text.split(' ').filter(word => word !== '').length\n * @example (text) => text.split(/\\s+/).filter(word => word !== '').length\n */\n wordCounter: (text: string) => number\n}\n\nexport interface CharacterCountStorage {\n /**\n * Get the number of characters for the current document.\n * @param options The options for the character count. (optional)\n * @param options.node The node to get the characters from. Defaults to the current document.\n * @param options.mode The mode by which the size is calculated. If set to `textSize`, the textContent of the document is used.\n */\n characters: (options?: { node?: ProseMirrorNode; mode?: 'textSize' | 'nodeSize' }) => number\n\n /**\n * Get the number of words for the current document.\n * @param options The options for the character count. (optional)\n * @param options.node The node to get the words from. Defaults to the current document.\n */\n words: (options?: { node?: ProseMirrorNode }) => number\n}\n\ndeclare module '@tiptap/core' {\n interface Storage {\n characterCount: CharacterCountStorage\n }\n}\n\n/**\n * This extension allows you to count the characters and words of your document.\n * @see https://tiptap.dev/api/extensions/character-count\n */\nexport const CharacterCount = Extension.create<CharacterCountOptions, CharacterCountStorage>({\n name: 'characterCount',\n\n addOptions() {\n return {\n limit: null,\n mode: 'textSize',\n textCounter: text => text.length,\n wordCounter: text => text.split(' ').filter(word => word !== '').length,\n }\n },\n\n addStorage() {\n return {\n characters: () => 0,\n words: () => 0,\n }\n },\n\n onBeforeCreate() {\n this.storage.characters = options => {\n const node = options?.node || this.editor.state.doc\n const mode = options?.mode || this.options.mode\n\n if (mode === 'textSize') {\n const text = node.textBetween(0, node.content.size, undefined, ' ')\n\n return this.options.textCounter(text)\n }\n\n return node.nodeSize\n }\n\n this.storage.words = options => {\n const node = options?.node || this.editor.state.doc\n const text = node.textBetween(0, node.content.size, ' ', ' ')\n\n return this.options.wordCounter(text)\n }\n },\n\n addProseMirrorPlugins() {\n let initialEvaluationDone = false\n\n return [\n new Plugin({\n key: new PluginKey('characterCount'),\n appendTransaction: (transactions, oldState, newState) => {\n if (initialEvaluationDone) {\n return\n }\n\n const limit = this.options.limit\n\n if (limit === null || limit === undefined || limit === 0) {\n initialEvaluationDone = true\n return\n }\n\n const initialContentSize = this.storage.characters({ node: newState.doc })\n\n if (initialContentSize > limit) {\n const over = initialContentSize - limit\n const from = 0\n const to = over\n\n console.warn(\n `[CharacterCount] Initial content exceeded limit of ${limit} characters. Content was automatically trimmed.`,\n )\n const tr = newState.tr.deleteRange(from, to)\n\n initialEvaluationDone = true\n return tr\n }\n\n initialEvaluationDone = true\n },\n filterTransaction: (transaction, state) => {\n const limit = this.options.limit\n\n // Nothing has changed or no limit is defined. Ignore it.\n if (!transaction.docChanged || limit === 0 || limit === null || limit === undefined) {\n return true\n }\n\n const oldSize = this.storage.characters({ node: state.doc })\n const newSize = this.storage.characters({ node: transaction.doc })\n\n // Everything is in the limit. Good.\n if (newSize <= limit) {\n return true\n }\n\n // The limit has already been exceeded but will be reduced.\n if (oldSize > limit && newSize > limit && newSize <= oldSize) {\n return true\n }\n\n // The limit has already been exceeded and will be increased further.\n if (oldSize > limit && newSize > limit && newSize > oldSize) {\n return false\n }\n\n const isPaste = transaction.getMeta('paste')\n\n // Block all exceeding transactions that were not pasted.\n if (!isPaste) {\n return false\n }\n\n // For pasted content, we try to remove the exceeding content.\n const pos = transaction.selection.$head.pos\n const over = newSize - limit\n const from = pos - over\n const to = pos\n\n // It’s probably a bad idea to mutate transactions within `filterTransaction`\n // but for now this is working fine.\n transaction.deleteRange(from, to)\n\n // In some situations, the limit will continue to be exceeded after trimming.\n // This happens e.g. when truncating within a complex node (e.g. table)\n // and ProseMirror has to close this node again.\n // If this is the case, we prevent the transaction completely.\n const updatedSize = this.storage.characters({ node: transaction.doc })\n\n if (updatedSize > limit) {\n return false\n }\n\n return true\n },\n }),\n ]\n },\n})\n","import { Extension } from '@tiptap/core'\nimport { dropCursor } from '@tiptap/pm/dropcursor'\n\nexport interface DropcursorOptions {\n /**\n * The color of the drop cursor\n * @default 'currentColor'\n * @example 'red'\n */\n color: string | undefined\n\n /**\n * The width of the drop cursor\n * @default 1\n * @example 2\n */\n width: number | undefined\n\n /**\n * The class of the drop cursor\n * @default undefined\n * @example 'drop-cursor'\n */\n class: string | undefined\n}\n\n/**\n * This extension allows you to add a drop cursor to your editor.\n * A drop cursor is a line that appears when you drag and drop content\n * in-between nodes.\n * @see https://tiptap.dev/api/extensions/dropcursor\n */\nexport const Dropcursor = Extension.create<DropcursorOptions>({\n name: 'dropCursor',\n\n addOptions() {\n return {\n color: 'currentColor',\n width: 1,\n class: undefined,\n }\n },\n\n addProseMirrorPlugins() {\n return [dropCursor(this.options)]\n },\n})\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","import { callOrReturn, Extension, getExtensionField, ParentConfig } 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","import { Extension } from '@tiptap/core'\nimport { history, redo, undo } from '@tiptap/pm/history'\n\nexport interface HistoryOptions {\n /**\n * The amount of history events that are collected before the oldest events are discarded.\n * @default 100\n * @example 50\n */\n depth: number\n\n /**\n * The delay (in milliseconds) between changes after which a new group should be started.\n * @default 500\n * @example 1000\n */\n newGroupDelay: number\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n history: {\n /**\n * Undo recent changes\n * @example editor.commands.undo()\n */\n undo: () => ReturnType\n /**\n * Reapply reverted changes\n * @example editor.commands.redo()\n */\n redo: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to undo and redo recent changes.\n * @see https://www.tiptap.dev/api/extensions/history\n *\n * **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove\n * the `history` extension, as it is not compatible with the `collaboration` extension.\n *\n * `@tiptap/extension-collaboration` uses its own history implementation.\n */\nexport const History = Extension.create<HistoryOptions>({\n name: 'history',\n\n addOptions() {\n return {\n depth: 100,\n newGroupDelay: 500,\n }\n },\n\n addCommands() {\n return {\n undo:\n () =>\n ({ state, dispatch }) => {\n return undo(state, dispatch)\n },\n redo:\n () =>\n ({ state, dispatch }) => {\n return redo(state, dispatch)\n },\n }\n },\n\n addProseMirrorPlugins() {\n return [history(this.options)]\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-z': () => this.editor.commands.undo(),\n 'Shift-Mod-z': () => this.editor.commands.redo(),\n 'Mod-y': () => this.editor.commands.redo(),\n\n // Russian keyboard layouts\n 'Mod-я': () => this.editor.commands.undo(),\n 'Shift-Mod-я': () => this.editor.commands.redo(),\n }\n },\n})\n","import { Editor, Extension, isNodeEmpty } from '@tiptap/core'\nimport { Node as ProsemirrorNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport interface PlaceholderOptions {\n /**\n * **The class name for the empty editor**\n * @default 'is-editor-empty'\n */\n emptyEditorClass: string\n\n /**\n * **The class name for empty nodes**\n * @default 'is-empty'\n */\n emptyNodeClass: string\n\n /**\n * **The placeholder content**\n *\n * You can use a function to return a dynamic placeholder or a string.\n * @default 'Write something …'\n */\n placeholder:\n | ((PlaceholderProps: { editor: Editor; node: ProsemirrorNode; pos: number; hasAnchor: boolean }) => string)\n | string\n\n /**\n * **Checks if the placeholder should be only shown when the editor is editable.**\n *\n * If true, the placeholder will only be shown when the editor is editable.\n * If false, the placeholder will always be shown.\n * @default true\n */\n showOnlyWhenEditable: boolean\n\n /**\n * **Checks if the placeholder should be only shown when the current node is empty.**\n *\n * If true, the placeholder will only be shown when the current node is empty.\n * If false, the placeholder will be shown when any node is empty.\n * @default true\n */\n showOnlyCurrent: boolean\n\n /**\n * **Controls if the placeholder should be shown for all descendents.**\n *\n * If true, the placeholder will be shown for all descendents.\n * If false, the placeholder will only be shown for the current node.\n * @default false\n */\n includeChildren: boolean\n}\n\n/**\n * This extension allows you to add a placeholder to your editor.\n * A placeholder is a text that appears when the editor or a node is empty.\n * @see https://www.tiptap.dev/api/extensions/placeholder\n */\nexport const Placeholder = Extension.create<PlaceholderOptions>({\n name: 'placeholder',\n\n addOptions() {\n return {\n emptyEditorClass: 'is-editor-empty',\n emptyNodeClass: 'is-empty',\n placeholder: 'Write something …',\n showOnlyWhenEditable: true,\n showOnlyCurrent: true,\n includeChildren: false,\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('placeholder'),\n props: {\n decorations: ({ doc, selection }) => {\n const active = this.editor.isEditable || !this.options.showOnlyWhenEditable\n const { anchor } = selection\n const decorations: Decoration[] = []\n\n if (!active) {\n return null\n }\n\n const isEmptyDoc = this.editor.isEmpty\n\n doc.descendants((node, pos) => {\n const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize\n const isEmpty = !node.isLeaf && isNodeEmpty(node)\n\n if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {\n const classes = [this.options.emptyNodeClass]\n\n if (isEmptyDoc) {\n classes.push(this.options.emptyEditorClass)\n }\n\n const decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: classes.join(' '),\n 'data-placeholder':\n typeof this.options.placeholder === 'function'\n ? this.options.placeholder({\n editor: this.editor,\n node,\n pos,\n hasAnchor,\n })\n : this.options.placeholder,\n })\n\n decorations.push(decoration)\n }\n\n return this.options.includeChildren\n })\n\n return DecorationSet.create(doc, decorations)\n },\n },\n }),\n ]\n },\n})\n","import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport type SelectionOptions = {\n /**\n * The class name that should be added to the selected text.\n * @default 'selection'\n * @example 'is-selected'\n */\n className: string\n}\n\n/**\n * This extension allows you to add a class to the selected text.\n * @see https://www.tiptap.dev/api/extensions/selection\n */\nexport const Selection = Extension.create({\n name: 'selection',\n\n addOptions() {\n return {\n className: 'selection',\n }\n },\n\n addProseMirrorPlugins() {\n const { editor, options } = this\n\n return [\n new Plugin({\n key: new PluginKey('selection'),\n props: {\n decorations(state) {\n if (state.selection.empty || editor.isFocused) {\n return null\n }\n\n return DecorationSet.create(state.doc, [\n Decoration.inline(state.selection.from, state.selection.to, {\n class: options.className,\n }),\n ])\n },\n },\n }),\n ]\n },\n})\n\nexport default Selection\n","import { Extension } from '@tiptap/core'\nimport { Node, NodeType } from '@tiptap/pm/model'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\n\nfunction nodeEqualsType({ types, node }: { types: NodeType | NodeType[]; node: Node | null | undefined }) {\n return (node && Array.isArray(types) && types.includes(node.type)) || node?.type === types\n}\n\n/**\n * Extension based on:\n * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js\n * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts\n */\n\nexport interface TrailingNodeOptions {\n /**\n * The node type that should be inserted at the end of the document.\n * @note the node will always be added to the `notAfter` lists to\n * prevent an infinite loop.\n * @default 'paragraph'\n */\n node: string\n /**\n * The node types after which the trailing node should not be inserted.\n * @default ['paragraph']\n */\n notAfter?: string | string[]\n}\n\n/**\n * This extension allows you to add an extra node at the end of the document.\n * @see https://www.tiptap.dev/api/extensions/trailing-node\n */\nexport const TrailingNode = Extension.create<TrailingNodeOptions>({\n name: 'trailingNode',\n\n addOptions() {\n return {\n node: 'paragraph',\n notAfter: [],\n }\n },\n\n addProseMirrorPlugins() {\n const plugin = new PluginKey(this.name)\n const disabledNodes = Object.entries(this.editor.schema.nodes)\n .map(([, value]) => value)\n .filter(node => (this.options.notAfter || []).concat(this.options.node).includes(node.name))\n\n return [\n new Plugin({\n key: plugin,\n appendTransaction: (_, __, state) => {\n const { doc, tr, schema } = state\n const shouldInsertNodeAtEnd = plugin.getState(state)\n const endPosition = doc.content.size\n const type = schema.nodes[this.options.node]\n\n if (!shouldInsertNodeAtEnd) {\n return\n }\n\n return tr.insert(endPosition, type.create())\n },\n state: {\n init: (_, state) => {\n const lastNode = state.tr.doc.lastChild\n\n return !nodeEqualsType({ node: lastNode, types: disabledNodes })\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value\n }\n\n const lastNode = tr.doc.lastChild\n\n return !nodeEqualsType({ node: lastNode, types: disabledNodes })\n },\n },\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA0B;AAE1B,mBAAkC;AAyD3B,IAAM,iBAAiB,sBAAU,OAAqD;AAAA,EAC3F,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,aAAa,UAAQ,KAAK;AAAA,MAC1B,aAAa,UAAQ,KAAK,MAAM,GAAG,EAAE,OAAO,UAAQ,SAAS,EAAE,EAAE;AAAA,IACnE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,WAAO;AAAA,MACL,YAAY,MAAM;AAAA,MAClB,OAAO,MAAM;AAAA,IACf;AAAA,EACF;AAAA,EAEA,iBAAiB;AACf,SAAK,QAAQ,aAAa,aAAW;AACnC,YAAM,QAAO,mCAAS,SAAQ,KAAK,OAAO,MAAM;AAChD,YAAM,QAAO,mCAAS,SAAQ,KAAK,QAAQ;AAE3C,UAAI,SAAS,YAAY;AACvB,cAAM,OAAO,KAAK,YAAY,GAAG,KAAK,QAAQ,MAAM,QAAW,GAAG;AAElE,eAAO,K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1D,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM,KAAK,EACxB,OAAO,WAAS,KAAK,QAAQ,YAAY,CAAC,GAAG,OAAO,KAAK,QAAQ,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;AAE7F,WAAO;AAAA,MACL,IAAI,qBAAO;AAAA,QACT,KAAK;AAAA,QACL,mBAAmB,CAAC,GAAG,IAAI,UAAU;AACnC,gBAAM,EAAE,KAAK,IAAI,OAAO,IAAI;AAC5B,gBAAM,wBAAwB,OAAO,SAAS,KAAK;AACnD,gBAAM,cAAc,IAAI,QAAQ;AAChC,gBAAM,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI;AAE3C,cAAI,CAAC,uBAAuB;AAC1B;AAAA,UACF;AAEA,iBAAO,GAAG,OAAO,aAAa,KAAK,OAAO,CAAC;AAAA,QAC7C;AAAA,QACA,OAAO;AAAA,UACL,MAAM,CAAC,GAAG,UAAU;AAClB,kBAAM,WAAW,MAAM,GAAG,IAAI;AAE9B,mBAAO,CAAC,eAAe,EAAE,MAAM,UAAU,OAAO,cAAc,CAAC;AAAA,UACjE;AAAA,UACA,OAAO,CAAC,IAAI,UAAU;AACpB,gBAAI,CAAC,GAAG,YAAY;AAClB,qBAAO;AAAA,YACT;AAEA,kBAAM,WAAW,GAAG,IAAI;AAExB,mBAAO,CAAC,eAAe,EAAE,MAAM,UAAU,OAAO,cAAc,CAAC;AAAA,UACjE;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":["import_core","import_core","import_state","import_core","import_core","import_core","import_state","import_view","import_core","import_state","import_view","import_core","import_state"]}
|