neuphlo-editor 1.8.2 → 2.0.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/dist/chunk-2DWEJI45.js +1296 -0
- package/dist/chunk-2DWEJI45.js.map +1 -0
- package/dist/chunk-457ETWB6.js +1351 -0
- package/dist/chunk-457ETWB6.js.map +1 -0
- package/dist/chunk-62DYB7FY.js +1305 -0
- package/dist/chunk-62DYB7FY.js.map +1 -0
- package/dist/chunk-DWGPGRTQ.js +1302 -0
- package/dist/chunk-DWGPGRTQ.js.map +1 -0
- package/dist/chunk-EG7NQJRA.js +1324 -0
- package/dist/chunk-EG7NQJRA.js.map +1 -0
- package/dist/chunk-FLLPFFI5.js +1296 -0
- package/dist/chunk-FLLPFFI5.js.map +1 -0
- package/dist/chunk-FVQHB6VC.js +1128 -0
- package/dist/chunk-FVQHB6VC.js.map +1 -0
- package/dist/chunk-GXJGZHKR.js +1326 -0
- package/dist/chunk-GXJGZHKR.js.map +1 -0
- package/dist/chunk-KCPPTLGY.js +1299 -0
- package/dist/chunk-KCPPTLGY.js.map +1 -0
- package/dist/chunk-LHG2NX6C.js +1123 -0
- package/dist/chunk-LHG2NX6C.js.map +1 -0
- package/dist/chunk-OCNM37WJ.js +1289 -0
- package/dist/chunk-OCNM37WJ.js.map +1 -0
- package/dist/chunk-RW6QBMJB.js +1300 -0
- package/dist/chunk-RW6QBMJB.js.map +1 -0
- package/dist/chunk-SOXTEP7H.js +6705 -0
- package/dist/chunk-SOXTEP7H.js.map +1 -0
- package/dist/headless/index.cjs +207 -144
- package/dist/headless/index.cjs.map +1 -1
- package/dist/headless/index.d.cts +9 -25
- package/dist/headless/index.d.ts +9 -25
- package/dist/headless/index.js +1 -1
- package/dist/react/index.cjs +1839 -723
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.css +364 -8
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.cts +10 -2
- package/dist/react/index.d.ts +10 -2
- package/dist/react/index.js +1434 -547
- package/dist/react/index.js.map +1 -1
- package/dist/styles.css +410 -8
- package/package.json +7 -2
|
@@ -0,0 +1,1326 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all2) => {
|
|
6
|
+
for (var name in all2)
|
|
7
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
|
|
19
|
+
// src/headless/index.ts
|
|
20
|
+
import { useCurrentEditor as useCurrentEditor4 } from "@tiptap/react";
|
|
21
|
+
|
|
22
|
+
// src/headless/components/editor.tsx
|
|
23
|
+
import { EditorProvider } from "@tiptap/react";
|
|
24
|
+
import { forwardRef } from "react";
|
|
25
|
+
import { Provider } from "jotai";
|
|
26
|
+
|
|
27
|
+
// src/headless/utils/store.ts
|
|
28
|
+
var store_exports = {};
|
|
29
|
+
__export(store_exports, {
|
|
30
|
+
novelStore: () => novelStore
|
|
31
|
+
});
|
|
32
|
+
__reExport(store_exports, jotai_star);
|
|
33
|
+
import { createStore } from "jotai";
|
|
34
|
+
import * as jotai_star from "jotai";
|
|
35
|
+
var novelStore = createStore();
|
|
36
|
+
|
|
37
|
+
// src/headless/components/editor.tsx
|
|
38
|
+
import { jsx } from "react/jsx-runtime";
|
|
39
|
+
var EditorRoot = ({ children }) => {
|
|
40
|
+
return /* @__PURE__ */ jsx(Provider, { store: novelStore, children });
|
|
41
|
+
};
|
|
42
|
+
var EditorContent = forwardRef(
|
|
43
|
+
({ className, children, initialContent, content, ...rest }, ref) => {
|
|
44
|
+
const effectiveContent = content ?? initialContent;
|
|
45
|
+
return /* @__PURE__ */ jsx("div", { ref, className, children: /* @__PURE__ */ jsx(EditorProvider, { ...rest, content: effectiveContent, children }) });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
EditorContent.displayName = "EditorContent";
|
|
49
|
+
|
|
50
|
+
// src/headless/components/editor-bubble.tsx
|
|
51
|
+
import { useCurrentEditor } from "@tiptap/react";
|
|
52
|
+
import { BubbleMenu as BubbleMenuReact } from "@tiptap/react/menus";
|
|
53
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
54
|
+
function EditorBubble({ className, children, ...rest }) {
|
|
55
|
+
const { editor } = useCurrentEditor();
|
|
56
|
+
if (!editor) return null;
|
|
57
|
+
return /* @__PURE__ */ jsx2(BubbleMenuReact, { editor, ...rest, children: /* @__PURE__ */ jsx2("div", { className, children }) });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/headless/components/editor-bubble-item.tsx
|
|
61
|
+
import { forwardRef as forwardRef2, isValidElement, cloneElement } from "react";
|
|
62
|
+
import { useCurrentEditor as useCurrentEditor2 } from "@tiptap/react";
|
|
63
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
64
|
+
var EditorBubbleItem = forwardRef2(({ children, asChild, onSelect, ...rest }, ref) => {
|
|
65
|
+
const { editor } = useCurrentEditor2();
|
|
66
|
+
if (!editor) return null;
|
|
67
|
+
const handleClick = (e) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
onSelect?.(editor);
|
|
70
|
+
};
|
|
71
|
+
if (asChild && isValidElement(children)) {
|
|
72
|
+
const child = children;
|
|
73
|
+
const childOnClick = child.props?.onClick;
|
|
74
|
+
const mergedOnClick = (e) => {
|
|
75
|
+
childOnClick?.(e);
|
|
76
|
+
if (!e?.defaultPrevented) onSelect?.(editor);
|
|
77
|
+
};
|
|
78
|
+
return cloneElement(child, {
|
|
79
|
+
...rest,
|
|
80
|
+
ref: child.ref ?? ref,
|
|
81
|
+
onClick: mergedOnClick
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ jsx3("div", { ref, ...rest, onClick: handleClick, children });
|
|
85
|
+
});
|
|
86
|
+
EditorBubbleItem.displayName = "EditorBubbleItem";
|
|
87
|
+
|
|
88
|
+
// src/headless/components/editor-command.tsx
|
|
89
|
+
import { useAtom, useSetAtom, useAtomValue } from "jotai";
|
|
90
|
+
import { atom as atom2 } from "jotai";
|
|
91
|
+
import { useEffect, forwardRef as forwardRef3, useState } from "react";
|
|
92
|
+
import { Command } from "cmdk";
|
|
93
|
+
|
|
94
|
+
// src/headless/utils/atoms.ts
|
|
95
|
+
import { atom } from "jotai";
|
|
96
|
+
var queryAtom = atom("");
|
|
97
|
+
var rangeAtom = atom(null);
|
|
98
|
+
var slashMenuOpenAtom = atom(false);
|
|
99
|
+
var slashMenuRectAtom = atom(null);
|
|
100
|
+
|
|
101
|
+
// src/headless/components/editor-command.tsx
|
|
102
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
103
|
+
var portalTargetAtom = atom2(null);
|
|
104
|
+
var EditorCommandOut = ({
|
|
105
|
+
query,
|
|
106
|
+
range
|
|
107
|
+
}) => {
|
|
108
|
+
const setQuery = useSetAtom(queryAtom, { store: novelStore });
|
|
109
|
+
const setRange = useSetAtom(rangeAtom, { store: novelStore });
|
|
110
|
+
const [target, setTarget] = useState(null);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
setQuery(query);
|
|
113
|
+
}, [query, setQuery]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
setRange(range);
|
|
116
|
+
}, [range, setRange]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
119
|
+
const onKeyDown = (e) => {
|
|
120
|
+
if (navigationKeys.includes(e.key)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
const commandRef = document.querySelector("#slash-command");
|
|
123
|
+
if (commandRef)
|
|
124
|
+
commandRef.dispatchEvent(
|
|
125
|
+
new KeyboardEvent("keydown", {
|
|
126
|
+
key: e.key,
|
|
127
|
+
cancelable: true,
|
|
128
|
+
bubbles: true
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
document.addEventListener("keydown", onKeyDown);
|
|
135
|
+
return () => {
|
|
136
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
137
|
+
};
|
|
138
|
+
}, []);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
const unsub = novelStore.sub(portalTargetAtom, () => {
|
|
141
|
+
setTarget(novelStore.get(portalTargetAtom));
|
|
142
|
+
});
|
|
143
|
+
setTarget(novelStore.get(portalTargetAtom));
|
|
144
|
+
return unsub;
|
|
145
|
+
}, []);
|
|
146
|
+
if (!target) return null;
|
|
147
|
+
return null;
|
|
148
|
+
};
|
|
149
|
+
var CommandAny = Command;
|
|
150
|
+
var EditorCommand = forwardRef3(
|
|
151
|
+
({ children, className, ...rest }, ref) => {
|
|
152
|
+
const [query, setQuery] = useAtom(queryAtom);
|
|
153
|
+
const portalTarget = useAtomValue(portalTargetAtom, { store: novelStore });
|
|
154
|
+
const setPortalTarget = useSetAtom(portalTargetAtom, { store: novelStore });
|
|
155
|
+
const [containerEl] = useState(() => {
|
|
156
|
+
if (typeof document !== "undefined") {
|
|
157
|
+
const el = document.createElement("div");
|
|
158
|
+
return el;
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
});
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (containerEl) {
|
|
164
|
+
setPortalTarget(containerEl);
|
|
165
|
+
return () => setPortalTarget(null);
|
|
166
|
+
}
|
|
167
|
+
}, [containerEl, setPortalTarget]);
|
|
168
|
+
return /* @__PURE__ */ jsxs(
|
|
169
|
+
CommandAny,
|
|
170
|
+
{
|
|
171
|
+
ref,
|
|
172
|
+
onKeyDown: (e) => {
|
|
173
|
+
e.stopPropagation();
|
|
174
|
+
},
|
|
175
|
+
id: "slash-command",
|
|
176
|
+
className,
|
|
177
|
+
...rest,
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ jsx4(
|
|
180
|
+
CommandAny.Input,
|
|
181
|
+
{
|
|
182
|
+
value: query,
|
|
183
|
+
onValueChange: setQuery,
|
|
184
|
+
style: { display: "none" }
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
children
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
var EditorCommandList = Command.List;
|
|
194
|
+
EditorCommand.displayName = "EditorCommand";
|
|
195
|
+
|
|
196
|
+
// src/headless/components/editor-command-item.tsx
|
|
197
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
198
|
+
import { CommandEmpty, CommandItem } from "cmdk";
|
|
199
|
+
import { useCurrentEditor as useCurrentEditor3 } from "@tiptap/react";
|
|
200
|
+
import { useAtomValue as useAtomValue2 } from "jotai";
|
|
201
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
202
|
+
var CommandItemAny = CommandItem;
|
|
203
|
+
var CommandEmptyAny = CommandEmpty;
|
|
204
|
+
var EditorCommandItem = forwardRef4(({ children, onCommand, ...rest }, ref) => {
|
|
205
|
+
const { editor } = useCurrentEditor3();
|
|
206
|
+
const range = useAtomValue2(rangeAtom);
|
|
207
|
+
if (!editor || !range) return null;
|
|
208
|
+
return /* @__PURE__ */ jsx5(
|
|
209
|
+
CommandItemAny,
|
|
210
|
+
{
|
|
211
|
+
ref,
|
|
212
|
+
...rest,
|
|
213
|
+
onSelect: () => onCommand({ editor, range }),
|
|
214
|
+
children
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
EditorCommandItem.displayName = "EditorCommandItem";
|
|
219
|
+
var EditorCommandEmpty = CommandEmptyAny;
|
|
220
|
+
|
|
221
|
+
// src/headless/extensions/index.ts
|
|
222
|
+
import { StarterKit } from "@tiptap/starter-kit";
|
|
223
|
+
import { Placeholder } from "@tiptap/extension-placeholder";
|
|
224
|
+
|
|
225
|
+
// src/headless/extensions/CodeBlock/CodeBlock.ts
|
|
226
|
+
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
227
|
+
import { all, createLowlight } from "lowlight";
|
|
228
|
+
var lowlight = createLowlight(all);
|
|
229
|
+
var CodeBlock = CodeBlockLowlight.configure({
|
|
230
|
+
lowlight
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// src/headless/extensions/Link/Link.ts
|
|
234
|
+
import { mergeAttributes } from "@tiptap/core";
|
|
235
|
+
import TiptapLink from "@tiptap/extension-link";
|
|
236
|
+
import { Plugin } from "@tiptap/pm/state";
|
|
237
|
+
var Link = TiptapLink.extend({
|
|
238
|
+
inclusive: false,
|
|
239
|
+
parseHTML() {
|
|
240
|
+
return [
|
|
241
|
+
{
|
|
242
|
+
tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
},
|
|
246
|
+
renderHTML({ HTMLAttributes }) {
|
|
247
|
+
return [
|
|
248
|
+
"a",
|
|
249
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
250
|
+
class: "link"
|
|
251
|
+
}),
|
|
252
|
+
0
|
|
253
|
+
];
|
|
254
|
+
},
|
|
255
|
+
addProseMirrorPlugins() {
|
|
256
|
+
const { editor } = this;
|
|
257
|
+
return [
|
|
258
|
+
...this.parent?.() || [],
|
|
259
|
+
new Plugin({
|
|
260
|
+
props: {
|
|
261
|
+
handleKeyDown: (view, event) => {
|
|
262
|
+
const { selection } = editor.state;
|
|
263
|
+
if (event.key === "Escape" && selection.empty !== true) {
|
|
264
|
+
editor.commands.focus(selection.to, { scrollIntoView: false });
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
}).configure({
|
|
273
|
+
openOnClick: false,
|
|
274
|
+
autolink: true,
|
|
275
|
+
enableClickSelection: true
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// src/headless/extensions/ImageBlock/ImageBlock.ts
|
|
279
|
+
import { mergeAttributes as mergeAttributes2 } from "@tiptap/core";
|
|
280
|
+
import { Image as TiptapImage } from "@tiptap/extension-image";
|
|
281
|
+
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
282
|
+
import { Plugin as Plugin2, PluginKey } from "@tiptap/pm/state";
|
|
283
|
+
var ImageBlock = TiptapImage.extend({
|
|
284
|
+
name: "imageBlock",
|
|
285
|
+
group: "block",
|
|
286
|
+
defining: true,
|
|
287
|
+
isolating: true,
|
|
288
|
+
addOptions() {
|
|
289
|
+
return {
|
|
290
|
+
...this.parent?.(),
|
|
291
|
+
uploadImage: void 0,
|
|
292
|
+
inline: false
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
addAttributes() {
|
|
296
|
+
return {
|
|
297
|
+
src: {
|
|
298
|
+
default: "",
|
|
299
|
+
parseHTML: (element) => element.getAttribute("src"),
|
|
300
|
+
renderHTML: (attributes) => ({
|
|
301
|
+
src: attributes.src
|
|
302
|
+
})
|
|
303
|
+
},
|
|
304
|
+
width: {
|
|
305
|
+
default: "100%",
|
|
306
|
+
parseHTML: (element) => element.getAttribute("data-width"),
|
|
307
|
+
renderHTML: (attributes) => ({
|
|
308
|
+
"data-width": attributes.width
|
|
309
|
+
})
|
|
310
|
+
},
|
|
311
|
+
align: {
|
|
312
|
+
default: "center",
|
|
313
|
+
parseHTML: (element) => element.getAttribute("data-align"),
|
|
314
|
+
renderHTML: (attributes) => ({
|
|
315
|
+
"data-align": attributes.align
|
|
316
|
+
})
|
|
317
|
+
},
|
|
318
|
+
alt: {
|
|
319
|
+
default: void 0,
|
|
320
|
+
parseHTML: (element) => element.getAttribute("alt"),
|
|
321
|
+
renderHTML: (attributes) => ({
|
|
322
|
+
alt: attributes.alt
|
|
323
|
+
})
|
|
324
|
+
},
|
|
325
|
+
loading: {
|
|
326
|
+
default: false,
|
|
327
|
+
parseHTML: () => false,
|
|
328
|
+
renderHTML: () => ({})
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
},
|
|
332
|
+
parseHTML() {
|
|
333
|
+
return [
|
|
334
|
+
{
|
|
335
|
+
tag: 'img[src]:not([src^="data:"])',
|
|
336
|
+
getAttrs: (element) => {
|
|
337
|
+
const el = element;
|
|
338
|
+
return {
|
|
339
|
+
src: el.getAttribute("src"),
|
|
340
|
+
alt: el.getAttribute("alt"),
|
|
341
|
+
width: el.getAttribute("data-width") || "100%",
|
|
342
|
+
align: el.getAttribute("data-align") || "center"
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
];
|
|
347
|
+
},
|
|
348
|
+
renderHTML({ HTMLAttributes }) {
|
|
349
|
+
return ["img", mergeAttributes2(HTMLAttributes)];
|
|
350
|
+
},
|
|
351
|
+
addCommands() {
|
|
352
|
+
return {
|
|
353
|
+
setImageBlock: (attrs) => ({ commands }) => {
|
|
354
|
+
return commands.insertContent({
|
|
355
|
+
type: "imageBlock",
|
|
356
|
+
attrs: { src: attrs.src }
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
setImageBlockAt: (attrs) => ({ commands }) => {
|
|
360
|
+
return commands.insertContentAt(attrs.pos, {
|
|
361
|
+
type: "imageBlock",
|
|
362
|
+
attrs: { src: attrs.src }
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
setImageBlockAlign: (align) => ({ commands }) => commands.updateAttributes("imageBlock", { align }),
|
|
366
|
+
setImageBlockWidth: (width) => ({ commands }) => commands.updateAttributes("imageBlock", {
|
|
367
|
+
width: `${Math.max(0, Math.min(100, width))}%`
|
|
368
|
+
})
|
|
369
|
+
};
|
|
370
|
+
},
|
|
371
|
+
addNodeView() {
|
|
372
|
+
if (this.options.nodeView) {
|
|
373
|
+
return ReactNodeViewRenderer(this.options.nodeView);
|
|
374
|
+
}
|
|
375
|
+
return null;
|
|
376
|
+
},
|
|
377
|
+
addProseMirrorPlugins() {
|
|
378
|
+
return [
|
|
379
|
+
new Plugin2({
|
|
380
|
+
key: new PluginKey("imageBlockDrop"),
|
|
381
|
+
props: {
|
|
382
|
+
handleDOMEvents: {
|
|
383
|
+
drop: (view, event) => {
|
|
384
|
+
const hasFiles = event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length;
|
|
385
|
+
if (!hasFiles) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
const images = Array.from(event.dataTransfer.files).filter(
|
|
389
|
+
(file) => /image/i.test(file.type)
|
|
390
|
+
);
|
|
391
|
+
if (images.length === 0) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
event.preventDefault();
|
|
395
|
+
const { schema } = view.state;
|
|
396
|
+
const coordinates = view.posAtCoords({
|
|
397
|
+
left: event.clientX,
|
|
398
|
+
top: event.clientY
|
|
399
|
+
});
|
|
400
|
+
if (!coordinates) return false;
|
|
401
|
+
images.forEach(async (image) => {
|
|
402
|
+
if (this.options.uploadImage) {
|
|
403
|
+
try {
|
|
404
|
+
const placeholderNode = schema.nodes.imageBlock.create({
|
|
405
|
+
src: "",
|
|
406
|
+
loading: true
|
|
407
|
+
});
|
|
408
|
+
const placeholderTr = view.state.tr.insert(
|
|
409
|
+
coordinates.pos,
|
|
410
|
+
placeholderNode
|
|
411
|
+
);
|
|
412
|
+
view.dispatch(placeholderTr);
|
|
413
|
+
const url = await this.options.uploadImage(image);
|
|
414
|
+
const node = schema.nodes.imageBlock.create({ src: url });
|
|
415
|
+
const currentState = view.state;
|
|
416
|
+
let foundPos = -1;
|
|
417
|
+
currentState.doc.descendants((node2, pos) => {
|
|
418
|
+
if (node2.type.name === "imageBlock" && node2.attrs.loading) {
|
|
419
|
+
foundPos = pos;
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
if (foundPos !== -1) {
|
|
424
|
+
const transaction = view.state.tr.replaceWith(
|
|
425
|
+
foundPos,
|
|
426
|
+
foundPos + 1,
|
|
427
|
+
node
|
|
428
|
+
);
|
|
429
|
+
view.dispatch(transaction);
|
|
430
|
+
}
|
|
431
|
+
} catch (error) {
|
|
432
|
+
console.error("Failed to upload image:", error);
|
|
433
|
+
const currentState = view.state;
|
|
434
|
+
let foundPos = -1;
|
|
435
|
+
currentState.doc.descendants((node, pos) => {
|
|
436
|
+
if (node.type.name === "imageBlock" && node.attrs.loading) {
|
|
437
|
+
foundPos = pos;
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
if (foundPos !== -1) {
|
|
442
|
+
const transaction = view.state.tr.delete(
|
|
443
|
+
foundPos,
|
|
444
|
+
foundPos + 1
|
|
445
|
+
);
|
|
446
|
+
view.dispatch(transaction);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
return true;
|
|
452
|
+
},
|
|
453
|
+
paste: (view, event) => {
|
|
454
|
+
const hasFiles = event.clipboardData && event.clipboardData.files && event.clipboardData.files.length;
|
|
455
|
+
if (!hasFiles) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
const images = Array.from(event.clipboardData.files).filter(
|
|
459
|
+
(file) => /image/i.test(file.type)
|
|
460
|
+
);
|
|
461
|
+
if (images.length === 0) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
event.preventDefault();
|
|
465
|
+
images.forEach(async (image) => {
|
|
466
|
+
if (this.options.uploadImage) {
|
|
467
|
+
try {
|
|
468
|
+
const placeholderNode = view.state.schema.nodes.imageBlock.create({
|
|
469
|
+
src: "",
|
|
470
|
+
loading: true
|
|
471
|
+
});
|
|
472
|
+
view.dispatch(
|
|
473
|
+
view.state.tr.replaceSelectionWith(placeholderNode)
|
|
474
|
+
);
|
|
475
|
+
const url = await this.options.uploadImage(image);
|
|
476
|
+
const node = view.state.schema.nodes.imageBlock.create({
|
|
477
|
+
src: url
|
|
478
|
+
});
|
|
479
|
+
const currentState = view.state;
|
|
480
|
+
let foundPos = -1;
|
|
481
|
+
currentState.doc.descendants((node2, pos) => {
|
|
482
|
+
if (node2.type.name === "imageBlock" && node2.attrs.loading) {
|
|
483
|
+
foundPos = pos;
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
if (foundPos !== -1) {
|
|
488
|
+
const transaction = view.state.tr.replaceWith(
|
|
489
|
+
foundPos,
|
|
490
|
+
foundPos + 1,
|
|
491
|
+
node
|
|
492
|
+
);
|
|
493
|
+
view.dispatch(transaction);
|
|
494
|
+
}
|
|
495
|
+
} catch (error) {
|
|
496
|
+
console.error("Failed to upload image:", error);
|
|
497
|
+
const currentState = view.state;
|
|
498
|
+
let foundPos = -1;
|
|
499
|
+
currentState.doc.descendants((node, pos) => {
|
|
500
|
+
if (node.type.name === "imageBlock" && node.attrs.loading) {
|
|
501
|
+
foundPos = pos;
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
if (foundPos !== -1) {
|
|
506
|
+
const transaction = view.state.tr.delete(
|
|
507
|
+
foundPos,
|
|
508
|
+
foundPos + 1
|
|
509
|
+
);
|
|
510
|
+
view.dispatch(transaction);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
})
|
|
520
|
+
];
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// src/headless/extensions/Mention/mention.tsx
|
|
525
|
+
import { ReactRenderer, ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
526
|
+
import Mention from "@tiptap/extension-mention";
|
|
527
|
+
|
|
528
|
+
// src/headless/extensions/Mention/mention-command.tsx
|
|
529
|
+
import { forwardRef as forwardRef5, useEffect as useEffect2, useImperativeHandle, useState as useState2 } from "react";
|
|
530
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
531
|
+
function Avatar({ src, fallback }) {
|
|
532
|
+
return /* @__PURE__ */ jsx6("div", { style: {
|
|
533
|
+
position: "relative",
|
|
534
|
+
display: "flex",
|
|
535
|
+
height: "24px",
|
|
536
|
+
width: "24px",
|
|
537
|
+
flexShrink: 0,
|
|
538
|
+
overflow: "hidden",
|
|
539
|
+
borderRadius: "9999px"
|
|
540
|
+
}, children: src ? /* @__PURE__ */ jsx6(
|
|
541
|
+
"img",
|
|
542
|
+
{
|
|
543
|
+
style: {
|
|
544
|
+
aspectRatio: "1",
|
|
545
|
+
height: "100%",
|
|
546
|
+
width: "100%"
|
|
547
|
+
},
|
|
548
|
+
src,
|
|
549
|
+
alt: fallback
|
|
550
|
+
}
|
|
551
|
+
) : /* @__PURE__ */ jsx6("div", { style: {
|
|
552
|
+
display: "flex",
|
|
553
|
+
height: "100%",
|
|
554
|
+
width: "100%",
|
|
555
|
+
alignItems: "center",
|
|
556
|
+
justifyContent: "center",
|
|
557
|
+
borderRadius: "9999px",
|
|
558
|
+
backgroundColor: "var(--muted)",
|
|
559
|
+
color: "var(--muted-foreground)",
|
|
560
|
+
fontSize: "10px",
|
|
561
|
+
fontWeight: 600
|
|
562
|
+
}, children: fallback }) });
|
|
563
|
+
}
|
|
564
|
+
function ReferenceIcon({ type }) {
|
|
565
|
+
if (type === "node") {
|
|
566
|
+
return /* @__PURE__ */ jsxs2("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: [
|
|
567
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 3l8 4.5v9l-8 4.5l-8-4.5v-9l8-4.5" }),
|
|
568
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 12l8-4.5" }),
|
|
569
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 12v9" }),
|
|
570
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 12l-8-4.5" })
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
return /* @__PURE__ */ jsxs2("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: [
|
|
574
|
+
/* @__PURE__ */ jsx6("path", { d: "M14 3v4a1 1 0 0 0 1 1h4" }),
|
|
575
|
+
/* @__PURE__ */ jsx6("path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" }),
|
|
576
|
+
/* @__PURE__ */ jsx6("path", { d: "M9 9l1 0" }),
|
|
577
|
+
/* @__PURE__ */ jsx6("path", { d: "M9 13l6 0" }),
|
|
578
|
+
/* @__PURE__ */ jsx6("path", { d: "M9 17l6 0" })
|
|
579
|
+
] });
|
|
580
|
+
}
|
|
581
|
+
var MentionCommand = forwardRef5((props, ref) => {
|
|
582
|
+
const [selectedIndex, setSelectedIndex] = useState2(0);
|
|
583
|
+
const selectItem = (index) => {
|
|
584
|
+
const item = props.items[index];
|
|
585
|
+
if (item) {
|
|
586
|
+
props.command(item);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
const upHandler = () => {
|
|
590
|
+
setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);
|
|
591
|
+
};
|
|
592
|
+
const downHandler = () => {
|
|
593
|
+
setSelectedIndex((selectedIndex + 1) % props.items.length);
|
|
594
|
+
};
|
|
595
|
+
const enterHandler = () => {
|
|
596
|
+
selectItem(selectedIndex);
|
|
597
|
+
};
|
|
598
|
+
useEffect2(() => setSelectedIndex(0), [props.items]);
|
|
599
|
+
useImperativeHandle(ref, () => ({
|
|
600
|
+
onKeyDown: ({ event }) => {
|
|
601
|
+
if (event.key === "ArrowUp") {
|
|
602
|
+
upHandler();
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
if (event.key === "ArrowDown") {
|
|
606
|
+
downHandler();
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
if (event.key === "Enter") {
|
|
610
|
+
enterHandler();
|
|
611
|
+
return true;
|
|
612
|
+
}
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
}));
|
|
616
|
+
return /* @__PURE__ */ jsx6(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
id: "mention-list",
|
|
620
|
+
style: {
|
|
621
|
+
backgroundColor: "var(--popover)",
|
|
622
|
+
color: "var(--foreground)",
|
|
623
|
+
maxHeight: "300px",
|
|
624
|
+
minWidth: "280px",
|
|
625
|
+
overflow: "hidden",
|
|
626
|
+
overflowY: "auto",
|
|
627
|
+
borderRadius: "12px",
|
|
628
|
+
border: "1px solid var(--border)",
|
|
629
|
+
padding: "4px",
|
|
630
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
631
|
+
},
|
|
632
|
+
children: props.items.length ? props.items.map((item, index) => /* @__PURE__ */ jsxs2(
|
|
633
|
+
"button",
|
|
634
|
+
{
|
|
635
|
+
type: "button",
|
|
636
|
+
onClick: () => selectItem(index),
|
|
637
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
638
|
+
style: {
|
|
639
|
+
position: "relative",
|
|
640
|
+
display: "flex",
|
|
641
|
+
width: "100%",
|
|
642
|
+
cursor: "default",
|
|
643
|
+
userSelect: "none",
|
|
644
|
+
alignItems: "center",
|
|
645
|
+
gap: "8px",
|
|
646
|
+
borderRadius: "4px",
|
|
647
|
+
padding: "10px 8px",
|
|
648
|
+
fontSize: "14px",
|
|
649
|
+
outline: "none",
|
|
650
|
+
backgroundColor: index === selectedIndex ? "var(--accent)" : "transparent",
|
|
651
|
+
color: index === selectedIndex ? "var(--accent-foreground)" : "inherit",
|
|
652
|
+
border: "none",
|
|
653
|
+
textAlign: "left"
|
|
654
|
+
},
|
|
655
|
+
children: [
|
|
656
|
+
item.type ? /* @__PURE__ */ jsx6(ReferenceIcon, { type: item.type }) : /* @__PURE__ */ jsx6(
|
|
657
|
+
Avatar,
|
|
658
|
+
{
|
|
659
|
+
src: item.avatar,
|
|
660
|
+
fallback: item.label.slice(0, 2).toUpperCase()
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ jsx6("span", { style: {
|
|
664
|
+
flex: 1,
|
|
665
|
+
overflow: "hidden",
|
|
666
|
+
textOverflow: "ellipsis",
|
|
667
|
+
whiteSpace: "nowrap"
|
|
668
|
+
}, children: item.label })
|
|
669
|
+
]
|
|
670
|
+
},
|
|
671
|
+
item.id
|
|
672
|
+
)) : /* @__PURE__ */ jsx6("div", { style: {
|
|
673
|
+
padding: "24px 0",
|
|
674
|
+
textAlign: "center",
|
|
675
|
+
fontSize: "14px",
|
|
676
|
+
color: "var(--muted-foreground)"
|
|
677
|
+
}, children: "No results found" })
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
});
|
|
681
|
+
MentionCommand.displayName = "MentionCommand";
|
|
682
|
+
|
|
683
|
+
// src/headless/extensions/Mention/mention-node-view.tsx
|
|
684
|
+
import { NodeViewWrapper } from "@tiptap/react";
|
|
685
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
686
|
+
function NodeIcon() {
|
|
687
|
+
return /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: [
|
|
688
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 3l8 4.5v9l-8 4.5l-8-4.5v-9l8-4.5" }),
|
|
689
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 12l8-4.5" }),
|
|
690
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 12v9" }),
|
|
691
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 12l-8-4.5" })
|
|
692
|
+
] });
|
|
693
|
+
}
|
|
694
|
+
function ArticleIcon() {
|
|
695
|
+
return /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: [
|
|
696
|
+
/* @__PURE__ */ jsx7("path", { d: "M14 3v4a1 1 0 0 0 1 1h4" }),
|
|
697
|
+
/* @__PURE__ */ jsx7("path", { d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" }),
|
|
698
|
+
/* @__PURE__ */ jsx7("path", { d: "M9 9l1 0" }),
|
|
699
|
+
/* @__PURE__ */ jsx7("path", { d: "M9 13l6 0" }),
|
|
700
|
+
/* @__PURE__ */ jsx7("path", { d: "M9 17l6 0" })
|
|
701
|
+
] });
|
|
702
|
+
}
|
|
703
|
+
var MentionNodeView = (props) => {
|
|
704
|
+
const { node } = props;
|
|
705
|
+
const { id, label, avatar, type } = node.attrs;
|
|
706
|
+
const isNode = type === "node";
|
|
707
|
+
const isArticle = type === "article";
|
|
708
|
+
const isReference = isNode || isArticle;
|
|
709
|
+
const backgroundColor = isArticle ? "rgba(249, 115, 22, 0.15)" : isNode ? "rgba(107, 114, 128, 0.15)" : "var(--accent)";
|
|
710
|
+
const color = isArticle ? "rgb(234, 88, 12)" : isNode ? "rgb(75, 85, 99)" : "var(--accent-foreground)";
|
|
711
|
+
const border = isArticle ? "1px solid rgba(249, 115, 22, 0.3)" : isNode ? "1px solid rgba(107, 114, 128, 0.3)" : "none";
|
|
712
|
+
return /* @__PURE__ */ jsxs3(
|
|
713
|
+
NodeViewWrapper,
|
|
714
|
+
{
|
|
715
|
+
as: "span",
|
|
716
|
+
style: {
|
|
717
|
+
display: "inline-flex",
|
|
718
|
+
alignItems: "center",
|
|
719
|
+
gap: "3px",
|
|
720
|
+
backgroundColor,
|
|
721
|
+
color,
|
|
722
|
+
border,
|
|
723
|
+
padding: isReference ? "1px 6px" : "1px 6px 1px 1px",
|
|
724
|
+
borderRadius: "12px",
|
|
725
|
+
fontSize: "13px",
|
|
726
|
+
fontWeight: 500,
|
|
727
|
+
verticalAlign: "middle"
|
|
728
|
+
},
|
|
729
|
+
children: [
|
|
730
|
+
isNode && /* @__PURE__ */ jsx7(NodeIcon, {}),
|
|
731
|
+
isArticle && /* @__PURE__ */ jsx7(ArticleIcon, {}),
|
|
732
|
+
!isReference && avatar && /* @__PURE__ */ jsx7(
|
|
733
|
+
"img",
|
|
734
|
+
{
|
|
735
|
+
src: avatar,
|
|
736
|
+
alt: label || id,
|
|
737
|
+
style: {
|
|
738
|
+
width: "20px",
|
|
739
|
+
height: "20px",
|
|
740
|
+
borderRadius: "50%",
|
|
741
|
+
flexShrink: 0
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
),
|
|
745
|
+
!isReference && !avatar && /* @__PURE__ */ jsx7(
|
|
746
|
+
"div",
|
|
747
|
+
{
|
|
748
|
+
style: {
|
|
749
|
+
width: "20px",
|
|
750
|
+
height: "20px",
|
|
751
|
+
borderRadius: "50%",
|
|
752
|
+
backgroundColor: "var(--muted)",
|
|
753
|
+
color: "var(--muted-foreground)",
|
|
754
|
+
display: "flex",
|
|
755
|
+
alignItems: "center",
|
|
756
|
+
justifyContent: "center",
|
|
757
|
+
fontSize: "10px",
|
|
758
|
+
fontWeight: 600,
|
|
759
|
+
flexShrink: 0
|
|
760
|
+
},
|
|
761
|
+
children: (label || id).slice(0, 2).toUpperCase()
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ jsx7("span", { children: label || id })
|
|
765
|
+
]
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
// src/headless/extensions/Mention/mention.tsx
|
|
771
|
+
var createMentionExtension = (options) => {
|
|
772
|
+
const extensionName = options?.name ?? "mention";
|
|
773
|
+
return Mention.extend({
|
|
774
|
+
name: extensionName,
|
|
775
|
+
addAttributes() {
|
|
776
|
+
return {
|
|
777
|
+
id: {
|
|
778
|
+
default: null,
|
|
779
|
+
parseHTML: (element) => element.getAttribute("data-id"),
|
|
780
|
+
renderHTML: (attributes) => {
|
|
781
|
+
if (!attributes.id) {
|
|
782
|
+
return {};
|
|
783
|
+
}
|
|
784
|
+
return {
|
|
785
|
+
"data-id": attributes.id
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
label: {
|
|
790
|
+
default: null,
|
|
791
|
+
parseHTML: (element) => element.getAttribute("data-label"),
|
|
792
|
+
renderHTML: (attributes) => {
|
|
793
|
+
if (!attributes.label) {
|
|
794
|
+
return {};
|
|
795
|
+
}
|
|
796
|
+
return {
|
|
797
|
+
"data-label": attributes.label
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
avatar: {
|
|
802
|
+
default: null,
|
|
803
|
+
parseHTML: (element) => element.getAttribute("data-avatar"),
|
|
804
|
+
renderHTML: (attributes) => {
|
|
805
|
+
if (!attributes.avatar) {
|
|
806
|
+
return {};
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
"data-avatar": attributes.avatar
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
type: {
|
|
814
|
+
default: null,
|
|
815
|
+
parseHTML: (element) => element.getAttribute("data-ref-type"),
|
|
816
|
+
renderHTML: (attributes) => {
|
|
817
|
+
if (!attributes.type) {
|
|
818
|
+
return {};
|
|
819
|
+
}
|
|
820
|
+
return {
|
|
821
|
+
"data-ref-type": attributes.type
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
nodeId: {
|
|
826
|
+
default: null,
|
|
827
|
+
parseHTML: (element) => element.getAttribute("data-node-id"),
|
|
828
|
+
renderHTML: (attributes) => {
|
|
829
|
+
if (!attributes.nodeId) {
|
|
830
|
+
return {};
|
|
831
|
+
}
|
|
832
|
+
return {
|
|
833
|
+
"data-node-id": attributes.nodeId
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
slug: {
|
|
838
|
+
default: null,
|
|
839
|
+
parseHTML: (element) => element.getAttribute("data-slug"),
|
|
840
|
+
renderHTML: (attributes) => {
|
|
841
|
+
if (!attributes.slug) {
|
|
842
|
+
return {};
|
|
843
|
+
}
|
|
844
|
+
return {
|
|
845
|
+
"data-slug": attributes.slug
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
},
|
|
851
|
+
addNodeView() {
|
|
852
|
+
return ReactNodeViewRenderer2(MentionNodeView);
|
|
853
|
+
}
|
|
854
|
+
}).configure({
|
|
855
|
+
HTMLAttributes: {
|
|
856
|
+
class: "mention"
|
|
857
|
+
},
|
|
858
|
+
suggestion: {
|
|
859
|
+
char: options?.char ?? "@",
|
|
860
|
+
items: async ({ query }) => {
|
|
861
|
+
if (!options?.items) return [];
|
|
862
|
+
const items = await options.items(query);
|
|
863
|
+
return items;
|
|
864
|
+
},
|
|
865
|
+
command: ({ editor, range, props: item }) => {
|
|
866
|
+
editor.chain().focus().insertContentAt(range, [
|
|
867
|
+
{
|
|
868
|
+
type: extensionName,
|
|
869
|
+
attrs: {
|
|
870
|
+
id: item.id,
|
|
871
|
+
label: item.label,
|
|
872
|
+
avatar: item.avatar,
|
|
873
|
+
type: item.type,
|
|
874
|
+
nodeId: item.nodeId,
|
|
875
|
+
slug: item.slug
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
]).run();
|
|
879
|
+
},
|
|
880
|
+
render: renderMentionSuggestion
|
|
881
|
+
},
|
|
882
|
+
renderLabel: options?.renderLabel ?? ((props) => {
|
|
883
|
+
return `@${props.node.attrs.label ?? props.node.attrs.id}`;
|
|
884
|
+
})
|
|
885
|
+
});
|
|
886
|
+
};
|
|
887
|
+
var renderMentionSuggestion = () => {
|
|
888
|
+
let component = null;
|
|
889
|
+
let container = null;
|
|
890
|
+
const destroy = () => {
|
|
891
|
+
component?.destroy();
|
|
892
|
+
component = null;
|
|
893
|
+
if (container) {
|
|
894
|
+
container.remove();
|
|
895
|
+
container = null;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
const updatePosition = (clientRect) => {
|
|
899
|
+
if (!container || !clientRect) return;
|
|
900
|
+
const gap = 8;
|
|
901
|
+
const maxDropdownHeight = 300;
|
|
902
|
+
const spaceBelow = window.innerHeight - clientRect.bottom;
|
|
903
|
+
const spaceAbove = clientRect.top;
|
|
904
|
+
const shouldPositionAbove = spaceBelow < maxDropdownHeight && spaceAbove > spaceBelow;
|
|
905
|
+
const left = Math.round(clientRect.left);
|
|
906
|
+
if (shouldPositionAbove) {
|
|
907
|
+
const bottom = Math.round(window.innerHeight - clientRect.top + gap);
|
|
908
|
+
container.style.bottom = `${bottom}px`;
|
|
909
|
+
container.style.top = "auto";
|
|
910
|
+
} else {
|
|
911
|
+
const top = Math.round(clientRect.bottom + gap);
|
|
912
|
+
container.style.top = `${top}px`;
|
|
913
|
+
container.style.bottom = "auto";
|
|
914
|
+
}
|
|
915
|
+
container.style.left = `${left}px`;
|
|
916
|
+
};
|
|
917
|
+
return {
|
|
918
|
+
onStart: (props) => {
|
|
919
|
+
component = new ReactRenderer(MentionCommand, {
|
|
920
|
+
props: {
|
|
921
|
+
items: props.items ?? [],
|
|
922
|
+
command: props.command ?? (() => {
|
|
923
|
+
}),
|
|
924
|
+
query: props.query ?? ""
|
|
925
|
+
},
|
|
926
|
+
editor: props.editor
|
|
927
|
+
});
|
|
928
|
+
container = document.createElement("div");
|
|
929
|
+
container.style.position = "fixed";
|
|
930
|
+
container.style.zIndex = "9999";
|
|
931
|
+
document.body.appendChild(container);
|
|
932
|
+
container.appendChild(component.element);
|
|
933
|
+
const rect = typeof props.clientRect === "function" ? props.clientRect() : null;
|
|
934
|
+
if (rect) updatePosition(rect);
|
|
935
|
+
},
|
|
936
|
+
onUpdate: (props) => {
|
|
937
|
+
component?.updateProps({
|
|
938
|
+
items: props.items ?? [],
|
|
939
|
+
command: props.command ?? (() => {
|
|
940
|
+
}),
|
|
941
|
+
query: props.query ?? ""
|
|
942
|
+
});
|
|
943
|
+
const rect = typeof props.clientRect === "function" ? props.clientRect() : null;
|
|
944
|
+
if (rect) updatePosition(rect);
|
|
945
|
+
},
|
|
946
|
+
onKeyDown: ({ event }) => {
|
|
947
|
+
if (!component) return false;
|
|
948
|
+
if (event.key === "Escape") {
|
|
949
|
+
event.preventDefault();
|
|
950
|
+
event.stopPropagation();
|
|
951
|
+
destroy();
|
|
952
|
+
return true;
|
|
953
|
+
}
|
|
954
|
+
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
|
955
|
+
event.preventDefault();
|
|
956
|
+
event.stopPropagation();
|
|
957
|
+
return component.ref?.onKeyDown?.({ event }) ?? false;
|
|
958
|
+
}
|
|
959
|
+
return false;
|
|
960
|
+
},
|
|
961
|
+
onExit: () => {
|
|
962
|
+
destroy();
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
// src/headless/extensions/DragHandle/DragHandle.ts
|
|
968
|
+
import BaseDragHandle from "@tiptap/extension-drag-handle";
|
|
969
|
+
var currentCallbacks = {};
|
|
970
|
+
var currentNode = null;
|
|
971
|
+
var currentEditor = null;
|
|
972
|
+
function setDragHandleCallbacks(callbacks) {
|
|
973
|
+
currentCallbacks = callbacks;
|
|
974
|
+
}
|
|
975
|
+
function createDragHandleElement() {
|
|
976
|
+
const container = document.createElement("div");
|
|
977
|
+
container.className = "nph-drag-handle";
|
|
978
|
+
const plusBtn = document.createElement("button");
|
|
979
|
+
plusBtn.className = "nph-drag-handle__btn";
|
|
980
|
+
plusBtn.type = "button";
|
|
981
|
+
plusBtn.setAttribute("aria-label", "Add block");
|
|
982
|
+
plusBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`;
|
|
983
|
+
plusBtn.addEventListener("click", (e) => {
|
|
984
|
+
e.preventDefault();
|
|
985
|
+
e.stopPropagation();
|
|
986
|
+
if (currentEditor) {
|
|
987
|
+
currentCallbacks.onAddBlock?.(currentEditor, currentNode);
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
const gripBtn = document.createElement("button");
|
|
991
|
+
gripBtn.className = "nph-drag-handle__btn nph-drag-handle__grip";
|
|
992
|
+
gripBtn.type = "button";
|
|
993
|
+
gripBtn.setAttribute("aria-label", "Drag to reorder");
|
|
994
|
+
gripBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/></svg>`;
|
|
995
|
+
gripBtn.addEventListener("click", (e) => {
|
|
996
|
+
e.preventDefault();
|
|
997
|
+
e.stopPropagation();
|
|
998
|
+
if (currentEditor) {
|
|
999
|
+
currentCallbacks.onGripClick?.(currentEditor, currentNode, container);
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
container.appendChild(plusBtn);
|
|
1003
|
+
container.appendChild(gripBtn);
|
|
1004
|
+
return container;
|
|
1005
|
+
}
|
|
1006
|
+
var DragHandle = BaseDragHandle.configure({
|
|
1007
|
+
render: createDragHandleElement,
|
|
1008
|
+
nested: true,
|
|
1009
|
+
onNodeChange: ({ node, editor }) => {
|
|
1010
|
+
currentNode = node;
|
|
1011
|
+
currentEditor = editor;
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
// src/headless/extensions/Table/index.ts
|
|
1016
|
+
import { TableKit } from "@tiptap/extension-table";
|
|
1017
|
+
import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table";
|
|
1018
|
+
|
|
1019
|
+
// src/headless/extensions/MarkdownPaste.ts
|
|
1020
|
+
import { Extension } from "@tiptap/core";
|
|
1021
|
+
import { Plugin as Plugin3, PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
1022
|
+
import { MarkdownParser, defaultMarkdownParser } from "@tiptap/pm/markdown";
|
|
1023
|
+
var markdownPastePluginKey = new PluginKey2("markdownPaste");
|
|
1024
|
+
function looksLikeMarkdown(text) {
|
|
1025
|
+
const patterns = [
|
|
1026
|
+
/^#{1,6}\s/m,
|
|
1027
|
+
// headings
|
|
1028
|
+
/^\s*[-*+]\s/m,
|
|
1029
|
+
// unordered list
|
|
1030
|
+
/^\s*\d+\.\s/m,
|
|
1031
|
+
// ordered list
|
|
1032
|
+
/^\s*>\s/m,
|
|
1033
|
+
// blockquote
|
|
1034
|
+
/\|.+\|/m,
|
|
1035
|
+
// table
|
|
1036
|
+
/^```/m,
|
|
1037
|
+
// fenced code block
|
|
1038
|
+
/\*\*.+\*\*/,
|
|
1039
|
+
// bold
|
|
1040
|
+
/\*.+\*/,
|
|
1041
|
+
// italic
|
|
1042
|
+
/~~.+~~/,
|
|
1043
|
+
// strikethrough
|
|
1044
|
+
/`[^`]+`/,
|
|
1045
|
+
// inline code
|
|
1046
|
+
/^\s*---\s*$/m,
|
|
1047
|
+
// horizontal rule
|
|
1048
|
+
/^\s*\*\*\*\s*$/m,
|
|
1049
|
+
// horizontal rule alt
|
|
1050
|
+
/\[.+\]\(.+\)/,
|
|
1051
|
+
// links
|
|
1052
|
+
/!\[.*\]\(.+\)/
|
|
1053
|
+
// images
|
|
1054
|
+
];
|
|
1055
|
+
const hasMarkdown = patterns.some((p) => p.test(text));
|
|
1056
|
+
const isHtml = /^<[a-z][\s\S]*>/i.test(text.trim());
|
|
1057
|
+
return hasMarkdown && !isHtml;
|
|
1058
|
+
}
|
|
1059
|
+
function buildParser(schema) {
|
|
1060
|
+
const md = defaultMarkdownParser.tokenizer;
|
|
1061
|
+
const tokens = {};
|
|
1062
|
+
if (schema.nodes.paragraph) tokens.paragraph = { block: "paragraph" };
|
|
1063
|
+
if (schema.nodes.heading) {
|
|
1064
|
+
tokens.heading = {
|
|
1065
|
+
block: "heading",
|
|
1066
|
+
getAttrs: (tok) => ({ level: Number(tok.tag.slice(1)) })
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
if (schema.nodes.blockquote) tokens.blockquote = { block: "blockquote" };
|
|
1070
|
+
if (schema.nodes.bulletList) tokens.bullet_list = { block: "bulletList" };
|
|
1071
|
+
if (schema.nodes.orderedList) {
|
|
1072
|
+
tokens.ordered_list = {
|
|
1073
|
+
block: "orderedList",
|
|
1074
|
+
getAttrs: (tok) => ({ start: Number(tok.attrGet("start") || 1) })
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
if (schema.nodes.listItem) tokens.list_item = { block: "listItem" };
|
|
1078
|
+
if (schema.nodes.codeBlock) {
|
|
1079
|
+
tokens.code_block = { block: "codeBlock", noCloseToken: true };
|
|
1080
|
+
tokens.fence = {
|
|
1081
|
+
block: "codeBlock",
|
|
1082
|
+
getAttrs: (tok) => ({ language: tok.info || "" }),
|
|
1083
|
+
noCloseToken: true
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
if (schema.nodes.horizontalRule) {
|
|
1087
|
+
tokens.hr = { node: "horizontalRule" };
|
|
1088
|
+
}
|
|
1089
|
+
if (schema.nodes.hardBreak) {
|
|
1090
|
+
tokens.hardbreak = { node: "hardBreak" };
|
|
1091
|
+
}
|
|
1092
|
+
if (schema.nodes.image) {
|
|
1093
|
+
tokens.image = {
|
|
1094
|
+
node: "image",
|
|
1095
|
+
getAttrs: (tok) => ({
|
|
1096
|
+
src: tok.attrGet("src"),
|
|
1097
|
+
title: tok.attrGet("title") || null,
|
|
1098
|
+
alt: tok.children?.[0]?.content || null
|
|
1099
|
+
})
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
if (schema.nodes.table) {
|
|
1103
|
+
tokens.table = { block: "table" };
|
|
1104
|
+
tokens.thead = { ignore: true };
|
|
1105
|
+
tokens.tbody = { ignore: true };
|
|
1106
|
+
tokens.tr = { block: "tableRow" };
|
|
1107
|
+
tokens.th = { block: "tableHeader" };
|
|
1108
|
+
tokens.td = { block: "tableCell" };
|
|
1109
|
+
}
|
|
1110
|
+
if (schema.marks.bold || schema.marks.strong) {
|
|
1111
|
+
tokens.strong = { mark: schema.marks.bold ? "bold" : "strong" };
|
|
1112
|
+
}
|
|
1113
|
+
if (schema.marks.italic || schema.marks.em) {
|
|
1114
|
+
tokens.em = { mark: schema.marks.italic ? "italic" : "em" };
|
|
1115
|
+
}
|
|
1116
|
+
if (schema.marks.code) {
|
|
1117
|
+
tokens.code_inline = { mark: "code", noCloseToken: true };
|
|
1118
|
+
}
|
|
1119
|
+
if (schema.marks.link) {
|
|
1120
|
+
tokens.link = {
|
|
1121
|
+
mark: "link",
|
|
1122
|
+
getAttrs: (tok) => ({
|
|
1123
|
+
href: tok.attrGet("href"),
|
|
1124
|
+
title: tok.attrGet("title") || null
|
|
1125
|
+
})
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
if (schema.marks.strike || schema.marks.strikethrough) {
|
|
1129
|
+
tokens.s = { mark: schema.marks.strike ? "strike" : "strikethrough" };
|
|
1130
|
+
}
|
|
1131
|
+
try {
|
|
1132
|
+
return new MarkdownParser(schema, md, tokens);
|
|
1133
|
+
} catch {
|
|
1134
|
+
return null;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
var MarkdownPaste = Extension.create({
|
|
1138
|
+
name: "markdownPaste",
|
|
1139
|
+
addProseMirrorPlugins() {
|
|
1140
|
+
const schema = this.editor.schema;
|
|
1141
|
+
let parser = null;
|
|
1142
|
+
return [
|
|
1143
|
+
new Plugin3({
|
|
1144
|
+
key: markdownPastePluginKey,
|
|
1145
|
+
props: {
|
|
1146
|
+
handlePaste(view, event) {
|
|
1147
|
+
const clipboardData = event.clipboardData;
|
|
1148
|
+
if (!clipboardData) return false;
|
|
1149
|
+
const html = clipboardData.getData("text/html");
|
|
1150
|
+
if (html && html.trim().length > 0) return false;
|
|
1151
|
+
const text = clipboardData.getData("text/plain");
|
|
1152
|
+
if (!text || !looksLikeMarkdown(text)) return false;
|
|
1153
|
+
if (!parser) {
|
|
1154
|
+
parser = buildParser(schema);
|
|
1155
|
+
}
|
|
1156
|
+
if (!parser) return false;
|
|
1157
|
+
try {
|
|
1158
|
+
const doc = parser.parse(text);
|
|
1159
|
+
if (!doc || doc.content.size === 0) return false;
|
|
1160
|
+
const { tr } = view.state;
|
|
1161
|
+
const slice = doc.slice(0, doc.content.size);
|
|
1162
|
+
tr.replaceSelection(slice);
|
|
1163
|
+
view.dispatch(tr);
|
|
1164
|
+
return true;
|
|
1165
|
+
} catch {
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
})
|
|
1171
|
+
];
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
// src/headless/extensions/slash-command.tsx
|
|
1176
|
+
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
1177
|
+
import Suggestion from "@tiptap/suggestion";
|
|
1178
|
+
import { Extension as Extension2 } from "@tiptap/core";
|
|
1179
|
+
var Command2 = Extension2.create({
|
|
1180
|
+
name: "slash-command",
|
|
1181
|
+
addOptions() {
|
|
1182
|
+
return {
|
|
1183
|
+
suggestion: {
|
|
1184
|
+
char: "/",
|
|
1185
|
+
command: (ctx) => {
|
|
1186
|
+
ctx.props.command({ editor: ctx.editor, range: ctx.range });
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
},
|
|
1191
|
+
addProseMirrorPlugins() {
|
|
1192
|
+
const base = this.options.suggestion ?? {};
|
|
1193
|
+
return [
|
|
1194
|
+
Suggestion({
|
|
1195
|
+
editor: this.editor,
|
|
1196
|
+
char: base.char ?? "/",
|
|
1197
|
+
// Only trigger slash command at start of line or after whitespace
|
|
1198
|
+
startOfLine: base.startOfLine ?? true,
|
|
1199
|
+
items: base.items ?? (() => ["/"]),
|
|
1200
|
+
command: (ctx) => {
|
|
1201
|
+
if (typeof ctx?.props?.command === "function") {
|
|
1202
|
+
ctx.props.command({ editor: ctx.editor, range: ctx.range });
|
|
1203
|
+
}
|
|
1204
|
+
},
|
|
1205
|
+
...base
|
|
1206
|
+
})
|
|
1207
|
+
];
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
var renderItems = (elementRef) => {
|
|
1211
|
+
let component = null;
|
|
1212
|
+
let container = null;
|
|
1213
|
+
const destroy = () => {
|
|
1214
|
+
component?.destroy();
|
|
1215
|
+
component = null;
|
|
1216
|
+
if (container) {
|
|
1217
|
+
container.remove();
|
|
1218
|
+
container = null;
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
const updatePosition = (clientRect) => {
|
|
1222
|
+
if (!container || !clientRect) return;
|
|
1223
|
+
const menuHeight = container.offsetHeight || 360;
|
|
1224
|
+
const viewportHeight = window.innerHeight;
|
|
1225
|
+
const spaceBelow = viewportHeight - clientRect.bottom;
|
|
1226
|
+
const spaceAbove = clientRect.top;
|
|
1227
|
+
let top;
|
|
1228
|
+
if (spaceBelow < menuHeight + 16 && spaceAbove > spaceBelow) {
|
|
1229
|
+
top = Math.round(clientRect.top - menuHeight - 8);
|
|
1230
|
+
if (top < 8) top = 8;
|
|
1231
|
+
} else {
|
|
1232
|
+
top = Math.round(clientRect.bottom + 8);
|
|
1233
|
+
}
|
|
1234
|
+
let left = Math.round(clientRect.left);
|
|
1235
|
+
const menuWidth = container.offsetWidth || 280;
|
|
1236
|
+
if (left + menuWidth > window.innerWidth - 8) {
|
|
1237
|
+
left = window.innerWidth - menuWidth - 8;
|
|
1238
|
+
}
|
|
1239
|
+
if (left < 8) left = 8;
|
|
1240
|
+
container.style.top = `${top}px`;
|
|
1241
|
+
container.style.left = `${left}px`;
|
|
1242
|
+
};
|
|
1243
|
+
return {
|
|
1244
|
+
onStart: (props) => {
|
|
1245
|
+
const { selection } = props.editor.state;
|
|
1246
|
+
const parentNode = selection.$from.node(selection.$from.depth);
|
|
1247
|
+
const blockType = parentNode.type.name;
|
|
1248
|
+
if (blockType === "codeBlock") return false;
|
|
1249
|
+
const { $from } = selection;
|
|
1250
|
+
const marks = $from.marks();
|
|
1251
|
+
if (marks.some((mark) => mark.type.name === "code" || mark.type.name === "link")) {
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
component = new ReactRenderer2(EditorCommandOut, {
|
|
1255
|
+
props: {
|
|
1256
|
+
query: props.query ?? "",
|
|
1257
|
+
range: props.range
|
|
1258
|
+
},
|
|
1259
|
+
editor: props.editor
|
|
1260
|
+
});
|
|
1261
|
+
container = document.createElement("div");
|
|
1262
|
+
container.style.position = "fixed";
|
|
1263
|
+
container.style.zIndex = "9999";
|
|
1264
|
+
container.style.minWidth = "240px";
|
|
1265
|
+
(elementRef?.current ?? document.body).appendChild(container);
|
|
1266
|
+
container.appendChild(component.element);
|
|
1267
|
+
const rect = typeof props.clientRect === "function" ? props.clientRect() : null;
|
|
1268
|
+
if (rect) updatePosition(rect);
|
|
1269
|
+
},
|
|
1270
|
+
onUpdate: (props) => {
|
|
1271
|
+
component?.updateProps({
|
|
1272
|
+
query: props.query ?? "",
|
|
1273
|
+
range: props.range
|
|
1274
|
+
});
|
|
1275
|
+
const rect = typeof props.clientRect === "function" ? props.clientRect() : null;
|
|
1276
|
+
if (rect) updatePosition(rect);
|
|
1277
|
+
},
|
|
1278
|
+
onKeyDown: ({ event }) => {
|
|
1279
|
+
if (event.key === "Escape") {
|
|
1280
|
+
destroy();
|
|
1281
|
+
return true;
|
|
1282
|
+
}
|
|
1283
|
+
return false;
|
|
1284
|
+
},
|
|
1285
|
+
onExit: () => {
|
|
1286
|
+
destroy();
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
};
|
|
1290
|
+
var createSuggestionItems = (items) => items;
|
|
1291
|
+
var handleCommandNavigation = (event) => {
|
|
1292
|
+
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
|
1293
|
+
const slashCommand = document.querySelector("#slash-command");
|
|
1294
|
+
if (slashCommand) return true;
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
export {
|
|
1299
|
+
EditorRoot,
|
|
1300
|
+
EditorContent,
|
|
1301
|
+
EditorBubble,
|
|
1302
|
+
EditorBubbleItem,
|
|
1303
|
+
EditorCommandOut,
|
|
1304
|
+
EditorCommand,
|
|
1305
|
+
EditorCommandList,
|
|
1306
|
+
EditorCommandItem,
|
|
1307
|
+
EditorCommandEmpty,
|
|
1308
|
+
CodeBlock,
|
|
1309
|
+
Link,
|
|
1310
|
+
ImageBlock,
|
|
1311
|
+
MentionCommand,
|
|
1312
|
+
createMentionExtension,
|
|
1313
|
+
renderMentionSuggestion,
|
|
1314
|
+
setDragHandleCallbacks,
|
|
1315
|
+
DragHandle,
|
|
1316
|
+
TableKit,
|
|
1317
|
+
MarkdownPaste,
|
|
1318
|
+
StarterKit,
|
|
1319
|
+
Placeholder,
|
|
1320
|
+
Command2 as Command,
|
|
1321
|
+
renderItems,
|
|
1322
|
+
createSuggestionItems,
|
|
1323
|
+
handleCommandNavigation,
|
|
1324
|
+
useCurrentEditor4 as useCurrentEditor
|
|
1325
|
+
};
|
|
1326
|
+
//# sourceMappingURL=chunk-GXJGZHKR.js.map
|