@levo-so/site-runtime 0.3.8 → 0.3.10
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/{DateTimeWidget-hFjcn3o6.js → DateTimeWidget-U3lD0q1q.js} +1 -1
- package/{KBChatWidget-ClHFDgJ5.js → KBChatWidget-ByOwQQNg.js} +404 -397
- package/PopupBody-BI-MJqmd-DW3qWKam.js +159 -0
- package/PopupRenderer-D66Gx63H-BnOmWsyj.js +388 -0
- package/RichTextWidget-DfakML79.js +749 -0
- package/RteThemeProvider-BQmfSXSl.js +20 -0
- package/{nodeAlignment-BnJljFlw.js → content.cssm-XdMsTGIB.js} +24 -32
- package/{dist-CRDgdAkQ.js → dist-BdNHqoWi.js} +498 -466
- package/{dist-DPmVG7VB.js → dist-Cl_sKk9y.js} +3 -3
- package/index.d.ts +539 -9
- package/index.js +998 -798
- package/inlineRteTheme-CRPtkNXy.js +10 -0
- package/{kbChat-C00LVlxP.js → kbChat-GBcfFoss.js} +15 -15
- package/package.json +41 -27
- package/pillChrome-_hpGdrBS.js +50 -0
- package/popups.js +1 -1
- package/{PopupBody-DZVwDLkg-Cfy3lWGs.js → react-Cj_U6VZQ.js} +816 -850
- package/rich-text.d.ts +25 -0
- package/rich-text.js +1644 -0
- package/routes-CyKmkoRM.js +316 -0
- package/start.d.ts +38 -0
- package/start.js +19 -0
- package/styles.css +1 -1
- package/{usePopupRedirect-BThP_YPW-COUseDik.js → usePopupRedirect-CAAdcpaW-Ddjyf4KK.js} +15 -13
- package/PopupRenderer-BjW1jg70-W2y-PEPH.js +0 -387
- package/RichTextWidget-DkKHEq4j.js +0 -759
- package/pillChrome-BAu5AfCT.js +0 -30
- /package/{PhoneWidget-BmBO-kvA.js → PhoneWidget-DQQa4bL6.js} +0 -0
- /package/{Popover-3N88sRp4.js → Popover-C29yJ7rz.js} +0 -0
- /package/{es-CztjLuNy.js → es-ByBbirnH.js} +0 -0
- /package/{popupState-JmpeKzgM-qhNTV79U.js → popupState-JmpeKzgM-D_77LiAa.js} +0 -0
- /package/{react-CV3jf2mc.js → react-B9yvlbH0.js} +0 -0
- /package/{rteTheme.cssm-xg0gJ28J.js → rteTheme.cssm-W4gTOijw.js} +0 -0
|
@@ -1,681 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Fragment as te, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
-
import y, { Suspense as b, lazy as x, useMemo as S, useState as ne } from "react";
|
|
11
|
-
import { IconCheck as re, IconCopy as ie } from "@tabler/icons-react";
|
|
12
|
-
import { Extension as C, Mark as w, Node as T, getAttributesFromExtensions as E, getExtensionField as D, getSchema as O, getSchemaByResolvedExtensions as k, getStyleProperty as A, markInputRule as j, markPasteRule as M, mergeAttributes as N, resolveExtensions as ae, splitExtensions as oe, textblockTypeInputRule as se } from "@tiptap/core";
|
|
13
|
-
import { DOMParser as ce, Node as P } from "@tiptap/pm/model";
|
|
14
|
-
import { jsx as F } from "@tiptap/core/jsx-runtime";
|
|
15
|
-
import { BulletList as I, ListItem as L, OrderedList as R } from "@tiptap/extension-list";
|
|
16
|
-
import { Color as z, TextStyle as B } from "@tiptap/extension-text-style";
|
|
17
|
-
import { Document as V } from "@tiptap/extension-document";
|
|
18
|
-
import { Link as H } from "@tiptap/extension-link";
|
|
19
|
-
import { Subscript as U } from "@tiptap/extension-subscript";
|
|
20
|
-
import { Superscript as W } from "@tiptap/extension-superscript";
|
|
21
|
-
import { Typography as G } from "@tiptap/extension-typography";
|
|
22
|
-
import { UniqueID as le } from "@tiptap/extension-unique-id";
|
|
23
|
-
//#region ../../node_modules/.pnpm/@tiptap+html@3.23.5_@tiptap+core@3.23.5_@tiptap+pm@3.23.5__@tiptap+pm@3.23.5_happy-dom@20.9.0/node_modules/@tiptap/html/dist/index.js
|
|
24
|
-
function ue(e, t, n) {
|
|
25
|
-
if (typeof window > "u") throw Error("generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");
|
|
26
|
-
let r = O(t), i = new window.DOMParser().parseFromString(e, "text/html");
|
|
27
|
-
if (!i) throw Error("Failed to parse HTML string");
|
|
28
|
-
return ce.fromSchema(r).parse(i.body, n).toJSON();
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.23.5_@tiptap+core@3.23.5_@tiptap+pm@3.23.5__@tiptap+pm@3.23.5_b87ef4cd4355051c9859f15a0f52cacb/node_modules/@tiptap/static-renderer/dist/pm/react/index.js
|
|
32
|
-
function de(e, t, n) {
|
|
33
|
-
let r = e.attrs;
|
|
34
|
-
return r ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(r) || { [e.name]: e.name in r ? r[e.name] : e.attribute.default }).reduce((e, t) => N(e, t), {}) : {};
|
|
35
|
-
}
|
|
36
|
-
function K(e, t) {
|
|
37
|
-
return de(e, t, !0);
|
|
38
|
-
}
|
|
39
|
-
function fe(e, t, n, r) {
|
|
40
|
-
let i = D(t, "renderHTML", {
|
|
41
|
-
name: t.name,
|
|
42
|
-
options: t.options,
|
|
43
|
-
storage: t.storage,
|
|
44
|
-
parent: t.parent
|
|
45
|
-
});
|
|
46
|
-
return i ? [t.name, ({ node: r, children: a }) => {
|
|
47
|
-
try {
|
|
48
|
-
return e(i({
|
|
49
|
-
node: r,
|
|
50
|
-
HTMLAttributes: K(r, n)
|
|
51
|
-
}))(a);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
54
|
-
}
|
|
55
|
-
}] : r?.unhandledNode ? [t.name, r.unhandledNode] : [t.name, () => {
|
|
56
|
-
throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`);
|
|
57
|
-
}];
|
|
58
|
-
}
|
|
59
|
-
function pe(e, t, n, r) {
|
|
60
|
-
let i = D(t, "renderHTML", {
|
|
61
|
-
name: t.name,
|
|
62
|
-
options: t.options,
|
|
63
|
-
storage: t.storage,
|
|
64
|
-
parent: t.parent
|
|
65
|
-
});
|
|
66
|
-
return i ? [t.name, ({ mark: r, children: a }) => {
|
|
67
|
-
try {
|
|
68
|
-
return e(i({
|
|
69
|
-
mark: r,
|
|
70
|
-
HTMLAttributes: K(r, n)
|
|
71
|
-
}))(a);
|
|
72
|
-
} catch (e) {
|
|
73
|
-
throw Error(`[tiptap error]: Mark ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
74
|
-
}
|
|
75
|
-
}] : r?.unhandledMark ? [t.name, r.unhandledMark] : [t.name, () => {
|
|
76
|
-
throw Error(`Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method`);
|
|
77
|
-
}];
|
|
78
|
-
}
|
|
79
|
-
function me({ renderer: e, domOutputSpecToElement: t, mapDefinedTypes: n, content: r, extensions: i, options: a }) {
|
|
80
|
-
i = ae(i);
|
|
81
|
-
let o = E(i), { nodeExtensions: s, markExtensions: c } = oe(i);
|
|
82
|
-
return r instanceof P || (r = P.fromJSON(k(i), r)), e({
|
|
83
|
-
...a,
|
|
84
|
-
nodeMapping: {
|
|
85
|
-
...Object.fromEntries(s.filter((e) => e.name in n ? !1 : a?.nodeMapping ? !(e.name in a.nodeMapping) : !0).map((e) => fe(t, e, o, a))),
|
|
86
|
-
...n,
|
|
87
|
-
...a?.nodeMapping
|
|
88
|
-
},
|
|
89
|
-
markMapping: {
|
|
90
|
-
...Object.fromEntries(c.filter((e) => a?.markMapping ? !(e.name in a.markMapping) : !0).map((e) => pe(t, e, o, a))),
|
|
91
|
-
...a?.markMapping
|
|
92
|
-
}
|
|
93
|
-
})({ content: r });
|
|
94
|
-
}
|
|
95
|
-
function he(e, { nodeMapping: t, markMapping: n, unhandledNode: r, unhandledMark: i }) {
|
|
96
|
-
return function a({ content: o, parent: s }) {
|
|
97
|
-
let c = typeof o.type == "string" ? o.type : o.type.name, l = t[c] ?? r;
|
|
98
|
-
if (!l) throw Error(`missing handler for node type ${c}`);
|
|
99
|
-
let u = e({
|
|
100
|
-
component: l,
|
|
101
|
-
props: {
|
|
102
|
-
node: o,
|
|
103
|
-
parent: s,
|
|
104
|
-
renderElement: a,
|
|
105
|
-
get children() {
|
|
106
|
-
let e = [];
|
|
107
|
-
return o.content && o.content.forEach((t) => {
|
|
108
|
-
e.push(a({
|
|
109
|
-
content: t,
|
|
110
|
-
parent: o
|
|
111
|
-
}));
|
|
112
|
-
}), e;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
return o.marks ? o.marks.reduce((t, r) => {
|
|
117
|
-
let a = typeof r.type == "string" ? r.type : r.type.name, c = n[a] ?? i;
|
|
118
|
-
if (!c) throw Error(`missing handler for mark type ${a}`);
|
|
119
|
-
return e({
|
|
120
|
-
component: c,
|
|
121
|
-
props: {
|
|
122
|
-
mark: r,
|
|
123
|
-
parent: s,
|
|
124
|
-
node: o,
|
|
125
|
-
children: t
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}, u) : u;
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function ge(e) {
|
|
132
|
-
let t = 0;
|
|
133
|
-
return he(({ component: e, props: { children: n, ...r } }) => y.createElement(e, Object.assign(r, { key: t++ }), [].concat(n)), e);
|
|
134
|
-
}
|
|
135
|
-
function q(e, t) {
|
|
136
|
-
return e ? Object.entries(e).reduce((e, [t, n]) => {
|
|
137
|
-
if (t === "class") return Object.assign(e, { className: n });
|
|
138
|
-
if (t === "style" && typeof n == "string") {
|
|
139
|
-
let t = {};
|
|
140
|
-
return n.split(";").forEach((e) => {
|
|
141
|
-
let [n, r] = e.split(":");
|
|
142
|
-
if (n && r) {
|
|
143
|
-
let e = n.trim().replace(/-([a-z])/g, (e) => e[1].toUpperCase());
|
|
144
|
-
t[e] = r.trim();
|
|
145
|
-
}
|
|
146
|
-
}), Object.assign(e, { style: t });
|
|
147
|
-
}
|
|
148
|
-
return Object.assign(e, { [t]: n });
|
|
149
|
-
}, { key: t }) : { key: t };
|
|
150
|
-
}
|
|
151
|
-
function J(e, t = 0) {
|
|
152
|
-
if (typeof e == "string") return () => e;
|
|
153
|
-
if (typeof e == "object" && "length" in e) {
|
|
154
|
-
let [n, r, i, ...a] = e, o = n.split(" ");
|
|
155
|
-
if (o.length > 1 && (n = o[1], r === void 0 && (r = { xmlns: o[0] }), r === 0 && (r = { xmlns: o[0] }, i = 0), typeof r == "object" && (r = Object.assign(r, { xmlns: o[0] }))), r === void 0) return () => y.createElement(n, q(void 0, t.toString()));
|
|
156
|
-
if (r === 0) return (e) => y.createElement(n, q(void 0, t.toString()), e);
|
|
157
|
-
if (typeof r == "object") return Array.isArray(r) ? i === void 0 || i === 0 ? (e) => y.createElement(n, q(void 0, t.toString()), J(r, t++)(e)) : (e) => y.createElement(n, q(void 0, t.toString()), J(r)(e), [i].concat(a).map((n) => J(n, t++)(e))) : i === void 0 ? () => y.createElement(n, q(r, t.toString())) : i === 0 ? (e) => y.createElement(n, q(r, t.toString()), e) : (e) => y.createElement(n, q(r, t.toString()), [i].concat(a).map((n) => J(n, t++)(e)));
|
|
158
|
-
}
|
|
159
|
-
throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping", { cause: e });
|
|
160
|
-
}
|
|
161
|
-
function _e({ content: e, extensions: t, options: n }) {
|
|
162
|
-
return me({
|
|
163
|
-
renderer: ge,
|
|
164
|
-
domOutputSpecToElement: J,
|
|
165
|
-
mapDefinedTypes: {
|
|
166
|
-
doc: ({ children: e }) => y.createElement(y.Fragment, {}, e),
|
|
167
|
-
text: ({ node: e }) => e.text ?? ""
|
|
168
|
-
},
|
|
169
|
-
content: e,
|
|
170
|
-
extensions: t,
|
|
171
|
-
options: n
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-bold@3.23.5_@tiptap+core@3.23.5_@tiptap+pm@3.23.5_/node_modules/@tiptap/extension-bold/dist/index.js
|
|
176
|
-
var ve = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, ye = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, be = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, xe = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Se = w.create({
|
|
177
|
-
name: "bold",
|
|
178
|
-
addOptions() {
|
|
179
|
-
return { HTMLAttributes: {} };
|
|
180
|
-
},
|
|
181
|
-
parseHTML() {
|
|
182
|
-
return [
|
|
183
|
-
{ tag: "strong" },
|
|
184
|
-
{
|
|
185
|
-
tag: "b",
|
|
186
|
-
getAttrs: (e) => e.style.fontWeight !== "normal" && null
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
style: "font-weight=400",
|
|
190
|
-
clearMark: (e) => e.type.name === this.name
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
style: "font-weight",
|
|
194
|
-
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
195
|
-
}
|
|
196
|
-
];
|
|
197
|
-
},
|
|
198
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
199
|
-
return /* @__PURE__ */ F("strong", {
|
|
200
|
-
...N(this.options.HTMLAttributes, e),
|
|
201
|
-
children: /* @__PURE__ */ F("slot", {})
|
|
202
|
-
});
|
|
203
|
-
},
|
|
204
|
-
markdownTokenName: "strong",
|
|
205
|
-
parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
|
|
206
|
-
markdownOptions: { htmlReopen: {
|
|
207
|
-
open: "<strong>",
|
|
208
|
-
close: "</strong>"
|
|
209
|
-
} },
|
|
210
|
-
renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
|
|
211
|
-
addCommands() {
|
|
212
|
-
return {
|
|
213
|
-
setBold: () => ({ commands: e }) => e.setMark(this.name),
|
|
214
|
-
toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
215
|
-
unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
addKeyboardShortcuts() {
|
|
219
|
-
return {
|
|
220
|
-
"Mod-b": () => this.editor.commands.toggleBold(),
|
|
221
|
-
"Mod-B": () => this.editor.commands.toggleBold()
|
|
222
|
-
};
|
|
223
|
-
},
|
|
224
|
-
addInputRules() {
|
|
225
|
-
return [j({
|
|
226
|
-
find: ve,
|
|
227
|
-
type: this.type
|
|
228
|
-
}), j({
|
|
229
|
-
find: be,
|
|
230
|
-
type: this.type
|
|
231
|
-
})];
|
|
232
|
-
},
|
|
233
|
-
addPasteRules() {
|
|
234
|
-
return [M({
|
|
235
|
-
find: ye,
|
|
236
|
-
type: this.type
|
|
237
|
-
}), M({
|
|
238
|
-
find: xe,
|
|
239
|
-
type: this.type
|
|
240
|
-
})];
|
|
241
|
-
}
|
|
242
|
-
}), Ce = /(^|[^`])`([^`]+)`(?!`)$/, we = /(^|[^`])`([^`]+)`(?!`)/g, Te = w.create({
|
|
243
|
-
name: "code",
|
|
244
|
-
addOptions() {
|
|
245
|
-
return { HTMLAttributes: {} };
|
|
246
|
-
},
|
|
247
|
-
excludes: "_",
|
|
248
|
-
code: !0,
|
|
249
|
-
exitable: !0,
|
|
250
|
-
parseHTML() {
|
|
251
|
-
return [{ tag: "code" }];
|
|
252
|
-
},
|
|
253
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
254
|
-
return [
|
|
255
|
-
"code",
|
|
256
|
-
N(this.options.HTMLAttributes, e),
|
|
257
|
-
0
|
|
258
|
-
];
|
|
259
|
-
},
|
|
260
|
-
markdownTokenName: "codespan",
|
|
261
|
-
parseMarkdown: (e, t) => t.applyMark("code", [{
|
|
262
|
-
type: "text",
|
|
263
|
-
text: e.text || ""
|
|
264
|
-
}]),
|
|
265
|
-
renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
|
|
266
|
-
addCommands() {
|
|
267
|
-
return {
|
|
268
|
-
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
269
|
-
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
270
|
-
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
271
|
-
};
|
|
272
|
-
},
|
|
273
|
-
addKeyboardShortcuts() {
|
|
274
|
-
return { "Mod-e": () => this.editor.commands.toggleCode() };
|
|
275
|
-
},
|
|
276
|
-
addInputRules() {
|
|
277
|
-
return [j({
|
|
278
|
-
find: Ce,
|
|
279
|
-
type: this.type
|
|
280
|
-
})];
|
|
281
|
-
},
|
|
282
|
-
addPasteRules() {
|
|
283
|
-
return [M({
|
|
284
|
-
find: we,
|
|
285
|
-
type: this.type
|
|
286
|
-
})];
|
|
287
|
-
}
|
|
288
|
-
}), Ee = T.create({
|
|
289
|
-
name: "hardBreak",
|
|
290
|
-
markdownTokenName: "br",
|
|
291
|
-
addOptions() {
|
|
292
|
-
return {
|
|
293
|
-
keepMarks: !0,
|
|
294
|
-
HTMLAttributes: {}
|
|
295
|
-
};
|
|
296
|
-
},
|
|
297
|
-
inline: !0,
|
|
298
|
-
group: "inline",
|
|
299
|
-
selectable: !1,
|
|
300
|
-
linebreakReplacement: !0,
|
|
301
|
-
parseHTML() {
|
|
302
|
-
return [{ tag: "br" }];
|
|
303
|
-
},
|
|
304
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
305
|
-
return ["br", N(this.options.HTMLAttributes, e)];
|
|
306
|
-
},
|
|
307
|
-
renderText() {
|
|
308
|
-
return "\n";
|
|
309
|
-
},
|
|
310
|
-
renderMarkdown: () => " \n",
|
|
311
|
-
parseMarkdown: () => ({ type: "hardBreak" }),
|
|
312
|
-
addCommands() {
|
|
313
|
-
return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
|
|
314
|
-
let { selection: e, storedMarks: i } = n;
|
|
315
|
-
if (e.$from.parent.type.spec.isolating) return !1;
|
|
316
|
-
let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
|
|
317
|
-
return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
|
|
318
|
-
if (t && s && a) {
|
|
319
|
-
let t = s.filter((e) => o.includes(e.type.name));
|
|
320
|
-
e.ensureMarks(t);
|
|
321
|
-
}
|
|
322
|
-
return !0;
|
|
323
|
-
}).run();
|
|
324
|
-
})]) };
|
|
325
|
-
},
|
|
326
|
-
addKeyboardShortcuts() {
|
|
327
|
-
return {
|
|
328
|
-
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
329
|
-
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
}), De = T.create({
|
|
333
|
-
name: "heading",
|
|
334
|
-
addOptions() {
|
|
335
|
-
return {
|
|
336
|
-
levels: [
|
|
337
|
-
1,
|
|
338
|
-
2,
|
|
339
|
-
3,
|
|
340
|
-
4,
|
|
341
|
-
5,
|
|
342
|
-
6
|
|
343
|
-
],
|
|
344
|
-
HTMLAttributes: {}
|
|
345
|
-
};
|
|
346
|
-
},
|
|
347
|
-
content: "inline*",
|
|
348
|
-
group: "block",
|
|
349
|
-
defining: !0,
|
|
350
|
-
addAttributes() {
|
|
351
|
-
return { level: {
|
|
352
|
-
default: 1,
|
|
353
|
-
rendered: !1
|
|
354
|
-
} };
|
|
355
|
-
},
|
|
356
|
-
parseHTML() {
|
|
357
|
-
return this.options.levels.map((e) => ({
|
|
358
|
-
tag: `h${e}`,
|
|
359
|
-
attrs: { level: e }
|
|
360
|
-
}));
|
|
361
|
-
},
|
|
362
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
363
|
-
return [
|
|
364
|
-
`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
|
|
365
|
-
N(this.options.HTMLAttributes, t),
|
|
366
|
-
0
|
|
367
|
-
];
|
|
368
|
-
},
|
|
369
|
-
parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
|
|
370
|
-
renderMarkdown: (e, t) => {
|
|
371
|
-
let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
|
|
372
|
-
return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
|
|
373
|
-
},
|
|
374
|
-
addCommands() {
|
|
375
|
-
return {
|
|
376
|
-
setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
|
|
377
|
-
toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
|
|
378
|
-
};
|
|
379
|
-
},
|
|
380
|
-
addKeyboardShortcuts() {
|
|
381
|
-
return this.options.levels.reduce((e, t) => ({
|
|
382
|
-
...e,
|
|
383
|
-
[`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
|
|
384
|
-
}), {});
|
|
385
|
-
},
|
|
386
|
-
addInputRules() {
|
|
387
|
-
return this.options.levels.map((e) => se({
|
|
388
|
-
find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
389
|
-
type: this.type,
|
|
390
|
-
getAttributes: { level: e }
|
|
391
|
-
}));
|
|
392
|
-
}
|
|
393
|
-
}), Oe = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, ke = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Ae = w.create({
|
|
394
|
-
name: "highlight",
|
|
395
|
-
addOptions() {
|
|
396
|
-
return {
|
|
397
|
-
multicolor: !1,
|
|
398
|
-
HTMLAttributes: {}
|
|
399
|
-
};
|
|
400
|
-
},
|
|
401
|
-
addAttributes() {
|
|
402
|
-
return this.options.multicolor ? { color: {
|
|
403
|
-
default: null,
|
|
404
|
-
parseHTML: (e) => e.getAttribute("data-color") || A(e, "background-color") || e.style.backgroundColor,
|
|
405
|
-
renderHTML: (e) => e.color ? {
|
|
406
|
-
"data-color": e.color,
|
|
407
|
-
style: `background-color: ${e.color}; color: inherit`
|
|
408
|
-
} : {}
|
|
409
|
-
} } : {};
|
|
410
|
-
},
|
|
411
|
-
parseHTML() {
|
|
412
|
-
return [{ tag: "mark" }];
|
|
413
|
-
},
|
|
414
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
415
|
-
return [
|
|
416
|
-
"mark",
|
|
417
|
-
N(this.options.HTMLAttributes, e),
|
|
418
|
-
0
|
|
419
|
-
];
|
|
420
|
-
},
|
|
421
|
-
renderMarkdown: (e, t) => `==${t.renderChildren(e)}==`,
|
|
422
|
-
parseMarkdown: (e, t) => t.applyMark("highlight", t.parseInline(e.tokens || [])),
|
|
423
|
-
markdownTokenizer: {
|
|
424
|
-
name: "highlight",
|
|
425
|
-
level: "inline",
|
|
426
|
-
start: (e) => e.indexOf("=="),
|
|
427
|
-
tokenize(e, t, n) {
|
|
428
|
-
let r = /^(==)([^=]+)(==)/.exec(e);
|
|
429
|
-
if (r) {
|
|
430
|
-
let e = r[2].trim(), t = n.inlineTokens(e);
|
|
431
|
-
return {
|
|
432
|
-
type: "highlight",
|
|
433
|
-
raw: r[0],
|
|
434
|
-
text: e,
|
|
435
|
-
tokens: t
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
addCommands() {
|
|
441
|
-
return {
|
|
442
|
-
setHighlight: (e) => ({ commands: t }) => t.setMark(this.name, e),
|
|
443
|
-
toggleHighlight: (e) => ({ commands: t }) => t.toggleMark(this.name, e),
|
|
444
|
-
unsetHighlight: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
445
|
-
};
|
|
446
|
-
},
|
|
447
|
-
addKeyboardShortcuts() {
|
|
448
|
-
return { "Mod-Shift-h": () => this.editor.commands.toggleHighlight() };
|
|
449
|
-
},
|
|
450
|
-
addInputRules() {
|
|
451
|
-
return [j({
|
|
452
|
-
find: Oe,
|
|
453
|
-
type: this.type
|
|
454
|
-
})];
|
|
455
|
-
},
|
|
456
|
-
addPasteRules() {
|
|
457
|
-
return [M({
|
|
458
|
-
find: ke,
|
|
459
|
-
type: this.type
|
|
460
|
-
})];
|
|
461
|
-
}
|
|
462
|
-
}), je = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Me = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Ne = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Pe = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Fe = w.create({
|
|
463
|
-
name: "italic",
|
|
464
|
-
addOptions() {
|
|
465
|
-
return { HTMLAttributes: {} };
|
|
466
|
-
},
|
|
467
|
-
parseHTML() {
|
|
468
|
-
return [
|
|
469
|
-
{ tag: "em" },
|
|
470
|
-
{
|
|
471
|
-
tag: "i",
|
|
472
|
-
getAttrs: (e) => e.style.fontStyle !== "normal" && null
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
style: "font-style=normal",
|
|
476
|
-
clearMark: (e) => e.type.name === this.name
|
|
477
|
-
},
|
|
478
|
-
{ style: "font-style=italic" }
|
|
479
|
-
];
|
|
480
|
-
},
|
|
481
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
482
|
-
return [
|
|
483
|
-
"em",
|
|
484
|
-
N(this.options.HTMLAttributes, e),
|
|
485
|
-
0
|
|
486
|
-
];
|
|
487
|
-
},
|
|
488
|
-
addCommands() {
|
|
489
|
-
return {
|
|
490
|
-
setItalic: () => ({ commands: e }) => e.setMark(this.name),
|
|
491
|
-
toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
492
|
-
unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
493
|
-
};
|
|
494
|
-
},
|
|
495
|
-
markdownTokenName: "em",
|
|
496
|
-
parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
|
|
497
|
-
markdownOptions: { htmlReopen: {
|
|
498
|
-
open: "<em>",
|
|
499
|
-
close: "</em>"
|
|
500
|
-
} },
|
|
501
|
-
renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
|
|
502
|
-
addKeyboardShortcuts() {
|
|
503
|
-
return {
|
|
504
|
-
"Mod-i": () => this.editor.commands.toggleItalic(),
|
|
505
|
-
"Mod-I": () => this.editor.commands.toggleItalic()
|
|
506
|
-
};
|
|
507
|
-
},
|
|
508
|
-
addInputRules() {
|
|
509
|
-
return [j({
|
|
510
|
-
find: je,
|
|
511
|
-
type: this.type
|
|
512
|
-
}), j({
|
|
513
|
-
find: Ne,
|
|
514
|
-
type: this.type
|
|
515
|
-
})];
|
|
516
|
-
},
|
|
517
|
-
addPasteRules() {
|
|
518
|
-
return [M({
|
|
519
|
-
find: Me,
|
|
520
|
-
type: this.type
|
|
521
|
-
}), M({
|
|
522
|
-
find: Pe,
|
|
523
|
-
type: this.type
|
|
524
|
-
})];
|
|
525
|
-
}
|
|
526
|
-
}), Y = " ", X = "\xA0", Ie = T.create({
|
|
527
|
-
name: "paragraph",
|
|
528
|
-
priority: 1e3,
|
|
529
|
-
addOptions() {
|
|
530
|
-
return { HTMLAttributes: {} };
|
|
531
|
-
},
|
|
532
|
-
group: "block",
|
|
533
|
-
content: "inline*",
|
|
534
|
-
parseHTML() {
|
|
535
|
-
return [{ tag: "p" }];
|
|
536
|
-
},
|
|
537
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
538
|
-
return [
|
|
539
|
-
"p",
|
|
540
|
-
N(this.options.HTMLAttributes, e),
|
|
541
|
-
0
|
|
542
|
-
];
|
|
543
|
-
},
|
|
544
|
-
parseMarkdown: (e, t) => {
|
|
545
|
-
let n = e.tokens || [];
|
|
546
|
-
if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
|
|
547
|
-
let r = t.parseInline(n);
|
|
548
|
-
return n.length === 1 && n[0].type === "text" && (n[0].raw === Y || n[0].text === Y || n[0].raw === X || n[0].text === X) && r.length === 1 && r[0].type === "text" && (r[0].text === Y || r[0].text === X) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
|
|
549
|
-
},
|
|
550
|
-
renderMarkdown: (e, t, n) => {
|
|
551
|
-
if (!e) return "";
|
|
552
|
-
let r = Array.isArray(e.content) ? e.content : [];
|
|
553
|
-
if (r.length === 0) {
|
|
554
|
-
let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
|
|
555
|
-
return n?.previousNode?.type === "paragraph" && e.length === 0 ? Y : "";
|
|
556
|
-
}
|
|
557
|
-
return t.renderChildren(r);
|
|
558
|
-
},
|
|
559
|
-
addCommands() {
|
|
560
|
-
return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
|
|
561
|
-
},
|
|
562
|
-
addKeyboardShortcuts() {
|
|
563
|
-
return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
|
|
564
|
-
}
|
|
565
|
-
}), Le = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Re = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, ze = w.create({
|
|
566
|
-
name: "strike",
|
|
567
|
-
addOptions() {
|
|
568
|
-
return { HTMLAttributes: {} };
|
|
569
|
-
},
|
|
570
|
-
parseHTML() {
|
|
571
|
-
return [
|
|
572
|
-
{ tag: "s" },
|
|
573
|
-
{ tag: "del" },
|
|
574
|
-
{ tag: "strike" },
|
|
575
|
-
{
|
|
576
|
-
style: "text-decoration",
|
|
577
|
-
consuming: !1,
|
|
578
|
-
getAttrs: (e) => e.includes("line-through") ? {} : !1
|
|
579
|
-
}
|
|
580
|
-
];
|
|
581
|
-
},
|
|
582
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
583
|
-
return [
|
|
584
|
-
"s",
|
|
585
|
-
N(this.options.HTMLAttributes, e),
|
|
586
|
-
0
|
|
587
|
-
];
|
|
588
|
-
},
|
|
589
|
-
markdownTokenName: "del",
|
|
590
|
-
parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
|
|
591
|
-
renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
|
|
592
|
-
addCommands() {
|
|
593
|
-
return {
|
|
594
|
-
setStrike: () => ({ commands: e }) => e.setMark(this.name),
|
|
595
|
-
toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
596
|
-
unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
597
|
-
};
|
|
598
|
-
},
|
|
599
|
-
addKeyboardShortcuts() {
|
|
600
|
-
return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
|
|
601
|
-
},
|
|
602
|
-
addInputRules() {
|
|
603
|
-
return [j({
|
|
604
|
-
find: Le,
|
|
605
|
-
type: this.type
|
|
606
|
-
})];
|
|
607
|
-
},
|
|
608
|
-
addPasteRules() {
|
|
609
|
-
return [M({
|
|
610
|
-
find: Re,
|
|
611
|
-
type: this.type
|
|
612
|
-
})];
|
|
613
|
-
}
|
|
614
|
-
}), Be = T.create({
|
|
615
|
-
name: "text",
|
|
616
|
-
group: "inline",
|
|
617
|
-
parseMarkdown: (e) => ({
|
|
618
|
-
type: "text",
|
|
619
|
-
text: e.text || ""
|
|
620
|
-
}),
|
|
621
|
-
renderMarkdown: (e) => e.text || ""
|
|
622
|
-
}), Ve = w.create({
|
|
623
|
-
name: "underline",
|
|
624
|
-
addOptions() {
|
|
625
|
-
return { HTMLAttributes: {} };
|
|
626
|
-
},
|
|
627
|
-
parseHTML() {
|
|
628
|
-
return [{ tag: "u" }, {
|
|
629
|
-
style: "text-decoration",
|
|
630
|
-
consuming: !1,
|
|
631
|
-
getAttrs: (e) => e.includes("underline") ? {} : !1
|
|
632
|
-
}];
|
|
633
|
-
},
|
|
634
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
635
|
-
return [
|
|
636
|
-
"u",
|
|
637
|
-
N(this.options.HTMLAttributes, e),
|
|
638
|
-
0
|
|
639
|
-
];
|
|
640
|
-
},
|
|
641
|
-
parseMarkdown(e, t) {
|
|
642
|
-
return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
|
|
643
|
-
},
|
|
644
|
-
renderMarkdown(e, t) {
|
|
645
|
-
return `++${t.renderChildren(e)}++`;
|
|
646
|
-
},
|
|
647
|
-
markdownTokenizer: {
|
|
648
|
-
name: "underline",
|
|
649
|
-
level: "inline",
|
|
650
|
-
start(e) {
|
|
651
|
-
return e.indexOf("++");
|
|
652
|
-
},
|
|
653
|
-
tokenize(e, t, n) {
|
|
654
|
-
let r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
|
|
655
|
-
if (!r) return;
|
|
656
|
-
let i = r[2].trim();
|
|
657
|
-
return {
|
|
658
|
-
type: "underline",
|
|
659
|
-
raw: r[0],
|
|
660
|
-
text: i,
|
|
661
|
-
tokens: n.inlineTokens(i)
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
addCommands() {
|
|
666
|
-
return {
|
|
667
|
-
setUnderline: () => ({ commands: e }) => e.setMark(this.name),
|
|
668
|
-
toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
669
|
-
unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
670
|
-
};
|
|
671
|
-
},
|
|
672
|
-
addKeyboardShortcuts() {
|
|
673
|
-
return {
|
|
674
|
-
"Mod-u": () => this.editor.commands.toggleUnderline(),
|
|
675
|
-
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
}), He = {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { Extension as t, Mark as n, Node as r, extensions as i, getAttributesFromExtensions as a, getExtensionField as o, getSchema as s, getSchemaByResolvedExtensions as c, getStyleProperty as l, markInputRule as u, markPasteRule as d, mergeAttributes as f, resolveExtensions as ee, splitExtensions as te, textblockTypeInputRule as p } from "@tiptap/core";
|
|
3
|
+
import { Color as m } from "@tiptap/extension-text-style";
|
|
4
|
+
import { BulletList as h, ListItem as ne, OrderedList as re } from "@tiptap/extension-list";
|
|
5
|
+
import { jsx as g } from "@tiptap/core/jsx-runtime";
|
|
6
|
+
import { DOMParser as ie, Node as _, Schema as ae } from "@tiptap/pm/model";
|
|
7
|
+
//#region ../../libraries/editor-core/dist/extensions/emoji/emojiMap.js
|
|
8
|
+
var oe = {
|
|
679
9
|
100: "1f4af",
|
|
680
10
|
1234: "1f522",
|
|
681
11
|
regional_indicator_a: "🇦",
|
|
@@ -2609,197 +1939,833 @@ var ve = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, ye = /(?:^|\s)(
|
|
|
2609
1939
|
england: "1f3f4-e0067-e0062-e0065-e006e-e0067-e007f",
|
|
2610
1940
|
scotland: "1f3f4-e0067-e0062-e0073-e0063-e0074-e007f",
|
|
2611
1941
|
wales: "1f3f4-e0067-e0062-e0077-e006c-e0073-e007f"
|
|
2612
|
-
},
|
|
1942
|
+
}, se = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64", ce = (e) => /^[A-Fa-f0-9-]+$/.test(e), le = r.create({
|
|
2613
1943
|
name: "emoji",
|
|
2614
1944
|
inline: !0,
|
|
2615
1945
|
group: "inline",
|
|
2616
1946
|
selectable: !1,
|
|
2617
|
-
atom: !0,
|
|
1947
|
+
atom: !0,
|
|
1948
|
+
addAttributes() {
|
|
1949
|
+
return { name: {
|
|
1950
|
+
default: null,
|
|
1951
|
+
parseHTML: (e) => e.dataset.name,
|
|
1952
|
+
renderHTML: (e) => ({ "data-name": e.name })
|
|
1953
|
+
} };
|
|
1954
|
+
},
|
|
1955
|
+
parseHTML() {
|
|
1956
|
+
return [{ tag: "span[data-type=\"emoji\"]" }];
|
|
1957
|
+
},
|
|
1958
|
+
renderHTML({ HTMLAttributes: e, node: t }) {
|
|
1959
|
+
let n = f(e, { "data-type": "emoji" }), r = t.attrs.name, i = r ? oe[r] : void 0;
|
|
1960
|
+
return i ? ce(i) ? [
|
|
1961
|
+
"span",
|
|
1962
|
+
n,
|
|
1963
|
+
["img", {
|
|
1964
|
+
src: `${se}/${i}.png`,
|
|
1965
|
+
draggable: "false",
|
|
1966
|
+
loading: "lazy",
|
|
1967
|
+
align: "absmiddle",
|
|
1968
|
+
alt: `${r} emoji`
|
|
1969
|
+
}]
|
|
1970
|
+
] : [
|
|
1971
|
+
"span",
|
|
1972
|
+
n,
|
|
1973
|
+
i
|
|
1974
|
+
] : [
|
|
1975
|
+
"span",
|
|
1976
|
+
n,
|
|
1977
|
+
`:${r || "emoji"}:`
|
|
1978
|
+
];
|
|
1979
|
+
}
|
|
1980
|
+
}), ue = t.create({
|
|
1981
|
+
name: "fontSize",
|
|
1982
|
+
addOptions() {
|
|
1983
|
+
return { types: ["textStyle"] };
|
|
1984
|
+
},
|
|
1985
|
+
addGlobalAttributes() {
|
|
1986
|
+
return [{
|
|
1987
|
+
types: this.options.types,
|
|
1988
|
+
attributes: { fontSize: {
|
|
1989
|
+
default: null,
|
|
1990
|
+
parseHTML: (e) => e.style.fontSize.replace(/['"]+/g, ""),
|
|
1991
|
+
renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
|
|
1992
|
+
} }
|
|
1993
|
+
}];
|
|
1994
|
+
},
|
|
1995
|
+
addCommands() {
|
|
1996
|
+
return {
|
|
1997
|
+
setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
|
|
1998
|
+
unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
}), de = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, v = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, y = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, x = n.create({
|
|
2002
|
+
name: "bold",
|
|
2003
|
+
addOptions() {
|
|
2004
|
+
return { HTMLAttributes: {} };
|
|
2005
|
+
},
|
|
2006
|
+
parseHTML() {
|
|
2007
|
+
return [
|
|
2008
|
+
{ tag: "strong" },
|
|
2009
|
+
{
|
|
2010
|
+
tag: "b",
|
|
2011
|
+
getAttrs: (e) => e.style.fontWeight !== "normal" && null
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
style: "font-weight=400",
|
|
2015
|
+
clearMark: (e) => e.type.name === this.name
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
style: "font-weight",
|
|
2019
|
+
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
2020
|
+
}
|
|
2021
|
+
];
|
|
2022
|
+
},
|
|
2023
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2024
|
+
return /* @__PURE__ */ g("strong", {
|
|
2025
|
+
...f(this.options.HTMLAttributes, e),
|
|
2026
|
+
children: /* @__PURE__ */ g("slot", {})
|
|
2027
|
+
});
|
|
2028
|
+
},
|
|
2029
|
+
markdownTokenName: "strong",
|
|
2030
|
+
parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
|
|
2031
|
+
markdownOptions: { htmlReopen: {
|
|
2032
|
+
open: "<strong>",
|
|
2033
|
+
close: "</strong>"
|
|
2034
|
+
} },
|
|
2035
|
+
renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
|
|
2036
|
+
addCommands() {
|
|
2037
|
+
return {
|
|
2038
|
+
setBold: () => ({ commands: e }) => e.setMark(this.name),
|
|
2039
|
+
toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
2040
|
+
unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2041
|
+
};
|
|
2042
|
+
},
|
|
2043
|
+
addKeyboardShortcuts() {
|
|
2044
|
+
return {
|
|
2045
|
+
"Mod-b": () => this.editor.commands.toggleBold(),
|
|
2046
|
+
"Mod-B": () => this.editor.commands.toggleBold()
|
|
2047
|
+
};
|
|
2048
|
+
},
|
|
2049
|
+
addInputRules() {
|
|
2050
|
+
return [u({
|
|
2051
|
+
find: de,
|
|
2052
|
+
type: this.type
|
|
2053
|
+
}), u({
|
|
2054
|
+
find: y,
|
|
2055
|
+
type: this.type
|
|
2056
|
+
})];
|
|
2057
|
+
},
|
|
2058
|
+
addPasteRules() {
|
|
2059
|
+
return [d({
|
|
2060
|
+
find: v,
|
|
2061
|
+
type: this.type
|
|
2062
|
+
}), d({
|
|
2063
|
+
find: b,
|
|
2064
|
+
type: this.type
|
|
2065
|
+
})];
|
|
2066
|
+
}
|
|
2067
|
+
}), S = (e) => {
|
|
2068
|
+
let t = /`([^`]+)`(?!`)$/.exec(e);
|
|
2069
|
+
return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
|
|
2070
|
+
index: t.index,
|
|
2071
|
+
text: t[0],
|
|
2072
|
+
replaceWith: t[1]
|
|
2073
|
+
};
|
|
2074
|
+
}, C = (e) => {
|
|
2075
|
+
let t = /`([^`]+)`(?!`)/g, n = [], r;
|
|
2076
|
+
for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
|
|
2077
|
+
index: r.index,
|
|
2078
|
+
text: r[0],
|
|
2079
|
+
replaceWith: r[1]
|
|
2080
|
+
});
|
|
2081
|
+
return n;
|
|
2082
|
+
}, w = n.create({
|
|
2083
|
+
name: "code",
|
|
2084
|
+
addOptions() {
|
|
2085
|
+
return { HTMLAttributes: {} };
|
|
2086
|
+
},
|
|
2087
|
+
excludes: "_",
|
|
2088
|
+
code: !0,
|
|
2089
|
+
exitable: !0,
|
|
2090
|
+
parseHTML() {
|
|
2091
|
+
return [{ tag: "code" }];
|
|
2092
|
+
},
|
|
2093
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2094
|
+
return [
|
|
2095
|
+
"code",
|
|
2096
|
+
f(this.options.HTMLAttributes, e),
|
|
2097
|
+
0
|
|
2098
|
+
];
|
|
2099
|
+
},
|
|
2100
|
+
markdownTokenName: "codespan",
|
|
2101
|
+
parseMarkdown: (e, t) => t.applyMark("code", [{
|
|
2102
|
+
type: "text",
|
|
2103
|
+
text: e.text || ""
|
|
2104
|
+
}]),
|
|
2105
|
+
renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
|
|
2106
|
+
addCommands() {
|
|
2107
|
+
return {
|
|
2108
|
+
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
2109
|
+
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
2110
|
+
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2111
|
+
};
|
|
2112
|
+
},
|
|
2113
|
+
addKeyboardShortcuts() {
|
|
2114
|
+
return { "Mod-e": () => this.editor.commands.toggleCode() };
|
|
2115
|
+
},
|
|
2116
|
+
addInputRules() {
|
|
2117
|
+
return [u({
|
|
2118
|
+
find: S,
|
|
2119
|
+
type: this.type
|
|
2120
|
+
})];
|
|
2121
|
+
},
|
|
2122
|
+
addPasteRules() {
|
|
2123
|
+
return [d({
|
|
2124
|
+
find: C,
|
|
2125
|
+
type: this.type
|
|
2126
|
+
})];
|
|
2127
|
+
}
|
|
2128
|
+
}), T = r.create({
|
|
2129
|
+
name: "hardBreak",
|
|
2130
|
+
markdownTokenName: "br",
|
|
2131
|
+
addOptions() {
|
|
2132
|
+
return {
|
|
2133
|
+
keepMarks: !0,
|
|
2134
|
+
HTMLAttributes: {}
|
|
2135
|
+
};
|
|
2136
|
+
},
|
|
2137
|
+
inline: !0,
|
|
2138
|
+
group: "inline",
|
|
2139
|
+
selectable: !1,
|
|
2140
|
+
linebreakReplacement: !0,
|
|
2141
|
+
parseHTML() {
|
|
2142
|
+
return [{ tag: "br" }];
|
|
2143
|
+
},
|
|
2144
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2145
|
+
return ["br", f(this.options.HTMLAttributes, e)];
|
|
2146
|
+
},
|
|
2147
|
+
renderText() {
|
|
2148
|
+
return "\n";
|
|
2149
|
+
},
|
|
2150
|
+
renderMarkdown: () => " \n",
|
|
2151
|
+
parseMarkdown: () => ({ type: "hardBreak" }),
|
|
2152
|
+
addCommands() {
|
|
2153
|
+
return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
|
|
2154
|
+
let { selection: e, storedMarks: i } = n;
|
|
2155
|
+
if (e.$from.parent.type.spec.isolating) return !1;
|
|
2156
|
+
let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
|
|
2157
|
+
return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
|
|
2158
|
+
if (t && s && a) {
|
|
2159
|
+
let t = s.filter((e) => o.includes(e.type.name));
|
|
2160
|
+
e.ensureMarks(t);
|
|
2161
|
+
}
|
|
2162
|
+
return !0;
|
|
2163
|
+
}).scrollIntoView().run();
|
|
2164
|
+
})]) };
|
|
2165
|
+
},
|
|
2166
|
+
addKeyboardShortcuts() {
|
|
2167
|
+
return {
|
|
2168
|
+
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
2169
|
+
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
}), E = r.create({
|
|
2173
|
+
name: "heading",
|
|
2174
|
+
addOptions() {
|
|
2175
|
+
return {
|
|
2176
|
+
levels: [
|
|
2177
|
+
1,
|
|
2178
|
+
2,
|
|
2179
|
+
3,
|
|
2180
|
+
4,
|
|
2181
|
+
5,
|
|
2182
|
+
6
|
|
2183
|
+
],
|
|
2184
|
+
HTMLAttributes: {}
|
|
2185
|
+
};
|
|
2186
|
+
},
|
|
2187
|
+
content: "inline*",
|
|
2188
|
+
group: "block",
|
|
2189
|
+
defining: !0,
|
|
2618
2190
|
addAttributes() {
|
|
2619
|
-
return {
|
|
2620
|
-
default:
|
|
2621
|
-
|
|
2622
|
-
renderHTML: (e) => ({ "data-name": e.name })
|
|
2191
|
+
return { level: {
|
|
2192
|
+
default: 1,
|
|
2193
|
+
rendered: !1
|
|
2623
2194
|
} };
|
|
2624
2195
|
},
|
|
2625
2196
|
parseHTML() {
|
|
2626
|
-
return
|
|
2197
|
+
return this.options.levels.map((e) => ({
|
|
2198
|
+
tag: `h${e}`,
|
|
2199
|
+
attrs: { level: e }
|
|
2200
|
+
}));
|
|
2201
|
+
},
|
|
2202
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2203
|
+
return [
|
|
2204
|
+
`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
|
|
2205
|
+
f(this.options.HTMLAttributes, t),
|
|
2206
|
+
0
|
|
2207
|
+
];
|
|
2208
|
+
},
|
|
2209
|
+
parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
|
|
2210
|
+
renderMarkdown: (e, t) => {
|
|
2211
|
+
let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
|
|
2212
|
+
return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
|
|
2213
|
+
},
|
|
2214
|
+
addCommands() {
|
|
2215
|
+
return {
|
|
2216
|
+
setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
|
|
2217
|
+
toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
|
|
2218
|
+
};
|
|
2219
|
+
},
|
|
2220
|
+
addKeyboardShortcuts() {
|
|
2221
|
+
return this.options.levels.reduce((e, t) => ({
|
|
2222
|
+
...e,
|
|
2223
|
+
[`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
|
|
2224
|
+
}), {});
|
|
2225
|
+
},
|
|
2226
|
+
addInputRules() {
|
|
2227
|
+
return this.options.levels.map((e) => p({
|
|
2228
|
+
find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
2229
|
+
type: this.type,
|
|
2230
|
+
getAttributes: { level: e }
|
|
2231
|
+
}));
|
|
2232
|
+
}
|
|
2233
|
+
}), D = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, O = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, k = n.create({
|
|
2234
|
+
name: "highlight",
|
|
2235
|
+
addOptions() {
|
|
2236
|
+
return {
|
|
2237
|
+
multicolor: !1,
|
|
2238
|
+
HTMLAttributes: {}
|
|
2239
|
+
};
|
|
2240
|
+
},
|
|
2241
|
+
addAttributes() {
|
|
2242
|
+
return this.options.multicolor ? { color: {
|
|
2243
|
+
default: null,
|
|
2244
|
+
parseHTML: (e) => e.getAttribute("data-color") || l(e, "background-color") || e.style.backgroundColor,
|
|
2245
|
+
renderHTML: (e) => e.color ? {
|
|
2246
|
+
"data-color": e.color,
|
|
2247
|
+
style: `background-color: ${e.color}; color: inherit`
|
|
2248
|
+
} : {}
|
|
2249
|
+
} } : {};
|
|
2250
|
+
},
|
|
2251
|
+
parseHTML() {
|
|
2252
|
+
return [{ tag: "mark" }];
|
|
2253
|
+
},
|
|
2254
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2255
|
+
return [
|
|
2256
|
+
"mark",
|
|
2257
|
+
f(this.options.HTMLAttributes, e),
|
|
2258
|
+
0
|
|
2259
|
+
];
|
|
2260
|
+
},
|
|
2261
|
+
renderMarkdown: (e, t) => `==${t.renderChildren(e)}==`,
|
|
2262
|
+
parseMarkdown: (e, t) => t.applyMark("highlight", t.parseInline(e.tokens || [])),
|
|
2263
|
+
markdownTokenizer: {
|
|
2264
|
+
name: "highlight",
|
|
2265
|
+
level: "inline",
|
|
2266
|
+
start: (e) => e.indexOf("=="),
|
|
2267
|
+
tokenize(e, t, n) {
|
|
2268
|
+
let r = /^(==)([^=]+)(==)/.exec(e);
|
|
2269
|
+
if (r) {
|
|
2270
|
+
let e = r[2].trim(), t = n.inlineTokens(e);
|
|
2271
|
+
return {
|
|
2272
|
+
type: "highlight",
|
|
2273
|
+
raw: r[0],
|
|
2274
|
+
text: e,
|
|
2275
|
+
tokens: t
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
addCommands() {
|
|
2281
|
+
return {
|
|
2282
|
+
setHighlight: (e) => ({ commands: t }) => t.setMark(this.name, e),
|
|
2283
|
+
toggleHighlight: (e) => ({ commands: t }) => t.toggleMark(this.name, e),
|
|
2284
|
+
unsetHighlight: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2285
|
+
};
|
|
2286
|
+
},
|
|
2287
|
+
addKeyboardShortcuts() {
|
|
2288
|
+
return { "Mod-Shift-h": () => this.editor.commands.toggleHighlight() };
|
|
2289
|
+
},
|
|
2290
|
+
addInputRules() {
|
|
2291
|
+
return [u({
|
|
2292
|
+
find: D,
|
|
2293
|
+
type: this.type
|
|
2294
|
+
})];
|
|
2295
|
+
},
|
|
2296
|
+
addPasteRules() {
|
|
2297
|
+
return [d({
|
|
2298
|
+
find: O,
|
|
2299
|
+
type: this.type
|
|
2300
|
+
})];
|
|
2301
|
+
}
|
|
2302
|
+
}), A = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, j = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, M = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, N = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, P = n.create({
|
|
2303
|
+
name: "italic",
|
|
2304
|
+
addOptions() {
|
|
2305
|
+
return { HTMLAttributes: {} };
|
|
2306
|
+
},
|
|
2307
|
+
parseHTML() {
|
|
2308
|
+
return [
|
|
2309
|
+
{ tag: "em" },
|
|
2310
|
+
{
|
|
2311
|
+
tag: "i",
|
|
2312
|
+
getAttrs: (e) => e.style.fontStyle !== "normal" && null
|
|
2313
|
+
},
|
|
2314
|
+
{
|
|
2315
|
+
style: "font-style=normal",
|
|
2316
|
+
clearMark: (e) => e.type.name === this.name
|
|
2317
|
+
},
|
|
2318
|
+
{ style: "font-style=italic" }
|
|
2319
|
+
];
|
|
2320
|
+
},
|
|
2321
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2322
|
+
return [
|
|
2323
|
+
"em",
|
|
2324
|
+
f(this.options.HTMLAttributes, e),
|
|
2325
|
+
0
|
|
2326
|
+
];
|
|
2327
|
+
},
|
|
2328
|
+
addCommands() {
|
|
2329
|
+
return {
|
|
2330
|
+
setItalic: () => ({ commands: e }) => e.setMark(this.name),
|
|
2331
|
+
toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
2332
|
+
unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2333
|
+
};
|
|
2334
|
+
},
|
|
2335
|
+
markdownTokenName: "em",
|
|
2336
|
+
parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
|
|
2337
|
+
markdownOptions: { htmlReopen: {
|
|
2338
|
+
open: "<em>",
|
|
2339
|
+
close: "</em>"
|
|
2340
|
+
} },
|
|
2341
|
+
renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
|
|
2342
|
+
addKeyboardShortcuts() {
|
|
2343
|
+
return {
|
|
2344
|
+
"Mod-i": () => this.editor.commands.toggleItalic(),
|
|
2345
|
+
"Mod-I": () => this.editor.commands.toggleItalic()
|
|
2346
|
+
};
|
|
2347
|
+
},
|
|
2348
|
+
addInputRules() {
|
|
2349
|
+
return [u({
|
|
2350
|
+
find: A,
|
|
2351
|
+
type: this.type
|
|
2352
|
+
}), u({
|
|
2353
|
+
find: M,
|
|
2354
|
+
type: this.type
|
|
2355
|
+
})];
|
|
2356
|
+
},
|
|
2357
|
+
addPasteRules() {
|
|
2358
|
+
return [d({
|
|
2359
|
+
find: j,
|
|
2360
|
+
type: this.type
|
|
2361
|
+
}), d({
|
|
2362
|
+
find: N,
|
|
2363
|
+
type: this.type
|
|
2364
|
+
})];
|
|
2365
|
+
}
|
|
2366
|
+
}), F = " ", I = "\xA0", L = r.create({
|
|
2367
|
+
name: "paragraph",
|
|
2368
|
+
priority: 1e3,
|
|
2369
|
+
addOptions() {
|
|
2370
|
+
return { HTMLAttributes: {} };
|
|
2371
|
+
},
|
|
2372
|
+
group: "block",
|
|
2373
|
+
content: "inline*",
|
|
2374
|
+
parseHTML() {
|
|
2375
|
+
return [{ tag: "p" }];
|
|
2376
|
+
},
|
|
2377
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2378
|
+
return [
|
|
2379
|
+
"p",
|
|
2380
|
+
f(this.options.HTMLAttributes, e),
|
|
2381
|
+
0
|
|
2382
|
+
];
|
|
2383
|
+
},
|
|
2384
|
+
parseMarkdown: (e, t) => {
|
|
2385
|
+
let n = e.tokens || [];
|
|
2386
|
+
if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
|
|
2387
|
+
let r = t.parseInline(n);
|
|
2388
|
+
return n.length === 1 && n[0].type === "text" && (n[0].raw === F || n[0].text === F || n[0].raw === I || n[0].text === I) && r.length === 1 && r[0].type === "text" && (r[0].text === F || r[0].text === I) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
|
|
2389
|
+
},
|
|
2390
|
+
renderMarkdown: (e, t, n) => {
|
|
2391
|
+
if (!e) return "";
|
|
2392
|
+
let r = Array.isArray(e.content) ? e.content : [];
|
|
2393
|
+
if (r.length === 0) {
|
|
2394
|
+
let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
|
|
2395
|
+
return n?.previousNode?.type === "paragraph" && e.length === 0 ? F : "";
|
|
2396
|
+
}
|
|
2397
|
+
return t.renderChildren(r);
|
|
2398
|
+
},
|
|
2399
|
+
addCommands() {
|
|
2400
|
+
return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
|
|
2401
|
+
},
|
|
2402
|
+
addKeyboardShortcuts() {
|
|
2403
|
+
return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
|
|
2404
|
+
}
|
|
2405
|
+
}), R = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, z = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, B = n.create({
|
|
2406
|
+
name: "strike",
|
|
2407
|
+
addOptions() {
|
|
2408
|
+
return { HTMLAttributes: {} };
|
|
2409
|
+
},
|
|
2410
|
+
parseHTML() {
|
|
2411
|
+
return [
|
|
2412
|
+
{ tag: "s" },
|
|
2413
|
+
{ tag: "del" },
|
|
2414
|
+
{ tag: "strike" },
|
|
2415
|
+
{
|
|
2416
|
+
style: "text-decoration",
|
|
2417
|
+
consuming: !1,
|
|
2418
|
+
getAttrs: (e) => e.includes("line-through") ? {} : !1
|
|
2419
|
+
}
|
|
2420
|
+
];
|
|
2627
2421
|
},
|
|
2628
|
-
renderHTML({ HTMLAttributes: e
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
["img", {
|
|
2634
|
-
src: `${Ue}/${i}.png`,
|
|
2635
|
-
draggable: "false",
|
|
2636
|
-
loading: "lazy",
|
|
2637
|
-
align: "absmiddle",
|
|
2638
|
-
alt: `${r} emoji`
|
|
2639
|
-
}]
|
|
2640
|
-
] : [
|
|
2641
|
-
"span",
|
|
2642
|
-
n,
|
|
2643
|
-
i
|
|
2644
|
-
] : [
|
|
2645
|
-
"span",
|
|
2646
|
-
n,
|
|
2647
|
-
`:${r || "emoji"}:`
|
|
2422
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2423
|
+
return [
|
|
2424
|
+
"s",
|
|
2425
|
+
f(this.options.HTMLAttributes, e),
|
|
2426
|
+
0
|
|
2648
2427
|
];
|
|
2428
|
+
},
|
|
2429
|
+
markdownTokenName: "del",
|
|
2430
|
+
parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
|
|
2431
|
+
renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
|
|
2432
|
+
addCommands() {
|
|
2433
|
+
return {
|
|
2434
|
+
setStrike: () => ({ commands: e }) => e.setMark(this.name),
|
|
2435
|
+
toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
2436
|
+
unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2437
|
+
};
|
|
2438
|
+
},
|
|
2439
|
+
addKeyboardShortcuts() {
|
|
2440
|
+
return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
|
|
2441
|
+
},
|
|
2442
|
+
addInputRules() {
|
|
2443
|
+
return [u({
|
|
2444
|
+
find: R,
|
|
2445
|
+
type: this.type
|
|
2446
|
+
})];
|
|
2447
|
+
},
|
|
2448
|
+
addPasteRules() {
|
|
2449
|
+
return [d({
|
|
2450
|
+
find: z,
|
|
2451
|
+
type: this.type
|
|
2452
|
+
})];
|
|
2649
2453
|
}
|
|
2650
|
-
}),
|
|
2651
|
-
name: "
|
|
2454
|
+
}), V = r.create({
|
|
2455
|
+
name: "text",
|
|
2456
|
+
group: "inline",
|
|
2457
|
+
parseMarkdown: (e) => ({
|
|
2458
|
+
type: "text",
|
|
2459
|
+
text: e.text || ""
|
|
2460
|
+
}),
|
|
2461
|
+
renderMarkdown: (e) => e.text || ""
|
|
2462
|
+
}), fe = n.create({
|
|
2463
|
+
name: "underline",
|
|
2652
2464
|
addOptions() {
|
|
2653
|
-
return {
|
|
2465
|
+
return { HTMLAttributes: {} };
|
|
2654
2466
|
},
|
|
2655
|
-
|
|
2656
|
-
return [{
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
parseHTML: (e) => e.style.fontSize.replace(/['"]+/g, ""),
|
|
2661
|
-
renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
|
|
2662
|
-
} }
|
|
2467
|
+
parseHTML() {
|
|
2468
|
+
return [{ tag: "u" }, {
|
|
2469
|
+
style: "text-decoration",
|
|
2470
|
+
consuming: !1,
|
|
2471
|
+
getAttrs: (e) => e.includes("underline") ? {} : !1
|
|
2663
2472
|
}];
|
|
2664
2473
|
},
|
|
2474
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
2475
|
+
return [
|
|
2476
|
+
"u",
|
|
2477
|
+
f(this.options.HTMLAttributes, e),
|
|
2478
|
+
0
|
|
2479
|
+
];
|
|
2480
|
+
},
|
|
2481
|
+
parseMarkdown(e, t) {
|
|
2482
|
+
return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
|
|
2483
|
+
},
|
|
2484
|
+
renderMarkdown(e, t) {
|
|
2485
|
+
return `++${t.renderChildren(e)}++`;
|
|
2486
|
+
},
|
|
2487
|
+
markdownTokenizer: {
|
|
2488
|
+
name: "underline",
|
|
2489
|
+
level: "inline",
|
|
2490
|
+
start(e) {
|
|
2491
|
+
return e.indexOf("++");
|
|
2492
|
+
},
|
|
2493
|
+
tokenize(e, t, n) {
|
|
2494
|
+
let r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
|
|
2495
|
+
if (!r) return;
|
|
2496
|
+
let i = r[2].trim();
|
|
2497
|
+
return {
|
|
2498
|
+
type: "underline",
|
|
2499
|
+
raw: r[0],
|
|
2500
|
+
text: i,
|
|
2501
|
+
tokens: n.inlineTokens(i)
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2665
2505
|
addCommands() {
|
|
2666
2506
|
return {
|
|
2667
|
-
|
|
2668
|
-
|
|
2507
|
+
setUnderline: () => ({ commands: e }) => e.setMark(this.name),
|
|
2508
|
+
toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
2509
|
+
unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
2510
|
+
};
|
|
2511
|
+
},
|
|
2512
|
+
addKeyboardShortcuts() {
|
|
2513
|
+
return {
|
|
2514
|
+
"Mod-u": () => this.editor.commands.toggleUnderline(),
|
|
2515
|
+
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
2669
2516
|
};
|
|
2670
2517
|
}
|
|
2671
|
-
})
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2518
|
+
});
|
|
2519
|
+
//#endregion
|
|
2520
|
+
//#region ../../node_modules/.pnpm/@tiptap+html@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_happy-dom@20.9.0/node_modules/@tiptap/html/dist/index.js
|
|
2521
|
+
function pe(e, t, n) {
|
|
2522
|
+
if (typeof window > "u") throw Error("generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");
|
|
2523
|
+
let r = s(t), i = new window.DOMParser().parseFromString(e, "text/html");
|
|
2524
|
+
if (!i) throw Error("Failed to parse HTML string");
|
|
2525
|
+
return ie.fromSchema(r).parse(i.body, n).toJSON();
|
|
2526
|
+
}
|
|
2527
|
+
//#endregion
|
|
2528
|
+
//#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_32db194579d7d1b9da503a9162bec3c3/node_modules/@tiptap/static-renderer/dist/pm/react/index.js
|
|
2529
|
+
function me(e, t, n) {
|
|
2530
|
+
let r = e.attrs;
|
|
2531
|
+
return r ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(r) || { [e.name]: e.name in r ? r[e.name] : e.attribute.default }).reduce((e, t) => f(e, t), {}) : {};
|
|
2532
|
+
}
|
|
2533
|
+
function H(e, t) {
|
|
2534
|
+
return me(e, t, !0);
|
|
2535
|
+
}
|
|
2536
|
+
function he(e, t) {
|
|
2537
|
+
return t?.textDirection ? [i.TextDirection.configure({ direction: t.textDirection }), ...e] : e;
|
|
2538
|
+
}
|
|
2539
|
+
function ge(e, t, n, r) {
|
|
2540
|
+
let i = o(t, "renderHTML", {
|
|
2541
|
+
name: t.name,
|
|
2542
|
+
options: t.options,
|
|
2543
|
+
storage: t.storage,
|
|
2544
|
+
parent: t.parent
|
|
2545
|
+
});
|
|
2546
|
+
return i ? [t.name, ({ node: r, children: a }) => {
|
|
2547
|
+
try {
|
|
2548
|
+
return e(i({
|
|
2549
|
+
node: r,
|
|
2550
|
+
HTMLAttributes: H(r, n)
|
|
2551
|
+
}))(a);
|
|
2552
|
+
} catch (e) {
|
|
2553
|
+
throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
2554
|
+
}
|
|
2555
|
+
}] : r?.unhandledNode ? [t.name, r.unhandledNode] : [t.name, () => {
|
|
2556
|
+
throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`);
|
|
2557
|
+
}];
|
|
2558
|
+
}
|
|
2559
|
+
function _e(e, t, n, r) {
|
|
2560
|
+
let i = o(t, "renderHTML", {
|
|
2561
|
+
name: t.name,
|
|
2562
|
+
options: t.options,
|
|
2563
|
+
storage: t.storage,
|
|
2564
|
+
parent: t.parent
|
|
2565
|
+
});
|
|
2566
|
+
return i ? [t.name, ({ mark: r, children: a }) => {
|
|
2567
|
+
try {
|
|
2568
|
+
return e(i({
|
|
2569
|
+
mark: r,
|
|
2570
|
+
HTMLAttributes: H(r, n)
|
|
2571
|
+
}))(a);
|
|
2572
|
+
} catch (e) {
|
|
2573
|
+
throw Error(`[tiptap error]: Mark ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
2574
|
+
}
|
|
2575
|
+
}] : r?.unhandledMark ? [t.name, r.unhandledMark] : [t.name, () => {
|
|
2576
|
+
throw Error(`Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method`);
|
|
2577
|
+
}];
|
|
2578
|
+
}
|
|
2579
|
+
var U = "__tiptapUnhandledNode__", W = "__tiptapUnhandledMark__", G = "__originalType", K = "__originalAttrs", q = {
|
|
2580
|
+
[G]: { default: "" },
|
|
2581
|
+
[K]: { default: {} }
|
|
2582
|
+
};
|
|
2583
|
+
function ve(e, t) {
|
|
2584
|
+
let n = !1, r = (e) => {
|
|
2585
|
+
var i, a;
|
|
2586
|
+
n || (e.type && !(e.type in t.nodes) && (n = !0), (i = e.marks) == null || i.forEach((e) => {
|
|
2587
|
+
e.type && !(e.type in t.marks) && (n = !0);
|
|
2588
|
+
}), (a = e.content) == null || a.forEach(r));
|
|
2589
|
+
};
|
|
2590
|
+
return r(e), n;
|
|
2591
|
+
}
|
|
2592
|
+
function ye(e, t, n) {
|
|
2593
|
+
let r = !!n?.unhandledNode, i = !!n?.unhandledMark, a = (e) => i && !(e.type in t.marks) ? {
|
|
2594
|
+
type: W,
|
|
2595
|
+
attrs: {
|
|
2596
|
+
[G]: e.type,
|
|
2597
|
+
[K]: e.attrs ?? {}
|
|
2598
|
+
}
|
|
2599
|
+
} : e, o = (e) => r && e.type != null && !(e.type in t.nodes), s = (e, t) => ({
|
|
2600
|
+
...t,
|
|
2601
|
+
type: U,
|
|
2602
|
+
attrs: {
|
|
2603
|
+
[G]: e.type,
|
|
2604
|
+
[K]: e.attrs ?? {}
|
|
2605
|
+
}
|
|
2606
|
+
}), c = (e) => {
|
|
2607
|
+
let t = {
|
|
2608
|
+
...e,
|
|
2609
|
+
marks: e.marks?.map(a),
|
|
2610
|
+
content: e.content?.map(c)
|
|
2611
|
+
};
|
|
2612
|
+
return o(e) ? s(e, t) : t;
|
|
2613
|
+
};
|
|
2614
|
+
return c(e);
|
|
2615
|
+
}
|
|
2616
|
+
function be(e) {
|
|
2617
|
+
return new ae({
|
|
2618
|
+
topNode: e.spec.topNode,
|
|
2619
|
+
nodes: e.spec.nodes.addToEnd(U, { attrs: q }),
|
|
2620
|
+
marks: e.spec.marks.addToEnd(W, { attrs: q })
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
2623
|
+
function xe(e, t, n) {
|
|
2624
|
+
if (e instanceof _) return e;
|
|
2625
|
+
let r = c(t);
|
|
2626
|
+
return ve(e, r) ? _.fromJSON(be(r), ye(e, r, n)) : _.fromJSON(r, e);
|
|
2627
|
+
}
|
|
2628
|
+
function J(e) {
|
|
2629
|
+
return e.type === U || e.type === W ? {
|
|
2630
|
+
...e,
|
|
2631
|
+
type: e.attrs[G],
|
|
2632
|
+
attrs: e.attrs[K]
|
|
2633
|
+
} : e;
|
|
2634
|
+
}
|
|
2635
|
+
function Y(e) {
|
|
2636
|
+
let t = J(e);
|
|
2637
|
+
return {
|
|
2638
|
+
...t,
|
|
2639
|
+
marks: t.marks?.map((e) => J(e)),
|
|
2640
|
+
content: t.content?.map(Y)
|
|
2641
|
+
};
|
|
2642
|
+
}
|
|
2643
|
+
function X(e) {
|
|
2644
|
+
let t = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
2645
|
+
type: { name: e.attrs[G] },
|
|
2646
|
+
attrs: e.attrs[K],
|
|
2647
|
+
toJSON: () => Y(e.toJSON())
|
|
2648
|
+
});
|
|
2649
|
+
return new Proxy(e, { get(e, n) {
|
|
2650
|
+
let r = t[n];
|
|
2651
|
+
if (r !== void 0) return r;
|
|
2652
|
+
let i = e[n];
|
|
2653
|
+
return typeof i == "function" ? i.bind(e) : i;
|
|
2654
|
+
} });
|
|
2655
|
+
}
|
|
2656
|
+
function Se(e) {
|
|
2657
|
+
return (t) => e({
|
|
2658
|
+
...t,
|
|
2659
|
+
node: X(t.node)
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
function Ce(e) {
|
|
2663
|
+
return (t) => e({
|
|
2664
|
+
...t,
|
|
2665
|
+
mark: X(t.mark)
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
function we({ renderer: e, domOutputSpecToElement: t, mapDefinedTypes: n, content: r, extensions: i, options: o }) {
|
|
2669
|
+
i = ee(i);
|
|
2670
|
+
let s = a(i), { nodeExtensions: c, markExtensions: l } = te(i), { unhandledNode: u, unhandledMark: d, nodeMapping: f, markMapping: p } = o ?? {};
|
|
2671
|
+
return r = xe(r, i, o), e({
|
|
2672
|
+
...o,
|
|
2673
|
+
nodeMapping: {
|
|
2674
|
+
...Object.fromEntries(c.filter((e) => e.name in n ? !1 : f ? !(e.name in f) : !0).map((e) => ge(t, e, s, o))),
|
|
2675
|
+
...n,
|
|
2676
|
+
...f,
|
|
2677
|
+
...u ? { [U]: Se(u) } : {}
|
|
2678
|
+
},
|
|
2679
|
+
markMapping: {
|
|
2680
|
+
...Object.fromEntries(l.filter((e) => p ? !(e.name in p) : !0).map((e) => _e(t, e, s, o))),
|
|
2681
|
+
...p,
|
|
2682
|
+
...d ? { [W]: Ce(d) } : {}
|
|
2683
|
+
}
|
|
2684
|
+
})({ content: r });
|
|
2685
|
+
}
|
|
2686
|
+
function Te(e, { nodeMapping: t, markMapping: n, unhandledNode: r, unhandledMark: i }) {
|
|
2687
|
+
return function a({ content: o, parent: s }) {
|
|
2688
|
+
let c = typeof o.type == "string" ? o.type : o.type?.name ?? "", l = t[c] ?? r;
|
|
2689
|
+
if (!l) throw Error(`missing handler for node type ${c}`);
|
|
2690
|
+
let u = e({
|
|
2691
|
+
component: l,
|
|
2692
|
+
props: {
|
|
2693
|
+
node: o,
|
|
2694
|
+
parent: s,
|
|
2695
|
+
renderElement: a,
|
|
2696
|
+
get children() {
|
|
2697
|
+
let e = [];
|
|
2698
|
+
return o.content && o.content.forEach((t) => {
|
|
2699
|
+
e.push(a({
|
|
2700
|
+
content: t,
|
|
2701
|
+
parent: o
|
|
2702
|
+
}));
|
|
2703
|
+
}), e;
|
|
2704
|
+
}
|
|
2772
2705
|
}
|
|
2773
|
-
})
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
})
|
|
2787
|
-
}
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
children: [
|
|
2797
|
-
k,
|
|
2798
|
-
A,
|
|
2799
|
-
j,
|
|
2800
|
-
M
|
|
2801
|
-
]
|
|
2802
|
-
}), o[26] = D, o[27] = O, o[28] = k, o[29] = A, o[30] = j, o[31] = M, o[32] = N) : N = o[32], N;
|
|
2706
|
+
});
|
|
2707
|
+
return o.marks ? o.marks.reduce((t, r) => {
|
|
2708
|
+
let a = typeof r.type == "string" ? r.type : r.type.name, c = n[a] ?? i;
|
|
2709
|
+
if (!c) throw Error(`missing handler for mark type ${a}`);
|
|
2710
|
+
return e({
|
|
2711
|
+
component: c,
|
|
2712
|
+
props: {
|
|
2713
|
+
mark: r,
|
|
2714
|
+
parent: s,
|
|
2715
|
+
node: o,
|
|
2716
|
+
children: t
|
|
2717
|
+
}
|
|
2718
|
+
});
|
|
2719
|
+
}, u) : u;
|
|
2720
|
+
};
|
|
2721
|
+
}
|
|
2722
|
+
function Z(t) {
|
|
2723
|
+
let n = 0;
|
|
2724
|
+
return Te(({ component: t, props: { children: r, ...i } }) => e.createElement(t, Object.assign(i, { key: n++ }), [].concat(r)), t);
|
|
2725
|
+
}
|
|
2726
|
+
var Ee = {
|
|
2727
|
+
colspan: "colSpan",
|
|
2728
|
+
rowspan: "rowSpan"
|
|
2803
2729
|
};
|
|
2730
|
+
function Q(e, t) {
|
|
2731
|
+
return e ? Object.entries(e).reduce((e, [t, n]) => {
|
|
2732
|
+
if (t === "class") return Object.assign(e, { className: n });
|
|
2733
|
+
if (t === "style" && typeof n == "string") {
|
|
2734
|
+
let t = {};
|
|
2735
|
+
return n.split(";").forEach((e) => {
|
|
2736
|
+
let [n, r] = e.split(":");
|
|
2737
|
+
if (n && r) {
|
|
2738
|
+
let e = n.trim().replace(/-([a-z])/g, (e) => e[1].toUpperCase());
|
|
2739
|
+
t[e] = r.trim();
|
|
2740
|
+
}
|
|
2741
|
+
}), Object.assign(e, { style: t });
|
|
2742
|
+
}
|
|
2743
|
+
let r = Ee[t] ?? t;
|
|
2744
|
+
return Object.assign(e, { [r]: n });
|
|
2745
|
+
}, { key: t }) : { key: t };
|
|
2746
|
+
}
|
|
2747
|
+
function $(t, n = 0) {
|
|
2748
|
+
if (typeof t == "string") return () => t;
|
|
2749
|
+
if (typeof t == "object" && "length" in t) {
|
|
2750
|
+
let [r, i, a, ...o] = t, s = r.split(" ");
|
|
2751
|
+
if (s.length > 1 && (r = s[1], i === void 0 && (i = { xmlns: s[0] }), i === 0 && (i = { xmlns: s[0] }, a = 0), typeof i == "object" && (i = Object.assign(i, { xmlns: s[0] }))), i === void 0) return () => e.createElement(r, Q(void 0, n.toString()));
|
|
2752
|
+
if (i === 0) return (t) => e.createElement(r, Q(void 0, n.toString()), t);
|
|
2753
|
+
if (typeof i == "object") return Array.isArray(i) ? a === void 0 || a === 0 ? (t) => e.createElement(r, Q(void 0, n.toString()), $(i, n++)(t)) : (t) => e.createElement(r, Q(void 0, n.toString()), $(i)(t), [a].concat(o).map((e) => $(e, n++)(t))) : a === void 0 ? () => e.createElement(r, Q(i, n.toString())) : a === 0 ? (t) => e.createElement(r, Q(i, n.toString()), t) : (t) => e.createElement(r, Q(i, n.toString()), [a].concat(o).map((e) => $(e, n++)(t)));
|
|
2754
|
+
}
|
|
2755
|
+
throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping", { cause: t });
|
|
2756
|
+
}
|
|
2757
|
+
function De({ content: t, extensions: n, staticEditorOptions: r, options: i }) {
|
|
2758
|
+
return we({
|
|
2759
|
+
renderer: Z,
|
|
2760
|
+
domOutputSpecToElement: $,
|
|
2761
|
+
mapDefinedTypes: {
|
|
2762
|
+
doc: ({ children: t }) => e.createElement(e.Fragment, {}, t),
|
|
2763
|
+
text: ({ node: e }) => e.text ?? ""
|
|
2764
|
+
},
|
|
2765
|
+
content: t,
|
|
2766
|
+
extensions: he(n, r),
|
|
2767
|
+
options: i
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2804
2770
|
//#endregion
|
|
2805
|
-
export {
|
|
2771
|
+
export { ue as _, B as a, ne as c, E as d, T as f, x as g, h, V as i, P as l, w as m, pe as n, L as o, m as p, fe as r, re as s, De as t, k as u, le as v };
|