@dooherceg/tiptap-controlled-editor-with-table 0.0.7 → 0.0.8
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/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
- package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
- package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
- package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
- package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
- package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
- package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
- package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
- package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
- package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
- package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
- package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
- package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
- package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
- package/dist/assets/styles/_keyframe-animations.css +1 -0
- package/dist/assets/styles/_variables.css +1 -0
- package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
- package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
- package/dist/components/tiptap-templates/simple/simple-editor.js +159 -1898
- package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
- package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
- package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
- package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
- package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
- package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
- package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
- package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
- package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
- package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
- package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
- package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
- package/dist/hooks/use-throttled-callback.js +13 -108
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
- package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
- package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
- package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
- package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
- package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
- package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
- package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
- package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
- package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
- package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
- package/dist/node_modules/lodash.throttle/index.js +95 -0
- package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
- package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
- package/dist/node_modules/tslib/tslib.es6.js +27 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
- package/package.json +1 -1
- package/dist/Combination-CO0ZtURs.js +0 -1333
- package/dist/assets/simple-editor.css +0 -1
- package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
- /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
- /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
- /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
- /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
- /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
- /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
- /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
- /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
- /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
|
@@ -1,1861 +1,122 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEditor as
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} : {}
|
|
52
|
-
}
|
|
53
|
-
} : {};
|
|
54
|
-
},
|
|
55
|
-
parseHTML() {
|
|
56
|
-
return [
|
|
57
|
-
{
|
|
58
|
-
tag: "mark"
|
|
59
|
-
}
|
|
60
|
-
];
|
|
61
|
-
},
|
|
62
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
63
|
-
return ["mark", k(this.options.HTMLAttributes, t), 0];
|
|
64
|
-
},
|
|
65
|
-
renderMarkdown: (t, e) => `==${e.renderChildren(t)}==`,
|
|
66
|
-
parseMarkdown: (t, e) => e.applyMark("highlight", e.parseInline(t.tokens || [])),
|
|
67
|
-
markdownTokenizer: {
|
|
68
|
-
name: "highlight",
|
|
69
|
-
level: "inline",
|
|
70
|
-
start: (t) => t.indexOf("=="),
|
|
71
|
-
tokenize(t, e, r) {
|
|
72
|
-
const s = /^(==)([^=]+)(==)/.exec(t);
|
|
73
|
-
if (s) {
|
|
74
|
-
const i = s[2].trim(), a = r.inlineTokens(i);
|
|
75
|
-
return {
|
|
76
|
-
type: "highlight",
|
|
77
|
-
raw: s[0],
|
|
78
|
-
text: i,
|
|
79
|
-
tokens: a
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
addCommands() {
|
|
85
|
-
return {
|
|
86
|
-
setHighlight: (t) => ({ commands: e }) => e.setMark(this.name, t),
|
|
87
|
-
toggleHighlight: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
|
|
88
|
-
unsetHighlight: () => ({ commands: t }) => t.unsetMark(this.name)
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
addKeyboardShortcuts() {
|
|
92
|
-
return {
|
|
93
|
-
"Mod-Shift-h": () => this.editor.commands.toggleHighlight()
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
addInputRules() {
|
|
97
|
-
return [
|
|
98
|
-
At({
|
|
99
|
-
find: xe,
|
|
100
|
-
type: this.type
|
|
101
|
-
})
|
|
102
|
-
];
|
|
103
|
-
},
|
|
104
|
-
addPasteRules() {
|
|
105
|
-
return [
|
|
106
|
-
xt({
|
|
107
|
-
find: Ae,
|
|
108
|
-
type: this.type
|
|
109
|
-
})
|
|
110
|
-
];
|
|
111
|
-
}
|
|
112
|
-
}), Se = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, He = L.create({
|
|
113
|
-
name: "image",
|
|
114
|
-
addOptions() {
|
|
115
|
-
return {
|
|
116
|
-
inline: !1,
|
|
117
|
-
allowBase64: !1,
|
|
118
|
-
HTMLAttributes: {},
|
|
119
|
-
resize: !1
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
inline() {
|
|
123
|
-
return this.options.inline;
|
|
124
|
-
},
|
|
125
|
-
group() {
|
|
126
|
-
return this.options.inline ? "inline" : "block";
|
|
127
|
-
},
|
|
128
|
-
draggable: !0,
|
|
129
|
-
addAttributes() {
|
|
130
|
-
return {
|
|
131
|
-
src: {
|
|
132
|
-
default: null
|
|
133
|
-
},
|
|
134
|
-
alt: {
|
|
135
|
-
default: null
|
|
136
|
-
},
|
|
137
|
-
title: {
|
|
138
|
-
default: null
|
|
139
|
-
},
|
|
140
|
-
width: {
|
|
141
|
-
default: null
|
|
142
|
-
},
|
|
143
|
-
height: {
|
|
144
|
-
default: null
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
},
|
|
148
|
-
parseHTML() {
|
|
149
|
-
return [
|
|
150
|
-
{
|
|
151
|
-
tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
|
|
152
|
-
}
|
|
153
|
-
];
|
|
154
|
-
},
|
|
155
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
156
|
-
return ["img", k(this.options.HTMLAttributes, t)];
|
|
157
|
-
},
|
|
158
|
-
parseMarkdown: (t, e) => e.createNode("image", {
|
|
159
|
-
src: t.href,
|
|
160
|
-
title: t.title,
|
|
161
|
-
alt: t.text
|
|
162
|
-
}),
|
|
163
|
-
renderMarkdown: (t) => {
|
|
164
|
-
var e, r, n, s, i, a;
|
|
165
|
-
const o = (r = (e = t.attrs) == null ? void 0 : e.src) != null ? r : "", c = (s = (n = t.attrs) == null ? void 0 : n.alt) != null ? s : "", l = (a = (i = t.attrs) == null ? void 0 : i.title) != null ? a : "";
|
|
166
|
-
return l ? `` : ``;
|
|
167
|
-
},
|
|
168
|
-
addNodeView() {
|
|
169
|
-
if (!this.options.resize || !this.options.resize.enabled || typeof document > "u" || !this.editor.isEditable)
|
|
170
|
-
return null;
|
|
171
|
-
const { directions: t, minWidth: e, minHeight: r, alwaysPreserveAspectRatio: n } = this.options.resize;
|
|
172
|
-
return ({ node: s, getPos: i, HTMLAttributes: a }) => {
|
|
173
|
-
const o = document.createElement("img");
|
|
174
|
-
Object.entries(a).forEach(([d, u]) => {
|
|
175
|
-
if (u != null)
|
|
176
|
-
switch (d) {
|
|
177
|
-
case "width":
|
|
178
|
-
case "height":
|
|
179
|
-
break;
|
|
180
|
-
default:
|
|
181
|
-
o.setAttribute(d, u);
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
}), o.src = a.src;
|
|
185
|
-
const c = new St({
|
|
186
|
-
element: o,
|
|
187
|
-
node: s,
|
|
188
|
-
getPos: i,
|
|
189
|
-
onResize: (d, u) => {
|
|
190
|
-
o.style.width = `${d}px`, o.style.height = `${u}px`;
|
|
191
|
-
},
|
|
192
|
-
onCommit: (d, u) => {
|
|
193
|
-
const h = i();
|
|
194
|
-
h !== void 0 && this.editor.chain().setNodeSelection(h).updateAttributes(this.name, {
|
|
195
|
-
width: d,
|
|
196
|
-
height: u
|
|
197
|
-
}).run();
|
|
198
|
-
},
|
|
199
|
-
onUpdate: (d, u, h) => d.type === s.type,
|
|
200
|
-
options: {
|
|
201
|
-
directions: t,
|
|
202
|
-
min: {
|
|
203
|
-
width: e,
|
|
204
|
-
height: r
|
|
205
|
-
},
|
|
206
|
-
preserveAspectRatio: n === !0
|
|
207
|
-
}
|
|
208
|
-
}), l = c.dom;
|
|
209
|
-
return l.style.visibility = "hidden", l.style.pointerEvents = "none", o.onload = () => {
|
|
210
|
-
l.style.visibility = "", l.style.pointerEvents = "";
|
|
211
|
-
}, c;
|
|
212
|
-
};
|
|
213
|
-
},
|
|
214
|
-
addCommands() {
|
|
215
|
-
return {
|
|
216
|
-
setImage: (t) => ({ commands: e }) => e.insertContent({
|
|
217
|
-
type: this.name,
|
|
218
|
-
attrs: t
|
|
219
|
-
})
|
|
220
|
-
};
|
|
221
|
-
},
|
|
222
|
-
addInputRules() {
|
|
223
|
-
return [
|
|
224
|
-
It({
|
|
225
|
-
find: Se,
|
|
226
|
-
type: this.type,
|
|
227
|
-
getAttributes: (t) => {
|
|
228
|
-
const [, , e, r, n] = t;
|
|
229
|
-
return { src: r, alt: e, title: n };
|
|
230
|
-
}
|
|
231
|
-
})
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
}), Ee = Object.defineProperty, $e = (t, e) => {
|
|
235
|
-
for (var r in e)
|
|
236
|
-
Ee(t, r, { get: e[r], enumerable: !0 });
|
|
237
|
-
}, Ne = "listItem", J = "textStyle", tt = /^\s*([-+*])\s$/, Re = L.create({
|
|
238
|
-
name: "bulletList",
|
|
239
|
-
addOptions() {
|
|
240
|
-
return {
|
|
241
|
-
itemTypeName: "listItem",
|
|
242
|
-
HTMLAttributes: {},
|
|
243
|
-
keepMarks: !1,
|
|
244
|
-
keepAttributes: !1
|
|
245
|
-
};
|
|
246
|
-
},
|
|
247
|
-
group: "block list",
|
|
248
|
-
content() {
|
|
249
|
-
return `${this.options.itemTypeName}+`;
|
|
250
|
-
},
|
|
251
|
-
parseHTML() {
|
|
252
|
-
return [{ tag: "ul" }];
|
|
253
|
-
},
|
|
254
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
255
|
-
return ["ul", k(this.options.HTMLAttributes, t), 0];
|
|
256
|
-
},
|
|
257
|
-
markdownTokenName: "list",
|
|
258
|
-
parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
|
|
259
|
-
type: "bulletList",
|
|
260
|
-
content: t.items ? e.parseChildren(t.items) : []
|
|
261
|
-
},
|
|
262
|
-
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
263
|
-
`) : "",
|
|
264
|
-
markdownOptions: {
|
|
265
|
-
indentsContent: !0
|
|
266
|
-
},
|
|
267
|
-
addCommands() {
|
|
268
|
-
return {
|
|
269
|
-
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ne, this.editor.getAttributes(J)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
addKeyboardShortcuts() {
|
|
273
|
-
return {
|
|
274
|
-
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
275
|
-
};
|
|
276
|
-
},
|
|
277
|
-
addInputRules() {
|
|
278
|
-
let t = S({
|
|
279
|
-
find: tt,
|
|
280
|
-
type: this.type
|
|
281
|
-
});
|
|
282
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (t = S({
|
|
283
|
-
find: tt,
|
|
284
|
-
type: this.type,
|
|
285
|
-
keepMarks: this.options.keepMarks,
|
|
286
|
-
keepAttributes: this.options.keepAttributes,
|
|
287
|
-
getAttributes: () => this.editor.getAttributes(J),
|
|
288
|
-
editor: this.editor
|
|
289
|
-
})), [t];
|
|
290
|
-
}
|
|
291
|
-
}), Pe = L.create({
|
|
292
|
-
name: "listItem",
|
|
293
|
-
addOptions() {
|
|
294
|
-
return {
|
|
295
|
-
HTMLAttributes: {},
|
|
296
|
-
bulletListTypeName: "bulletList",
|
|
297
|
-
orderedListTypeName: "orderedList"
|
|
298
|
-
};
|
|
299
|
-
},
|
|
300
|
-
content: "paragraph block*",
|
|
301
|
-
defining: !0,
|
|
302
|
-
parseHTML() {
|
|
303
|
-
return [
|
|
304
|
-
{
|
|
305
|
-
tag: "li"
|
|
306
|
-
}
|
|
307
|
-
];
|
|
308
|
-
},
|
|
309
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
310
|
-
return ["li", k(this.options.HTMLAttributes, t), 0];
|
|
311
|
-
},
|
|
312
|
-
markdownTokenName: "list_item",
|
|
313
|
-
parseMarkdown: (t, e) => {
|
|
314
|
-
if (t.type !== "list_item")
|
|
315
|
-
return [];
|
|
316
|
-
let r = [];
|
|
317
|
-
if (t.tokens && t.tokens.length > 0)
|
|
318
|
-
if (t.tokens.some((s) => s.type === "paragraph"))
|
|
319
|
-
r = e.parseChildren(t.tokens);
|
|
320
|
-
else {
|
|
321
|
-
const s = t.tokens[0];
|
|
322
|
-
if (s && s.type === "text" && s.tokens && s.tokens.length > 0) {
|
|
323
|
-
if (r = [
|
|
324
|
-
{
|
|
325
|
-
type: "paragraph",
|
|
326
|
-
content: e.parseInline(s.tokens)
|
|
327
|
-
}
|
|
328
|
-
], t.tokens.length > 1) {
|
|
329
|
-
const a = t.tokens.slice(1), o = e.parseChildren(a);
|
|
330
|
-
r.push(...o);
|
|
331
|
-
}
|
|
332
|
-
} else
|
|
333
|
-
r = e.parseChildren(t.tokens);
|
|
334
|
-
}
|
|
335
|
-
return r.length === 0 && (r = [
|
|
336
|
-
{
|
|
337
|
-
type: "paragraph",
|
|
338
|
-
content: []
|
|
339
|
-
}
|
|
340
|
-
]), {
|
|
341
|
-
type: "listItem",
|
|
342
|
-
content: r
|
|
343
|
-
};
|
|
344
|
-
},
|
|
345
|
-
renderMarkdown: (t, e, r) => lt(
|
|
346
|
-
t,
|
|
347
|
-
e,
|
|
348
|
-
(n) => n.parentType === "bulletList" ? "- " : n.parentType === "orderedList" ? `${n.index + 1}. ` : "- ",
|
|
349
|
-
r
|
|
350
|
-
),
|
|
351
|
-
addKeyboardShortcuts() {
|
|
352
|
-
return {
|
|
353
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
354
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
355
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
}), Be = {};
|
|
359
|
-
$e(Be, {
|
|
360
|
-
findListItemPos: () => $,
|
|
361
|
-
getNextListDepth: () => V,
|
|
362
|
-
handleBackspace: () => z,
|
|
363
|
-
handleDelete: () => W,
|
|
364
|
-
hasListBefore: () => ht,
|
|
365
|
-
hasListItemAfter: () => Oe,
|
|
366
|
-
hasListItemBefore: () => ft,
|
|
367
|
-
listItemHasSubList: () => mt,
|
|
368
|
-
nextListIsDeeper: () => gt,
|
|
369
|
-
nextListIsHigher: () => bt
|
|
370
|
-
});
|
|
371
|
-
var $ = (t, e) => {
|
|
372
|
-
const { $from: r } = e.selection, n = ut(t, e.schema);
|
|
373
|
-
let s = null, i = r.depth, a = r.pos, o = null;
|
|
374
|
-
for (; i > 0 && o === null; )
|
|
375
|
-
s = r.node(i), s.type === n ? o = i : (i -= 1, a -= 1);
|
|
376
|
-
return o === null ? null : { $pos: e.doc.resolve(a), depth: o };
|
|
377
|
-
}, V = (t, e) => {
|
|
378
|
-
const r = $(t, e);
|
|
379
|
-
if (!r)
|
|
380
|
-
return !1;
|
|
381
|
-
const [, n] = $t(e, t, r.$pos.pos + 4);
|
|
382
|
-
return n;
|
|
383
|
-
}, ht = (t, e, r) => {
|
|
384
|
-
const { $anchor: n } = t.selection, s = Math.max(0, n.pos - 2), i = t.doc.resolve(s).node();
|
|
385
|
-
return !(!i || !r.includes(i.type.name));
|
|
386
|
-
}, ft = (t, e) => {
|
|
387
|
-
var r;
|
|
388
|
-
const { $anchor: n } = e.selection, s = e.doc.resolve(n.pos - 2);
|
|
389
|
-
return !(s.index() === 0 || ((r = s.nodeBefore) == null ? void 0 : r.type.name) !== t);
|
|
390
|
-
}, mt = (t, e, r) => {
|
|
391
|
-
if (!r)
|
|
392
|
-
return !1;
|
|
393
|
-
const n = ut(t, e.schema);
|
|
394
|
-
let s = !1;
|
|
395
|
-
return r.descendants((i) => {
|
|
396
|
-
i.type === n && (s = !0);
|
|
397
|
-
}), s;
|
|
398
|
-
}, z = (t, e, r) => {
|
|
399
|
-
if (t.commands.undoInputRule())
|
|
400
|
-
return !0;
|
|
401
|
-
if (t.state.selection.from !== t.state.selection.to)
|
|
402
|
-
return !1;
|
|
403
|
-
if (!_(t.state, e) && ht(t.state, e, r)) {
|
|
404
|
-
const { $anchor: o } = t.state.selection, c = t.state.doc.resolve(o.before() - 1), l = [];
|
|
405
|
-
c.node().descendants((h, m) => {
|
|
406
|
-
h.type.name === e && l.push({ node: h, pos: m });
|
|
407
|
-
});
|
|
408
|
-
const d = l.at(-1);
|
|
409
|
-
if (!d)
|
|
410
|
-
return !1;
|
|
411
|
-
const u = t.state.doc.resolve(c.start() + d.pos + 1);
|
|
412
|
-
return t.chain().cut({ from: o.start() - 1, to: o.end() + 1 }, u.end()).joinForward().run();
|
|
413
|
-
}
|
|
414
|
-
if (!_(t.state, e) || !Ht(t.state))
|
|
415
|
-
return !1;
|
|
416
|
-
const n = $(e, t.state);
|
|
417
|
-
if (!n)
|
|
418
|
-
return !1;
|
|
419
|
-
const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth), a = mt(e, t.state, i);
|
|
420
|
-
return ft(e, t.state) && !a ? t.commands.joinItemBackward() : t.chain().liftListItem(e).run();
|
|
421
|
-
}, gt = (t, e) => {
|
|
422
|
-
const r = V(t, e), n = $(t, e);
|
|
423
|
-
return !n || !r ? !1 : r > n.depth;
|
|
424
|
-
}, bt = (t, e) => {
|
|
425
|
-
const r = V(t, e), n = $(t, e);
|
|
426
|
-
return !n || !r ? !1 : r < n.depth;
|
|
427
|
-
}, W = (t, e) => {
|
|
428
|
-
if (!_(t.state, e) || !Et(t.state, e))
|
|
429
|
-
return !1;
|
|
430
|
-
const { selection: r } = t.state, { $from: n, $to: s } = r;
|
|
431
|
-
return !r.empty && n.sameParent(s) ? !1 : gt(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : bt(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
|
|
432
|
-
}, Oe = (t, e) => {
|
|
433
|
-
var r;
|
|
434
|
-
const { $anchor: n } = e.selection, s = e.doc.resolve(n.pos - n.parentOffset - 2);
|
|
435
|
-
return !(s.index() === s.parent.childCount - 1 || ((r = s.nodeAfter) == null ? void 0 : r.type.name) !== t);
|
|
436
|
-
}, De = C.create({
|
|
437
|
-
name: "listKeymap",
|
|
438
|
-
addOptions() {
|
|
439
|
-
return {
|
|
440
|
-
listTypes: [
|
|
441
|
-
{
|
|
442
|
-
itemName: "listItem",
|
|
443
|
-
wrapperNames: ["bulletList", "orderedList"]
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
itemName: "taskItem",
|
|
447
|
-
wrapperNames: ["taskList"]
|
|
448
|
-
}
|
|
449
|
-
]
|
|
450
|
-
};
|
|
451
|
-
},
|
|
452
|
-
addKeyboardShortcuts() {
|
|
453
|
-
return {
|
|
454
|
-
Delete: ({ editor: t }) => {
|
|
455
|
-
let e = !1;
|
|
456
|
-
return this.options.listTypes.forEach(({ itemName: r }) => {
|
|
457
|
-
t.state.schema.nodes[r] !== void 0 && W(t, r) && (e = !0);
|
|
458
|
-
}), e;
|
|
459
|
-
},
|
|
460
|
-
"Mod-Delete": ({ editor: t }) => {
|
|
461
|
-
let e = !1;
|
|
462
|
-
return this.options.listTypes.forEach(({ itemName: r }) => {
|
|
463
|
-
t.state.schema.nodes[r] !== void 0 && W(t, r) && (e = !0);
|
|
464
|
-
}), e;
|
|
465
|
-
},
|
|
466
|
-
Backspace: ({ editor: t }) => {
|
|
467
|
-
let e = !1;
|
|
468
|
-
return this.options.listTypes.forEach(({ itemName: r, wrapperNames: n }) => {
|
|
469
|
-
t.state.schema.nodes[r] !== void 0 && z(t, r, n) && (e = !0);
|
|
470
|
-
}), e;
|
|
471
|
-
},
|
|
472
|
-
"Mod-Backspace": ({ editor: t }) => {
|
|
473
|
-
let e = !1;
|
|
474
|
-
return this.options.listTypes.forEach(({ itemName: r, wrapperNames: n }) => {
|
|
475
|
-
t.state.schema.nodes[r] !== void 0 && z(t, r, n) && (e = !0);
|
|
476
|
-
}), e;
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
}), et = /^(\s*)(\d+)\.\s+(.*)$/, _e = /^\s/;
|
|
481
|
-
function ze(t) {
|
|
482
|
-
const e = [];
|
|
483
|
-
let r = 0, n = 0;
|
|
484
|
-
for (; r < t.length; ) {
|
|
485
|
-
const s = t[r], i = s.match(et);
|
|
486
|
-
if (!i)
|
|
487
|
-
break;
|
|
488
|
-
const [, a, o, c] = i, l = a.length;
|
|
489
|
-
let d = c, u = r + 1;
|
|
490
|
-
const h = [s];
|
|
491
|
-
for (; u < t.length; ) {
|
|
492
|
-
const m = t[u];
|
|
493
|
-
if (m.match(et))
|
|
494
|
-
break;
|
|
495
|
-
if (m.trim() === "")
|
|
496
|
-
h.push(m), d += `
|
|
497
|
-
`, u += 1;
|
|
498
|
-
else if (m.match(_e))
|
|
499
|
-
h.push(m), d += `
|
|
500
|
-
${m.slice(l + 2)}`, u += 1;
|
|
501
|
-
else
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
e.push({
|
|
505
|
-
indent: l,
|
|
506
|
-
number: parseInt(o, 10),
|
|
507
|
-
content: d.trim(),
|
|
508
|
-
raw: h.join(`
|
|
509
|
-
`)
|
|
510
|
-
}), n = u, r = u;
|
|
511
|
-
}
|
|
512
|
-
return [e, n];
|
|
513
|
-
}
|
|
514
|
-
function yt(t, e, r) {
|
|
515
|
-
var n;
|
|
516
|
-
const s = [];
|
|
517
|
-
let i = 0;
|
|
518
|
-
for (; i < t.length; ) {
|
|
519
|
-
const a = t[i];
|
|
520
|
-
if (a.indent === e) {
|
|
521
|
-
const o = a.content.split(`
|
|
522
|
-
`), c = ((n = o[0]) == null ? void 0 : n.trim()) || "", l = [];
|
|
523
|
-
c && l.push({
|
|
524
|
-
type: "paragraph",
|
|
525
|
-
raw: c,
|
|
526
|
-
tokens: r.inlineTokens(c)
|
|
527
|
-
});
|
|
528
|
-
const d = o.slice(1).join(`
|
|
529
|
-
`).trim();
|
|
530
|
-
if (d) {
|
|
531
|
-
const m = r.blockTokens(d);
|
|
532
|
-
l.push(...m);
|
|
533
|
-
}
|
|
534
|
-
let u = i + 1;
|
|
535
|
-
const h = [];
|
|
536
|
-
for (; u < t.length && t[u].indent > e; )
|
|
537
|
-
h.push(t[u]), u += 1;
|
|
538
|
-
if (h.length > 0) {
|
|
539
|
-
const m = Math.min(...h.map((b) => b.indent)), f = yt(h, m, r);
|
|
540
|
-
l.push({
|
|
541
|
-
type: "list",
|
|
542
|
-
ordered: !0,
|
|
543
|
-
start: h[0].number,
|
|
544
|
-
items: f,
|
|
545
|
-
raw: h.map((b) => b.raw).join(`
|
|
546
|
-
`)
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
s.push({
|
|
550
|
-
type: "list_item",
|
|
551
|
-
raw: a.raw,
|
|
552
|
-
tokens: l
|
|
553
|
-
}), i = u;
|
|
554
|
-
} else
|
|
555
|
-
i += 1;
|
|
556
|
-
}
|
|
557
|
-
return s;
|
|
558
|
-
}
|
|
559
|
-
function We(t, e) {
|
|
560
|
-
return t.map((r) => {
|
|
561
|
-
if (r.type !== "list_item")
|
|
562
|
-
return e.parseChildren([r])[0];
|
|
563
|
-
const n = [];
|
|
564
|
-
return r.tokens && r.tokens.length > 0 && r.tokens.forEach((s) => {
|
|
565
|
-
if (s.type === "paragraph" || s.type === "list" || s.type === "blockquote" || s.type === "code")
|
|
566
|
-
n.push(...e.parseChildren([s]));
|
|
567
|
-
else if (s.type === "text" && s.tokens) {
|
|
568
|
-
const i = e.parseChildren([s]);
|
|
569
|
-
n.push({
|
|
570
|
-
type: "paragraph",
|
|
571
|
-
content: i
|
|
572
|
-
});
|
|
573
|
-
} else {
|
|
574
|
-
const i = e.parseChildren([s]);
|
|
575
|
-
i.length > 0 && n.push(...i);
|
|
576
|
-
}
|
|
577
|
-
}), {
|
|
578
|
-
type: "listItem",
|
|
579
|
-
content: n
|
|
580
|
-
};
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
var je = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, Qe = L.create({
|
|
584
|
-
name: "orderedList",
|
|
585
|
-
addOptions() {
|
|
586
|
-
return {
|
|
587
|
-
itemTypeName: "listItem",
|
|
588
|
-
HTMLAttributes: {},
|
|
589
|
-
keepMarks: !1,
|
|
590
|
-
keepAttributes: !1
|
|
591
|
-
};
|
|
592
|
-
},
|
|
593
|
-
group: "block list",
|
|
594
|
-
content() {
|
|
595
|
-
return `${this.options.itemTypeName}+`;
|
|
596
|
-
},
|
|
597
|
-
addAttributes() {
|
|
598
|
-
return {
|
|
599
|
-
start: {
|
|
600
|
-
default: 1,
|
|
601
|
-
parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
|
|
602
|
-
},
|
|
603
|
-
type: {
|
|
604
|
-
default: null,
|
|
605
|
-
parseHTML: (t) => t.getAttribute("type")
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
},
|
|
609
|
-
parseHTML() {
|
|
610
|
-
return [
|
|
611
|
-
{
|
|
612
|
-
tag: "ol"
|
|
613
|
-
}
|
|
614
|
-
];
|
|
615
|
-
},
|
|
616
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
617
|
-
const { start: e, ...r } = t;
|
|
618
|
-
return e === 1 ? ["ol", k(this.options.HTMLAttributes, r), 0] : ["ol", k(this.options.HTMLAttributes, t), 0];
|
|
619
|
-
},
|
|
620
|
-
markdownTokenName: "list",
|
|
621
|
-
parseMarkdown: (t, e) => {
|
|
622
|
-
if (t.type !== "list" || !t.ordered)
|
|
623
|
-
return [];
|
|
624
|
-
const r = t.start || 1, n = t.items ? We(t.items, e) : [];
|
|
625
|
-
return r !== 1 ? {
|
|
626
|
-
type: "orderedList",
|
|
627
|
-
attrs: { start: r },
|
|
628
|
-
content: n
|
|
629
|
-
} : {
|
|
630
|
-
type: "orderedList",
|
|
631
|
-
content: n
|
|
632
|
-
};
|
|
633
|
-
},
|
|
634
|
-
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
635
|
-
`) : "",
|
|
636
|
-
markdownTokenizer: {
|
|
637
|
-
name: "orderedList",
|
|
638
|
-
level: "block",
|
|
639
|
-
start: (t) => {
|
|
640
|
-
const e = t.match(/^(\s*)(\d+)\.\s+/), r = e?.index;
|
|
641
|
-
return r !== void 0 ? r : -1;
|
|
642
|
-
},
|
|
643
|
-
tokenize: (t, e, r) => {
|
|
644
|
-
var n;
|
|
645
|
-
const s = t.split(`
|
|
646
|
-
`), [i, a] = ze(s);
|
|
647
|
-
if (i.length === 0)
|
|
648
|
-
return;
|
|
649
|
-
const o = yt(i, 0, r);
|
|
650
|
-
return o.length === 0 ? void 0 : {
|
|
651
|
-
type: "list",
|
|
652
|
-
ordered: !0,
|
|
653
|
-
start: ((n = i[0]) == null ? void 0 : n.number) || 1,
|
|
654
|
-
items: o,
|
|
655
|
-
raw: s.slice(0, a).join(`
|
|
656
|
-
`)
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
markdownOptions: {
|
|
661
|
-
indentsContent: !0
|
|
662
|
-
},
|
|
663
|
-
addCommands() {
|
|
664
|
-
return {
|
|
665
|
-
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(je, this.editor.getAttributes(rt)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
666
|
-
};
|
|
667
|
-
},
|
|
668
|
-
addKeyboardShortcuts() {
|
|
669
|
-
return {
|
|
670
|
-
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
671
|
-
};
|
|
672
|
-
},
|
|
673
|
-
addInputRules() {
|
|
674
|
-
let t = S({
|
|
675
|
-
find: nt,
|
|
676
|
-
type: this.type,
|
|
677
|
-
getAttributes: (e) => ({ start: +e[1] }),
|
|
678
|
-
joinPredicate: (e, r) => r.childCount + r.attrs.start === +e[1]
|
|
679
|
-
});
|
|
680
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (t = S({
|
|
681
|
-
find: nt,
|
|
682
|
-
type: this.type,
|
|
683
|
-
keepMarks: this.options.keepMarks,
|
|
684
|
-
keepAttributes: this.options.keepAttributes,
|
|
685
|
-
getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(rt) }),
|
|
686
|
-
joinPredicate: (e, r) => r.childCount + r.attrs.start === +e[1],
|
|
687
|
-
editor: this.editor
|
|
688
|
-
})), [t];
|
|
689
|
-
}
|
|
690
|
-
}), Ke = /^\s*(\[([( |x])?\])\s$/, kt = L.create({
|
|
691
|
-
name: "taskItem",
|
|
692
|
-
addOptions() {
|
|
693
|
-
return {
|
|
694
|
-
nested: !1,
|
|
695
|
-
HTMLAttributes: {},
|
|
696
|
-
taskListTypeName: "taskList",
|
|
697
|
-
a11y: void 0
|
|
698
|
-
};
|
|
699
|
-
},
|
|
700
|
-
content() {
|
|
701
|
-
return this.options.nested ? "paragraph block*" : "paragraph+";
|
|
702
|
-
},
|
|
703
|
-
defining: !0,
|
|
704
|
-
addAttributes() {
|
|
705
|
-
return {
|
|
706
|
-
checked: {
|
|
707
|
-
default: !1,
|
|
708
|
-
keepOnSplit: !1,
|
|
709
|
-
parseHTML: (t) => {
|
|
710
|
-
const e = t.getAttribute("data-checked");
|
|
711
|
-
return e === "" || e === "true";
|
|
712
|
-
},
|
|
713
|
-
renderHTML: (t) => ({
|
|
714
|
-
"data-checked": t.checked
|
|
715
|
-
})
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
},
|
|
719
|
-
parseHTML() {
|
|
720
|
-
return [
|
|
721
|
-
{
|
|
722
|
-
tag: `li[data-type="${this.name}"]`,
|
|
723
|
-
priority: 51
|
|
724
|
-
}
|
|
725
|
-
];
|
|
726
|
-
},
|
|
727
|
-
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
728
|
-
return [
|
|
729
|
-
"li",
|
|
730
|
-
k(this.options.HTMLAttributes, e, {
|
|
731
|
-
"data-type": this.name
|
|
732
|
-
}),
|
|
733
|
-
[
|
|
734
|
-
"label",
|
|
735
|
-
[
|
|
736
|
-
"input",
|
|
737
|
-
{
|
|
738
|
-
type: "checkbox",
|
|
739
|
-
checked: t.attrs.checked ? "checked" : null
|
|
740
|
-
}
|
|
741
|
-
],
|
|
742
|
-
["span"]
|
|
743
|
-
],
|
|
744
|
-
["div", 0]
|
|
745
|
-
];
|
|
746
|
-
},
|
|
747
|
-
parseMarkdown: (t, e) => {
|
|
748
|
-
const r = [];
|
|
749
|
-
if (t.tokens && t.tokens.length > 0 ? r.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? r.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : r.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
|
|
750
|
-
const n = e.parseChildren(t.nestedTokens);
|
|
751
|
-
r.push(...n);
|
|
752
|
-
}
|
|
753
|
-
return e.createNode("taskItem", { checked: t.checked || !1 }, r);
|
|
754
|
-
},
|
|
755
|
-
renderMarkdown: (t, e) => {
|
|
756
|
-
var r;
|
|
757
|
-
const s = `- [${(r = t.attrs) != null && r.checked ? "x" : " "}] `;
|
|
758
|
-
return lt(t, e, s);
|
|
759
|
-
},
|
|
760
|
-
addKeyboardShortcuts() {
|
|
761
|
-
const t = {
|
|
762
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
763
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
764
|
-
};
|
|
765
|
-
return this.options.nested ? {
|
|
766
|
-
...t,
|
|
767
|
-
Tab: () => this.editor.commands.sinkListItem(this.name)
|
|
768
|
-
} : t;
|
|
769
|
-
},
|
|
770
|
-
addNodeView() {
|
|
771
|
-
return ({ node: t, HTMLAttributes: e, getPos: r, editor: n }) => {
|
|
772
|
-
const s = document.createElement("li"), i = document.createElement("label"), a = document.createElement("span"), o = document.createElement("input"), c = document.createElement("div"), l = (d) => {
|
|
773
|
-
var u, h;
|
|
774
|
-
o.ariaLabel = ((h = (u = this.options.a11y) == null ? void 0 : u.checkboxLabel) == null ? void 0 : h.call(u, d, o.checked)) || `Task item checkbox for ${d.textContent || "empty task item"}`;
|
|
775
|
-
};
|
|
776
|
-
return l(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (d) => d.preventDefault()), o.addEventListener("change", (d) => {
|
|
777
|
-
if (!n.isEditable && !this.options.onReadOnlyChecked) {
|
|
778
|
-
o.checked = !o.checked;
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
const { checked: u } = d.target;
|
|
782
|
-
n.isEditable && typeof r == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: h }) => {
|
|
783
|
-
const m = r();
|
|
784
|
-
if (typeof m != "number")
|
|
785
|
-
return !1;
|
|
786
|
-
const f = h.doc.nodeAt(m);
|
|
787
|
-
return h.setNodeMarkup(m, void 0, {
|
|
788
|
-
...f?.attrs,
|
|
789
|
-
checked: u
|
|
790
|
-
}), !0;
|
|
791
|
-
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, u) || (o.checked = !o.checked));
|
|
792
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([d, u]) => {
|
|
793
|
-
s.setAttribute(d, u);
|
|
794
|
-
}), s.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, a), s.append(i, c), Object.entries(e).forEach(([d, u]) => {
|
|
795
|
-
s.setAttribute(d, u);
|
|
796
|
-
}), {
|
|
797
|
-
dom: s,
|
|
798
|
-
contentDOM: c,
|
|
799
|
-
update: (d) => d.type !== this.type ? !1 : (s.dataset.checked = d.attrs.checked, o.checked = d.attrs.checked, l(d), !0)
|
|
800
|
-
};
|
|
801
|
-
};
|
|
802
|
-
},
|
|
803
|
-
addInputRules() {
|
|
804
|
-
return [
|
|
805
|
-
S({
|
|
806
|
-
find: Ke,
|
|
807
|
-
type: this.type,
|
|
808
|
-
getAttributes: (t) => ({
|
|
809
|
-
checked: t[t.length - 1] === "x"
|
|
810
|
-
})
|
|
811
|
-
})
|
|
812
|
-
];
|
|
813
|
-
}
|
|
814
|
-
}), Tt = L.create({
|
|
815
|
-
name: "taskList",
|
|
816
|
-
addOptions() {
|
|
817
|
-
return {
|
|
818
|
-
itemTypeName: "taskItem",
|
|
819
|
-
HTMLAttributes: {}
|
|
820
|
-
};
|
|
821
|
-
},
|
|
822
|
-
group: "block list",
|
|
823
|
-
content() {
|
|
824
|
-
return `${this.options.itemTypeName}+`;
|
|
825
|
-
},
|
|
826
|
-
parseHTML() {
|
|
827
|
-
return [
|
|
828
|
-
{
|
|
829
|
-
tag: `ul[data-type="${this.name}"]`,
|
|
830
|
-
priority: 51
|
|
831
|
-
}
|
|
832
|
-
];
|
|
833
|
-
},
|
|
834
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
835
|
-
return ["ul", k(this.options.HTMLAttributes, t, { "data-type": this.name }), 0];
|
|
836
|
-
},
|
|
837
|
-
parseMarkdown: (t, e) => e.createNode("taskList", {}, e.parseChildren(t.items || [])),
|
|
838
|
-
renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
|
|
839
|
-
`) : "",
|
|
840
|
-
markdownTokenizer: {
|
|
841
|
-
name: "taskList",
|
|
842
|
-
level: "block",
|
|
843
|
-
start(t) {
|
|
844
|
-
var e;
|
|
845
|
-
const r = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
|
|
846
|
-
return r !== void 0 ? r : -1;
|
|
847
|
-
},
|
|
848
|
-
tokenize(t, e, r) {
|
|
849
|
-
const n = (i) => {
|
|
850
|
-
const a = F(
|
|
851
|
-
i,
|
|
852
|
-
{
|
|
853
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
854
|
-
extractItemData: (o) => ({
|
|
855
|
-
indentLevel: o[1].length,
|
|
856
|
-
mainContent: o[4],
|
|
857
|
-
checked: o[3].toLowerCase() === "x"
|
|
858
|
-
}),
|
|
859
|
-
createToken: (o, c) => ({
|
|
860
|
-
type: "taskItem",
|
|
861
|
-
raw: "",
|
|
862
|
-
mainContent: o.mainContent,
|
|
863
|
-
indentLevel: o.indentLevel,
|
|
864
|
-
checked: o.checked,
|
|
865
|
-
text: o.mainContent,
|
|
866
|
-
tokens: r.inlineTokens(o.mainContent),
|
|
867
|
-
nestedTokens: c
|
|
868
|
-
}),
|
|
869
|
-
// Allow recursive nesting
|
|
870
|
-
customNestedParser: n
|
|
871
|
-
},
|
|
872
|
-
r
|
|
873
|
-
);
|
|
874
|
-
return a ? [
|
|
875
|
-
{
|
|
876
|
-
type: "taskList",
|
|
877
|
-
raw: a.raw,
|
|
878
|
-
items: a.items
|
|
879
|
-
}
|
|
880
|
-
] : r.blockTokens(i);
|
|
881
|
-
}, s = F(
|
|
882
|
-
t,
|
|
883
|
-
{
|
|
884
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
885
|
-
extractItemData: (i) => ({
|
|
886
|
-
indentLevel: i[1].length,
|
|
887
|
-
mainContent: i[4],
|
|
888
|
-
checked: i[3].toLowerCase() === "x"
|
|
889
|
-
}),
|
|
890
|
-
createToken: (i, a) => ({
|
|
891
|
-
type: "taskItem",
|
|
892
|
-
raw: "",
|
|
893
|
-
mainContent: i.mainContent,
|
|
894
|
-
indentLevel: i.indentLevel,
|
|
895
|
-
checked: i.checked,
|
|
896
|
-
text: i.mainContent,
|
|
897
|
-
tokens: r.inlineTokens(i.mainContent),
|
|
898
|
-
nestedTokens: a
|
|
899
|
-
}),
|
|
900
|
-
// Use the recursive parser for nested content
|
|
901
|
-
customNestedParser: n
|
|
902
|
-
},
|
|
903
|
-
r
|
|
904
|
-
);
|
|
905
|
-
if (s)
|
|
906
|
-
return {
|
|
907
|
-
type: "taskList",
|
|
908
|
-
raw: s.raw,
|
|
909
|
-
items: s.items
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
},
|
|
913
|
-
markdownOptions: {
|
|
914
|
-
indentsContent: !0
|
|
915
|
-
},
|
|
916
|
-
addCommands() {
|
|
917
|
-
return {
|
|
918
|
-
toggleTaskList: () => ({ commands: t }) => t.toggleList(this.name, this.options.itemTypeName)
|
|
919
|
-
};
|
|
920
|
-
},
|
|
921
|
-
addKeyboardShortcuts() {
|
|
922
|
-
return {
|
|
923
|
-
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
C.create({
|
|
928
|
-
name: "listKit",
|
|
929
|
-
addExtensions() {
|
|
930
|
-
const t = [];
|
|
931
|
-
return this.options.bulletList !== !1 && t.push(Re.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Pe.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(De.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(Qe.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(kt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(Tt.configure(this.options.taskList)), t;
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
var Ve = Q.create({
|
|
935
|
-
name: "subscript",
|
|
936
|
-
addOptions() {
|
|
937
|
-
return {
|
|
938
|
-
HTMLAttributes: {}
|
|
939
|
-
};
|
|
940
|
-
},
|
|
941
|
-
parseHTML() {
|
|
942
|
-
return [
|
|
943
|
-
{
|
|
944
|
-
tag: "sub"
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
style: "vertical-align",
|
|
948
|
-
getAttrs(t) {
|
|
949
|
-
return t !== "sub" ? !1 : null;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
];
|
|
953
|
-
},
|
|
954
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
955
|
-
return ["sub", k(this.options.HTMLAttributes, t), 0];
|
|
956
|
-
},
|
|
957
|
-
addCommands() {
|
|
958
|
-
return {
|
|
959
|
-
setSubscript: () => ({ commands: t }) => t.setMark(this.name),
|
|
960
|
-
toggleSubscript: () => ({ commands: t }) => t.toggleMark(this.name),
|
|
961
|
-
unsetSubscript: () => ({ commands: t }) => t.unsetMark(this.name)
|
|
962
|
-
};
|
|
963
|
-
},
|
|
964
|
-
addKeyboardShortcuts() {
|
|
965
|
-
return {
|
|
966
|
-
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
}), qe = Q.create({
|
|
970
|
-
name: "superscript",
|
|
971
|
-
addOptions() {
|
|
972
|
-
return {
|
|
973
|
-
HTMLAttributes: {}
|
|
974
|
-
};
|
|
975
|
-
},
|
|
976
|
-
parseHTML() {
|
|
977
|
-
return [
|
|
978
|
-
{
|
|
979
|
-
tag: "sup"
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
style: "vertical-align",
|
|
983
|
-
getAttrs(t) {
|
|
984
|
-
return t !== "super" ? !1 : null;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
];
|
|
988
|
-
},
|
|
989
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
990
|
-
return ["sup", k(this.options.HTMLAttributes, t), 0];
|
|
991
|
-
},
|
|
992
|
-
addCommands() {
|
|
993
|
-
return {
|
|
994
|
-
setSuperscript: () => ({ commands: t }) => t.setMark(this.name),
|
|
995
|
-
toggleSuperscript: () => ({ commands: t }) => t.toggleMark(this.name),
|
|
996
|
-
unsetSuperscript: () => ({ commands: t }) => t.unsetMark(this.name)
|
|
997
|
-
};
|
|
998
|
-
},
|
|
999
|
-
addKeyboardShortcuts() {
|
|
1000
|
-
return {
|
|
1001
|
-
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
}), Fe = C.create({
|
|
1005
|
-
name: "textAlign",
|
|
1006
|
-
addOptions() {
|
|
1007
|
-
return {
|
|
1008
|
-
types: [],
|
|
1009
|
-
alignments: ["left", "center", "right", "justify"],
|
|
1010
|
-
defaultAlignment: null
|
|
1011
|
-
};
|
|
1012
|
-
},
|
|
1013
|
-
addGlobalAttributes() {
|
|
1014
|
-
return [
|
|
1015
|
-
{
|
|
1016
|
-
types: this.options.types,
|
|
1017
|
-
attributes: {
|
|
1018
|
-
textAlign: {
|
|
1019
|
-
default: this.options.defaultAlignment,
|
|
1020
|
-
parseHTML: (t) => {
|
|
1021
|
-
const e = t.style.textAlign;
|
|
1022
|
-
return this.options.alignments.includes(e) ? e : this.options.defaultAlignment;
|
|
1023
|
-
},
|
|
1024
|
-
renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
];
|
|
1029
|
-
},
|
|
1030
|
-
addCommands() {
|
|
1031
|
-
return {
|
|
1032
|
-
setTextAlign: (t) => ({ commands: e }) => this.options.alignments.includes(t) ? this.options.types.map((r) => e.updateAttributes(r, { textAlign: t })).every((r) => r) : !1,
|
|
1033
|
-
unsetTextAlign: () => ({ commands: t }) => this.options.types.map((e) => t.resetAttributes(e, "textAlign")).every((e) => e),
|
|
1034
|
-
toggleTextAlign: (t) => ({ editor: e, commands: r }) => this.options.alignments.includes(t) ? e.isActive({ textAlign: t }) ? r.unsetTextAlign() : r.setTextAlign(t) : !1
|
|
1035
|
-
};
|
|
1036
|
-
},
|
|
1037
|
-
addKeyboardShortcuts() {
|
|
1038
|
-
return {
|
|
1039
|
-
"Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
|
|
1040
|
-
"Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
|
|
1041
|
-
"Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
|
|
1042
|
-
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
}), Ue = (t) => y({
|
|
1046
|
-
find: /--$/,
|
|
1047
|
-
replace: t ?? "—"
|
|
1048
|
-
}), Ge = (t) => y({
|
|
1049
|
-
find: /\.\.\.$/,
|
|
1050
|
-
replace: t ?? "…"
|
|
1051
|
-
}), Xe = (t) => y({
|
|
1052
|
-
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
1053
|
-
replace: t ?? "“"
|
|
1054
|
-
}), Ye = (t) => y({
|
|
1055
|
-
find: /"$/,
|
|
1056
|
-
replace: t ?? "”"
|
|
1057
|
-
}), Ze = (t) => y({
|
|
1058
|
-
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
1059
|
-
replace: t ?? "‘"
|
|
1060
|
-
}), Je = (t) => y({
|
|
1061
|
-
find: /'$/,
|
|
1062
|
-
replace: t ?? "’"
|
|
1063
|
-
}), tr = (t) => y({
|
|
1064
|
-
find: /<-$/,
|
|
1065
|
-
replace: t ?? "←"
|
|
1066
|
-
}), er = (t) => y({
|
|
1067
|
-
find: /->$/,
|
|
1068
|
-
replace: t ?? "→"
|
|
1069
|
-
}), rr = (t) => y({
|
|
1070
|
-
find: /\(c\)$/,
|
|
1071
|
-
replace: t ?? "©"
|
|
1072
|
-
}), nr = (t) => y({
|
|
1073
|
-
find: /\(tm\)$/,
|
|
1074
|
-
replace: t ?? "™"
|
|
1075
|
-
}), sr = (t) => y({
|
|
1076
|
-
find: /\(sm\)$/,
|
|
1077
|
-
replace: t ?? "℠"
|
|
1078
|
-
}), ir = (t) => y({
|
|
1079
|
-
find: /\(r\)$/,
|
|
1080
|
-
replace: t ?? "®"
|
|
1081
|
-
}), or = (t) => y({
|
|
1082
|
-
find: /(?:^|\s)(1\/2)\s$/,
|
|
1083
|
-
replace: t ?? "½"
|
|
1084
|
-
}), ar = (t) => y({
|
|
1085
|
-
find: /\+\/-$/,
|
|
1086
|
-
replace: t ?? "±"
|
|
1087
|
-
}), lr = (t) => y({
|
|
1088
|
-
find: /!=$/,
|
|
1089
|
-
replace: t ?? "≠"
|
|
1090
|
-
}), ur = (t) => y({
|
|
1091
|
-
find: /<<$/,
|
|
1092
|
-
replace: t ?? "«"
|
|
1093
|
-
}), dr = (t) => y({
|
|
1094
|
-
find: />>$/,
|
|
1095
|
-
replace: t ?? "»"
|
|
1096
|
-
}), cr = (t) => y({
|
|
1097
|
-
find: /\d+\s?([*x])\s?\d+$/,
|
|
1098
|
-
replace: t ?? "×"
|
|
1099
|
-
}), pr = (t) => y({
|
|
1100
|
-
find: /\^2$/,
|
|
1101
|
-
replace: t ?? "²"
|
|
1102
|
-
}), hr = (t) => y({
|
|
1103
|
-
find: /\^3$/,
|
|
1104
|
-
replace: t ?? "³"
|
|
1105
|
-
}), fr = (t) => y({
|
|
1106
|
-
find: /(?:^|\s)(1\/4)\s$/,
|
|
1107
|
-
replace: t ?? "¼"
|
|
1108
|
-
}), mr = (t) => y({
|
|
1109
|
-
find: /(?:^|\s)(3\/4)\s$/,
|
|
1110
|
-
replace: t ?? "¾"
|
|
1111
|
-
}), gr = C.create({
|
|
1112
|
-
name: "typography",
|
|
1113
|
-
addOptions() {
|
|
1114
|
-
return {
|
|
1115
|
-
closeDoubleQuote: "”",
|
|
1116
|
-
closeSingleQuote: "’",
|
|
1117
|
-
copyright: "©",
|
|
1118
|
-
ellipsis: "…",
|
|
1119
|
-
emDash: "—",
|
|
1120
|
-
laquo: "«",
|
|
1121
|
-
leftArrow: "←",
|
|
1122
|
-
multiplication: "×",
|
|
1123
|
-
notEqual: "≠",
|
|
1124
|
-
oneHalf: "½",
|
|
1125
|
-
oneQuarter: "¼",
|
|
1126
|
-
openDoubleQuote: "“",
|
|
1127
|
-
openSingleQuote: "‘",
|
|
1128
|
-
plusMinus: "±",
|
|
1129
|
-
raquo: "»",
|
|
1130
|
-
registeredTrademark: "®",
|
|
1131
|
-
rightArrow: "→",
|
|
1132
|
-
servicemark: "℠",
|
|
1133
|
-
superscriptThree: "³",
|
|
1134
|
-
superscriptTwo: "²",
|
|
1135
|
-
threeQuarters: "¾",
|
|
1136
|
-
trademark: "™"
|
|
1137
|
-
};
|
|
1138
|
-
},
|
|
1139
|
-
addInputRules() {
|
|
1140
|
-
const t = [];
|
|
1141
|
-
return this.options.emDash !== !1 && t.push(Ue(this.options.emDash)), this.options.ellipsis !== !1 && t.push(Ge(this.options.ellipsis)), this.options.openDoubleQuote !== !1 && t.push(Xe(this.options.openDoubleQuote)), this.options.closeDoubleQuote !== !1 && t.push(Ye(this.options.closeDoubleQuote)), this.options.openSingleQuote !== !1 && t.push(Ze(this.options.openSingleQuote)), this.options.closeSingleQuote !== !1 && t.push(Je(this.options.closeSingleQuote)), this.options.leftArrow !== !1 && t.push(tr(this.options.leftArrow)), this.options.rightArrow !== !1 && t.push(er(this.options.rightArrow)), this.options.copyright !== !1 && t.push(rr(this.options.copyright)), this.options.trademark !== !1 && t.push(nr(this.options.trademark)), this.options.servicemark !== !1 && t.push(sr(this.options.servicemark)), this.options.registeredTrademark !== !1 && t.push(ir(this.options.registeredTrademark)), this.options.oneHalf !== !1 && t.push(or(this.options.oneHalf)), this.options.plusMinus !== !1 && t.push(ar(this.options.plusMinus)), this.options.notEqual !== !1 && t.push(lr(this.options.notEqual)), this.options.laquo !== !1 && t.push(ur(this.options.laquo)), this.options.raquo !== !1 && t.push(dr(this.options.raquo)), this.options.multiplication !== !1 && t.push(cr(this.options.multiplication)), this.options.superscriptTwo !== !1 && t.push(pr(this.options.superscriptTwo)), this.options.superscriptThree !== !1 && t.push(hr(this.options.superscriptThree)), this.options.oneQuarter !== !1 && t.push(fr(this.options.oneQuarter)), this.options.threeQuarters !== !1 && t.push(mr(this.options.threeQuarters)), t;
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
C.create({
|
|
1145
|
-
name: "characterCount",
|
|
1146
|
-
addOptions() {
|
|
1147
|
-
return {
|
|
1148
|
-
limit: null,
|
|
1149
|
-
mode: "textSize",
|
|
1150
|
-
textCounter: (t) => t.length,
|
|
1151
|
-
wordCounter: (t) => t.split(" ").filter((e) => e !== "").length
|
|
1152
|
-
};
|
|
1153
|
-
},
|
|
1154
|
-
addStorage() {
|
|
1155
|
-
return {
|
|
1156
|
-
characters: () => 0,
|
|
1157
|
-
words: () => 0
|
|
1158
|
-
};
|
|
1159
|
-
},
|
|
1160
|
-
onBeforeCreate() {
|
|
1161
|
-
this.storage.characters = (t) => {
|
|
1162
|
-
const e = t?.node || this.editor.state.doc;
|
|
1163
|
-
if ((t?.mode || this.options.mode) === "textSize") {
|
|
1164
|
-
const n = e.textBetween(0, e.content.size, void 0, " ");
|
|
1165
|
-
return this.options.textCounter(n);
|
|
1166
|
-
}
|
|
1167
|
-
return e.nodeSize;
|
|
1168
|
-
}, this.storage.words = (t) => {
|
|
1169
|
-
const e = t?.node || this.editor.state.doc, r = e.textBetween(0, e.content.size, " ", " ");
|
|
1170
|
-
return this.options.wordCounter(r);
|
|
1171
|
-
};
|
|
1172
|
-
},
|
|
1173
|
-
addProseMirrorPlugins() {
|
|
1174
|
-
let t = !1;
|
|
1175
|
-
return [
|
|
1176
|
-
new H({
|
|
1177
|
-
key: new E("characterCount"),
|
|
1178
|
-
appendTransaction: (e, r, n) => {
|
|
1179
|
-
if (t)
|
|
1180
|
-
return;
|
|
1181
|
-
const s = this.options.limit;
|
|
1182
|
-
if (s == null || s === 0) {
|
|
1183
|
-
t = !0;
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
const i = this.storage.characters({ node: n.doc });
|
|
1187
|
-
if (i > s) {
|
|
1188
|
-
const a = i - s, o = 0, c = a;
|
|
1189
|
-
console.warn(
|
|
1190
|
-
`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`
|
|
1191
|
-
);
|
|
1192
|
-
const l = n.tr.deleteRange(o, c);
|
|
1193
|
-
return t = !0, l;
|
|
1194
|
-
}
|
|
1195
|
-
t = !0;
|
|
1196
|
-
},
|
|
1197
|
-
filterTransaction: (e, r) => {
|
|
1198
|
-
const n = this.options.limit;
|
|
1199
|
-
if (!e.docChanged || n === 0 || n === null || n === void 0)
|
|
1200
|
-
return !0;
|
|
1201
|
-
const s = this.storage.characters({ node: r.doc }), i = this.storage.characters({ node: e.doc });
|
|
1202
|
-
if (i <= n || s > n && i > n && i <= s)
|
|
1203
|
-
return !0;
|
|
1204
|
-
if (s > n && i > n && i > s || !e.getMeta("paste"))
|
|
1205
|
-
return !1;
|
|
1206
|
-
const o = e.selection.$head.pos, c = i - n, l = o - c, d = o;
|
|
1207
|
-
return e.deleteRange(l, d), !(this.storage.characters({ node: e.doc }) > n);
|
|
1208
|
-
}
|
|
1209
|
-
})
|
|
1210
|
-
];
|
|
1211
|
-
}
|
|
1212
|
-
});
|
|
1213
|
-
C.create({
|
|
1214
|
-
name: "dropCursor",
|
|
1215
|
-
addOptions() {
|
|
1216
|
-
return {
|
|
1217
|
-
color: "currentColor",
|
|
1218
|
-
width: 1,
|
|
1219
|
-
class: void 0
|
|
1220
|
-
};
|
|
1221
|
-
},
|
|
1222
|
-
addProseMirrorPlugins() {
|
|
1223
|
-
return [Ot(this.options)];
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
C.create({
|
|
1227
|
-
name: "focus",
|
|
1228
|
-
addOptions() {
|
|
1229
|
-
return {
|
|
1230
|
-
className: "has-focus",
|
|
1231
|
-
mode: "all"
|
|
1232
|
-
};
|
|
1233
|
-
},
|
|
1234
|
-
addProseMirrorPlugins() {
|
|
1235
|
-
return [
|
|
1236
|
-
new H({
|
|
1237
|
-
key: new E("focus"),
|
|
1238
|
-
props: {
|
|
1239
|
-
decorations: ({ doc: t, selection: e }) => {
|
|
1240
|
-
const { isEditable: r, isFocused: n } = this.editor, { anchor: s } = e, i = [];
|
|
1241
|
-
if (!r || !n)
|
|
1242
|
-
return B.create(t, []);
|
|
1243
|
-
let a = 0;
|
|
1244
|
-
this.options.mode === "deepest" && t.descendants((c, l) => {
|
|
1245
|
-
if (c.isText)
|
|
1246
|
-
return;
|
|
1247
|
-
if (!(s >= l && s <= l + c.nodeSize - 1))
|
|
1248
|
-
return !1;
|
|
1249
|
-
a += 1;
|
|
1250
|
-
});
|
|
1251
|
-
let o = 0;
|
|
1252
|
-
return t.descendants((c, l) => {
|
|
1253
|
-
if (c.isText || !(s >= l && s <= l + c.nodeSize - 1))
|
|
1254
|
-
return !1;
|
|
1255
|
-
if (o += 1, this.options.mode === "deepest" && a - o > 0 || this.options.mode === "shallowest" && o > 1)
|
|
1256
|
-
return this.options.mode === "deepest";
|
|
1257
|
-
i.push(
|
|
1258
|
-
K.node(l, l + c.nodeSize, {
|
|
1259
|
-
class: this.options.className
|
|
1260
|
-
})
|
|
1261
|
-
);
|
|
1262
|
-
}), B.create(t, i);
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
})
|
|
1266
|
-
];
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
C.create({
|
|
1270
|
-
name: "gapCursor",
|
|
1271
|
-
addProseMirrorPlugins() {
|
|
1272
|
-
return [Dt()];
|
|
1273
|
-
},
|
|
1274
|
-
extendNodeSchema(t) {
|
|
1275
|
-
var e;
|
|
1276
|
-
const r = {
|
|
1277
|
-
name: t.name,
|
|
1278
|
-
options: t.options,
|
|
1279
|
-
storage: t.storage
|
|
1280
|
-
};
|
|
1281
|
-
return {
|
|
1282
|
-
allowGapCursor: (e = dt(ct(t, "allowGapCursor", r))) != null ? e : null
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
});
|
|
1286
|
-
var br = C.create({
|
|
1287
|
-
name: "placeholder",
|
|
1288
|
-
addOptions() {
|
|
1289
|
-
return {
|
|
1290
|
-
emptyEditorClass: "is-editor-empty",
|
|
1291
|
-
emptyNodeClass: "is-empty",
|
|
1292
|
-
placeholder: "Write something …",
|
|
1293
|
-
showOnlyWhenEditable: !0,
|
|
1294
|
-
showOnlyCurrent: !0,
|
|
1295
|
-
includeChildren: !1
|
|
1296
|
-
};
|
|
1297
|
-
},
|
|
1298
|
-
addProseMirrorPlugins() {
|
|
1299
|
-
return [
|
|
1300
|
-
new H({
|
|
1301
|
-
key: new E("placeholder"),
|
|
1302
|
-
props: {
|
|
1303
|
-
decorations: ({ doc: t, selection: e }) => {
|
|
1304
|
-
const r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: n } = e, s = [];
|
|
1305
|
-
if (!r)
|
|
1306
|
-
return null;
|
|
1307
|
-
const i = this.editor.isEmpty;
|
|
1308
|
-
return t.descendants((a, o) => {
|
|
1309
|
-
const c = n >= o && n <= o + a.nodeSize, l = !a.isLeaf && Nt(a);
|
|
1310
|
-
if ((c || !this.options.showOnlyCurrent) && l) {
|
|
1311
|
-
const d = [this.options.emptyNodeClass];
|
|
1312
|
-
i && d.push(this.options.emptyEditorClass);
|
|
1313
|
-
const u = K.node(o, o + a.nodeSize, {
|
|
1314
|
-
class: d.join(" "),
|
|
1315
|
-
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
1316
|
-
editor: this.editor,
|
|
1317
|
-
node: a,
|
|
1318
|
-
pos: o,
|
|
1319
|
-
hasAnchor: c
|
|
1320
|
-
}) : this.options.placeholder
|
|
1321
|
-
});
|
|
1322
|
-
s.push(u);
|
|
1323
|
-
}
|
|
1324
|
-
return this.options.includeChildren;
|
|
1325
|
-
}), B.create(t, s);
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
})
|
|
1329
|
-
];
|
|
1330
|
-
}
|
|
1331
|
-
}), yr = C.create({
|
|
1332
|
-
name: "selection",
|
|
1333
|
-
addOptions() {
|
|
1334
|
-
return {
|
|
1335
|
-
className: "selection"
|
|
1336
|
-
};
|
|
1337
|
-
},
|
|
1338
|
-
addProseMirrorPlugins() {
|
|
1339
|
-
const { editor: t, options: e } = this;
|
|
1340
|
-
return [
|
|
1341
|
-
new H({
|
|
1342
|
-
key: new E("selection"),
|
|
1343
|
-
props: {
|
|
1344
|
-
decorations(r) {
|
|
1345
|
-
return r.selection.empty || t.isFocused || !t.isEditable || Rt(r.selection) || t.view.dragging ? null : B.create(r.doc, [
|
|
1346
|
-
K.inline(r.selection.from, r.selection.to, {
|
|
1347
|
-
class: e.className
|
|
1348
|
-
})
|
|
1349
|
-
]);
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
})
|
|
1353
|
-
];
|
|
1354
|
-
}
|
|
1355
|
-
});
|
|
1356
|
-
function st({ types: t, node: e }) {
|
|
1357
|
-
return e && Array.isArray(t) && t.includes(e.type) || e?.type === t;
|
|
1358
|
-
}
|
|
1359
|
-
C.create({
|
|
1360
|
-
name: "trailingNode",
|
|
1361
|
-
addOptions() {
|
|
1362
|
-
return {
|
|
1363
|
-
node: void 0,
|
|
1364
|
-
notAfter: []
|
|
1365
|
-
};
|
|
1366
|
-
},
|
|
1367
|
-
addProseMirrorPlugins() {
|
|
1368
|
-
var t;
|
|
1369
|
-
const e = new E(this.name), r = ((t = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : t.name) || this.options.node || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, s]) => s).filter((s) => (this.options.notAfter || []).concat(r).includes(s.name));
|
|
1370
|
-
return [
|
|
1371
|
-
new H({
|
|
1372
|
-
key: e,
|
|
1373
|
-
appendTransaction: (s, i, a) => {
|
|
1374
|
-
const { doc: o, tr: c, schema: l } = a, d = e.getState(a), u = o.content.size, h = l.nodes[r];
|
|
1375
|
-
if (d)
|
|
1376
|
-
return c.insert(u, h.create());
|
|
1377
|
-
},
|
|
1378
|
-
state: {
|
|
1379
|
-
init: (s, i) => {
|
|
1380
|
-
const a = i.tr.doc.lastChild;
|
|
1381
|
-
return !st({ node: a, types: n });
|
|
1382
|
-
},
|
|
1383
|
-
apply: (s, i) => {
|
|
1384
|
-
if (!s.docChanged || s.getMeta("__uniqueIDTransaction"))
|
|
1385
|
-
return i;
|
|
1386
|
-
const a = s.doc.lastChild;
|
|
1387
|
-
return !st({ node: a, types: n });
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
})
|
|
1391
|
-
];
|
|
1392
|
-
}
|
|
1393
|
-
});
|
|
1394
|
-
C.create({
|
|
1395
|
-
name: "undoRedo",
|
|
1396
|
-
addOptions() {
|
|
1397
|
-
return {
|
|
1398
|
-
depth: 100,
|
|
1399
|
-
newGroupDelay: 500
|
|
1400
|
-
};
|
|
1401
|
-
},
|
|
1402
|
-
addCommands() {
|
|
1403
|
-
return {
|
|
1404
|
-
undo: () => ({ state: t, dispatch: e }) => Wt(t, e),
|
|
1405
|
-
redo: () => ({ state: t, dispatch: e }) => zt(t, e)
|
|
1406
|
-
};
|
|
1407
|
-
},
|
|
1408
|
-
addProseMirrorPlugins() {
|
|
1409
|
-
return [_t(this.options)];
|
|
1410
|
-
},
|
|
1411
|
-
addKeyboardShortcuts() {
|
|
1412
|
-
return {
|
|
1413
|
-
"Mod-z": () => this.editor.commands.undo(),
|
|
1414
|
-
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
1415
|
-
"Mod-y": () => this.editor.commands.redo(),
|
|
1416
|
-
// Russian keyboard layouts
|
|
1417
|
-
"Mod-я": () => this.editor.commands.undo(),
|
|
1418
|
-
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
});
|
|
1422
|
-
var kr = L.create({
|
|
1423
|
-
name: "tableCell",
|
|
1424
|
-
addOptions() {
|
|
1425
|
-
return {
|
|
1426
|
-
HTMLAttributes: {}
|
|
1427
|
-
};
|
|
1428
|
-
},
|
|
1429
|
-
content: "block+",
|
|
1430
|
-
addAttributes() {
|
|
1431
|
-
return {
|
|
1432
|
-
colspan: {
|
|
1433
|
-
default: 1
|
|
1434
|
-
},
|
|
1435
|
-
rowspan: {
|
|
1436
|
-
default: 1
|
|
1437
|
-
},
|
|
1438
|
-
colwidth: {
|
|
1439
|
-
default: null,
|
|
1440
|
-
parseHTML: (t) => {
|
|
1441
|
-
var e, r;
|
|
1442
|
-
const n = t.getAttribute("colwidth"), s = n ? n.split(",").map((i) => parseInt(i, 10)) : null;
|
|
1443
|
-
if (!s) {
|
|
1444
|
-
const i = (e = t.closest("table")) == null ? void 0 : e.querySelectorAll("colgroup > col"), a = Array.from(((r = t.parentElement) == null ? void 0 : r.children) || []).indexOf(t);
|
|
1445
|
-
if (a && a > -1 && i && i[a]) {
|
|
1446
|
-
const o = i[a].getAttribute("width");
|
|
1447
|
-
return o ? [parseInt(o, 10)] : null;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
return s;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
};
|
|
1454
|
-
},
|
|
1455
|
-
tableRole: "cell",
|
|
1456
|
-
isolating: !0,
|
|
1457
|
-
parseHTML() {
|
|
1458
|
-
return [{ tag: "td" }];
|
|
1459
|
-
},
|
|
1460
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
1461
|
-
return ["td", k(this.options.HTMLAttributes, t), 0];
|
|
1462
|
-
}
|
|
1463
|
-
}), Tr = L.create({
|
|
1464
|
-
name: "tableHeader",
|
|
1465
|
-
addOptions() {
|
|
1466
|
-
return {
|
|
1467
|
-
HTMLAttributes: {}
|
|
1468
|
-
};
|
|
1469
|
-
},
|
|
1470
|
-
content: "block+",
|
|
1471
|
-
addAttributes() {
|
|
1472
|
-
return {
|
|
1473
|
-
colspan: {
|
|
1474
|
-
default: 1
|
|
1475
|
-
},
|
|
1476
|
-
rowspan: {
|
|
1477
|
-
default: 1
|
|
1478
|
-
},
|
|
1479
|
-
colwidth: {
|
|
1480
|
-
default: null,
|
|
1481
|
-
parseHTML: (t) => {
|
|
1482
|
-
const e = t.getAttribute("colwidth");
|
|
1483
|
-
return e ? e.split(",").map((n) => parseInt(n, 10)) : null;
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
};
|
|
1487
|
-
},
|
|
1488
|
-
tableRole: "header_cell",
|
|
1489
|
-
isolating: !0,
|
|
1490
|
-
parseHTML() {
|
|
1491
|
-
return [{ tag: "th" }];
|
|
1492
|
-
},
|
|
1493
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
1494
|
-
return ["th", k(this.options.HTMLAttributes, t), 0];
|
|
1495
|
-
}
|
|
1496
|
-
}), Cr = L.create({
|
|
1497
|
-
name: "tableRow",
|
|
1498
|
-
addOptions() {
|
|
1499
|
-
return {
|
|
1500
|
-
HTMLAttributes: {}
|
|
1501
|
-
};
|
|
1502
|
-
},
|
|
1503
|
-
content: "(tableCell | tableHeader)*",
|
|
1504
|
-
tableRole: "row",
|
|
1505
|
-
parseHTML() {
|
|
1506
|
-
return [{ tag: "tr" }];
|
|
1507
|
-
},
|
|
1508
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
1509
|
-
return ["tr", k(this.options.HTMLAttributes, t), 0];
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
function j(t, e) {
|
|
1513
|
-
return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
|
|
1514
|
-
}
|
|
1515
|
-
function it(t, e, r, n, s, i) {
|
|
1516
|
-
var a;
|
|
1517
|
-
let o = 0, c = !0, l = e.firstChild;
|
|
1518
|
-
const d = t.firstChild;
|
|
1519
|
-
if (d !== null)
|
|
1520
|
-
for (let h = 0, m = 0; h < d.childCount; h += 1) {
|
|
1521
|
-
const { colspan: f, colwidth: b } = d.child(h).attrs;
|
|
1522
|
-
for (let g = 0; g < f; g += 1, m += 1) {
|
|
1523
|
-
const T = s === m ? i : b && b[g], v = T ? `${T}px` : "";
|
|
1524
|
-
if (o += T || n, T || (c = !1), l) {
|
|
1525
|
-
if (l.style.width !== v) {
|
|
1526
|
-
const [I, N] = j(n, T);
|
|
1527
|
-
l.style.setProperty(I, N);
|
|
1528
|
-
}
|
|
1529
|
-
l = l.nextSibling;
|
|
1530
|
-
} else {
|
|
1531
|
-
const I = document.createElement("col"), [N, O] = j(n, T);
|
|
1532
|
-
I.style.setProperty(N, O), e.appendChild(I);
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
for (; l; ) {
|
|
1537
|
-
const h = l.nextSibling;
|
|
1538
|
-
(a = l.parentNode) == null || a.removeChild(l), l = h;
|
|
1539
|
-
}
|
|
1540
|
-
const u = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
1541
|
-
c && !u ? (r.style.width = `${o}px`, r.style.minWidth = "") : (r.style.width = "", r.style.minWidth = `${o}px`);
|
|
1542
|
-
}
|
|
1543
|
-
var Lr = class {
|
|
1544
|
-
constructor(t, e) {
|
|
1545
|
-
this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), it(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1546
|
-
}
|
|
1547
|
-
update(t) {
|
|
1548
|
-
return t.type !== this.node.type ? !1 : (this.node = t, it(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
1549
|
-
}
|
|
1550
|
-
ignoreMutation(t) {
|
|
1551
|
-
const e = t.target, r = this.dom.contains(e), n = this.contentDOM.contains(e);
|
|
1552
|
-
return !!(r && !n && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
|
|
1553
|
-
}
|
|
1554
|
-
};
|
|
1555
|
-
function wr(t, e, r, n) {
|
|
1556
|
-
let s = 0, i = !0;
|
|
1557
|
-
const a = [], o = t.firstChild;
|
|
1558
|
-
if (!o)
|
|
1559
|
-
return {};
|
|
1560
|
-
for (let u = 0, h = 0; u < o.childCount; u += 1) {
|
|
1561
|
-
const { colspan: m, colwidth: f } = o.child(u).attrs;
|
|
1562
|
-
for (let b = 0; b < m; b += 1, h += 1) {
|
|
1563
|
-
const g = r === h ? n : f && f[b];
|
|
1564
|
-
s += g || e, g || (i = !1);
|
|
1565
|
-
const [T, v] = j(e, g);
|
|
1566
|
-
a.push(["col", { style: `${T}: ${v}` }]);
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
const c = i ? `${s}px` : "", l = i ? "" : `${s}px`;
|
|
1570
|
-
return { colgroup: ["colgroup", {}, ...a], tableWidth: c, tableMinWidth: l };
|
|
1571
|
-
}
|
|
1572
|
-
function ot(t, e) {
|
|
1573
|
-
return t.createAndFill();
|
|
1574
|
-
}
|
|
1575
|
-
function vr(t) {
|
|
1576
|
-
if (t.cached.tableNodeTypes)
|
|
1577
|
-
return t.cached.tableNodeTypes;
|
|
1578
|
-
const e = {};
|
|
1579
|
-
return Object.keys(t.nodes).forEach((r) => {
|
|
1580
|
-
const n = t.nodes[r];
|
|
1581
|
-
n.spec.tableRole && (e[n.spec.tableRole] = n);
|
|
1582
|
-
}), t.cached.tableNodeTypes = e, e;
|
|
1583
|
-
}
|
|
1584
|
-
function Mr(t, e, r, n, s) {
|
|
1585
|
-
const i = vr(t), a = [], o = [];
|
|
1586
|
-
for (let l = 0; l < r; l += 1) {
|
|
1587
|
-
const d = ot(i.cell);
|
|
1588
|
-
if (d && o.push(d), n) {
|
|
1589
|
-
const u = ot(i.header_cell);
|
|
1590
|
-
u && a.push(u);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
const c = [];
|
|
1594
|
-
for (let l = 0; l < e; l += 1)
|
|
1595
|
-
c.push(i.row.createChecked(null, n && l === 0 ? a : o));
|
|
1596
|
-
return i.table.createChecked(null, c);
|
|
1597
|
-
}
|
|
1598
|
-
function xr(t) {
|
|
1599
|
-
return t instanceof pt;
|
|
1600
|
-
}
|
|
1601
|
-
var P = ({ editor: t }) => {
|
|
1602
|
-
const { selection: e } = t.state;
|
|
1603
|
-
if (!xr(e))
|
|
1604
|
-
return !1;
|
|
1605
|
-
let r = 0;
|
|
1606
|
-
const n = Pt(e.ranges[0].$from, (i) => i.type.name === "table");
|
|
1607
|
-
return n?.node.descendants((i) => {
|
|
1608
|
-
if (i.type.name === "table")
|
|
1609
|
-
return !1;
|
|
1610
|
-
["tableCell", "tableHeader"].includes(i.type.name) && (r += 1);
|
|
1611
|
-
}), r === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1612
|
-
}, Ar = "";
|
|
1613
|
-
function Ir(t) {
|
|
1614
|
-
return (t || "").replace(/\s+/g, " ").trim();
|
|
1615
|
-
}
|
|
1616
|
-
function Sr(t, e, r = {}) {
|
|
1617
|
-
var n;
|
|
1618
|
-
const s = (n = r.cellLineSeparator) != null ? n : Ar;
|
|
1619
|
-
if (!t || !t.content || t.content.length === 0)
|
|
1620
|
-
return "";
|
|
1621
|
-
const i = [];
|
|
1622
|
-
t.content.forEach((f) => {
|
|
1623
|
-
const b = [];
|
|
1624
|
-
f.content && f.content.forEach((g) => {
|
|
1625
|
-
let T = "";
|
|
1626
|
-
g.content && Array.isArray(g.content) && g.content.length > 1 ? T = g.content.map((O) => e.renderChildren(O)).join(s) : T = g.content ? e.renderChildren(g.content) : "";
|
|
1627
|
-
const v = Ir(T), I = g.type === "tableHeader";
|
|
1628
|
-
b.push({ text: v, isHeader: I });
|
|
1629
|
-
}), i.push(b);
|
|
1630
|
-
});
|
|
1631
|
-
const a = i.reduce((f, b) => Math.max(f, b.length), 0);
|
|
1632
|
-
if (a === 0)
|
|
1633
|
-
return "";
|
|
1634
|
-
const o = new Array(a).fill(0);
|
|
1635
|
-
i.forEach((f) => {
|
|
1636
|
-
var b;
|
|
1637
|
-
for (let g = 0; g < a; g += 1) {
|
|
1638
|
-
const v = (((b = f[g]) == null ? void 0 : b.text) || "").length;
|
|
1639
|
-
v > o[g] && (o[g] = v), o[g] < 3 && (o[g] = 3);
|
|
1640
|
-
}
|
|
1641
|
-
});
|
|
1642
|
-
const c = (f, b) => f + " ".repeat(Math.max(0, b - f.length)), l = i[0], d = l.some((f) => f.isHeader);
|
|
1643
|
-
let u = `
|
|
1644
|
-
`;
|
|
1645
|
-
const h = new Array(a).fill(0).map((f, b) => d && l[b] && l[b].text || "");
|
|
1646
|
-
return u += `| ${h.map((f, b) => c(f, o[b])).join(" | ")} |
|
|
1647
|
-
`, u += `| ${o.map((f) => "-".repeat(Math.max(3, f))).join(" | ")} |
|
|
1648
|
-
`, (d ? i.slice(1) : i).forEach((f) => {
|
|
1649
|
-
u += `| ${new Array(a).fill(0).map((b, g) => c(f[g] && f[g].text || "", o[g])).join(" | ")} |
|
|
1650
|
-
`;
|
|
1651
|
-
}), u;
|
|
1652
|
-
}
|
|
1653
|
-
var Hr = Sr, Er = L.create({
|
|
1654
|
-
name: "table",
|
|
1655
|
-
// @ts-ignore
|
|
1656
|
-
addOptions() {
|
|
1657
|
-
return {
|
|
1658
|
-
HTMLAttributes: {},
|
|
1659
|
-
resizable: !1,
|
|
1660
|
-
renderWrapper: !1,
|
|
1661
|
-
handleWidth: 5,
|
|
1662
|
-
cellMinWidth: 25,
|
|
1663
|
-
// TODO: fix
|
|
1664
|
-
View: Lr,
|
|
1665
|
-
lastColumnResizable: !0,
|
|
1666
|
-
allowTableNodeSelection: !1
|
|
1667
|
-
};
|
|
1668
|
-
},
|
|
1669
|
-
content: "tableRow+",
|
|
1670
|
-
tableRole: "table",
|
|
1671
|
-
isolating: !0,
|
|
1672
|
-
group: "block",
|
|
1673
|
-
parseHTML() {
|
|
1674
|
-
return [{ tag: "table" }];
|
|
1675
|
-
},
|
|
1676
|
-
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1677
|
-
const { colgroup: r, tableWidth: n, tableMinWidth: s } = wr(t, this.options.cellMinWidth), i = e.style;
|
|
1678
|
-
function a() {
|
|
1679
|
-
return i || (n ? `width: ${n}` : `min-width: ${s}`);
|
|
1680
|
-
}
|
|
1681
|
-
const o = [
|
|
1682
|
-
"table",
|
|
1683
|
-
k(this.options.HTMLAttributes, e, {
|
|
1684
|
-
style: a()
|
|
1685
|
-
}),
|
|
1686
|
-
r,
|
|
1687
|
-
["tbody", 0]
|
|
1688
|
-
];
|
|
1689
|
-
return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, o] : o;
|
|
1690
|
-
},
|
|
1691
|
-
parseMarkdown: (t, e) => {
|
|
1692
|
-
const r = [];
|
|
1693
|
-
if (t.header) {
|
|
1694
|
-
const n = [];
|
|
1695
|
-
t.header.forEach((s) => {
|
|
1696
|
-
n.push(e.createNode("tableHeader", {}, [{ type: "paragraph", content: e.parseInline(s.tokens) }]));
|
|
1697
|
-
}), r.push(e.createNode("tableRow", {}, n));
|
|
1698
|
-
}
|
|
1699
|
-
return t.rows && t.rows.forEach((n) => {
|
|
1700
|
-
const s = [];
|
|
1701
|
-
n.forEach((i) => {
|
|
1702
|
-
s.push(e.createNode("tableCell", {}, [{ type: "paragraph", content: e.parseInline(i.tokens) }]));
|
|
1703
|
-
}), r.push(e.createNode("tableRow", {}, s));
|
|
1704
|
-
}), e.createNode("table", void 0, r);
|
|
1705
|
-
},
|
|
1706
|
-
renderMarkdown: (t, e) => Hr(t, e),
|
|
1707
|
-
addCommands() {
|
|
1708
|
-
return {
|
|
1709
|
-
insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: r = !0 } = {}) => ({ tr: n, dispatch: s, editor: i }) => {
|
|
1710
|
-
const a = Mr(i.schema, t, e, r);
|
|
1711
|
-
if (s) {
|
|
1712
|
-
const o = n.selection.from + 1;
|
|
1713
|
-
n.replaceSelectionWith(a).scrollIntoView().setSelection(Bt.near(n.doc.resolve(o)));
|
|
1714
|
-
}
|
|
1715
|
-
return !0;
|
|
1716
|
-
},
|
|
1717
|
-
addColumnBefore: () => ({ state: t, dispatch: e }) => he(t, e),
|
|
1718
|
-
addColumnAfter: () => ({ state: t, dispatch: e }) => pe(t, e),
|
|
1719
|
-
deleteColumn: () => ({ state: t, dispatch: e }) => ce(t, e),
|
|
1720
|
-
addRowBefore: () => ({ state: t, dispatch: e }) => de(t, e),
|
|
1721
|
-
addRowAfter: () => ({ state: t, dispatch: e }) => ue(t, e),
|
|
1722
|
-
deleteRow: () => ({ state: t, dispatch: e }) => le(t, e),
|
|
1723
|
-
deleteTable: () => ({ state: t, dispatch: e }) => ae(t, e),
|
|
1724
|
-
mergeCells: () => ({ state: t, dispatch: e }) => G(t, e),
|
|
1725
|
-
splitCell: () => ({ state: t, dispatch: e }) => X(t, e),
|
|
1726
|
-
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => Y("column")(t, e),
|
|
1727
|
-
toggleHeaderRow: () => ({ state: t, dispatch: e }) => Y("row")(t, e),
|
|
1728
|
-
toggleHeaderCell: () => ({ state: t, dispatch: e }) => oe(t, e),
|
|
1729
|
-
mergeOrSplit: () => ({ state: t, dispatch: e }) => G(t, e) ? !0 : X(t, e),
|
|
1730
|
-
setCellAttribute: (t, e) => ({ state: r, dispatch: n }) => ie(t, e)(r, n),
|
|
1731
|
-
goToNextCell: () => ({ state: t, dispatch: e }) => U(1)(t, e),
|
|
1732
|
-
goToPreviousCell: () => ({ state: t, dispatch: e }) => U(-1)(t, e),
|
|
1733
|
-
fixTables: () => ({ state: t, dispatch: e }) => (e && se(t), !0),
|
|
1734
|
-
setCellSelection: (t) => ({ tr: e, dispatch: r }) => {
|
|
1735
|
-
if (r) {
|
|
1736
|
-
const n = pt.create(e.doc, t.anchorCell, t.headCell);
|
|
1737
|
-
e.setSelection(n);
|
|
1738
|
-
}
|
|
1739
|
-
return !0;
|
|
1740
|
-
}
|
|
1741
|
-
};
|
|
1742
|
-
},
|
|
1743
|
-
addKeyboardShortcuts() {
|
|
1744
|
-
return {
|
|
1745
|
-
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
1746
|
-
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
1747
|
-
Backspace: P,
|
|
1748
|
-
"Mod-Backspace": P,
|
|
1749
|
-
Delete: P,
|
|
1750
|
-
"Mod-Delete": P
|
|
1751
|
-
};
|
|
1752
|
-
},
|
|
1753
|
-
addProseMirrorPlugins() {
|
|
1754
|
-
return [
|
|
1755
|
-
...this.options.resizable && this.editor.isEditable ? [
|
|
1756
|
-
re({
|
|
1757
|
-
handleWidth: this.options.handleWidth,
|
|
1758
|
-
cellMinWidth: this.options.cellMinWidth,
|
|
1759
|
-
defaultCellMinWidth: this.options.cellMinWidth,
|
|
1760
|
-
View: this.options.View,
|
|
1761
|
-
lastColumnResizable: this.options.lastColumnResizable
|
|
1762
|
-
})
|
|
1763
|
-
] : [],
|
|
1764
|
-
ne({
|
|
1765
|
-
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
1766
|
-
})
|
|
1767
|
-
];
|
|
1768
|
-
},
|
|
1769
|
-
extendNodeSchema(t) {
|
|
1770
|
-
const e = {
|
|
1771
|
-
name: t.name,
|
|
1772
|
-
options: t.options,
|
|
1773
|
-
storage: t.storage
|
|
1774
|
-
};
|
|
1775
|
-
return {
|
|
1776
|
-
tableRole: dt(ct(t, "tableRole", e))
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
}), $r = C.create({
|
|
1780
|
-
name: "tableKit",
|
|
1781
|
-
addExtensions() {
|
|
1782
|
-
const t = [];
|
|
1783
|
-
return this.options.table !== !1 && t.push(Er.configure(this.options.table)), this.options.tableCell !== !1 && t.push(kr.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(Tr.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(Cr.configure(this.options.tableRow)), t;
|
|
1784
|
-
}
|
|
1785
|
-
});
|
|
1786
|
-
const Nr = ({
|
|
1787
|
-
onHighlighterClick: t,
|
|
1788
|
-
onLinkClick: e,
|
|
1789
|
-
isMobile: r
|
|
1
|
+
import { jsx as t, jsxs as e, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useEditor as H, EditorContext as v, EditorContent as E } from "@tiptap/react";
|
|
3
|
+
import { useState as S, useRef as C, useEffect as h, useImperativeHandle as x } from "react";
|
|
4
|
+
import '../../../assets/components/tiptap-templates/simple/simple-editor.css';import '../../../assets/components/tiptap-node/paragraph-node/paragraph-node.css';import '../../../assets/components/tiptap-node/list-node/list-node.css';import '../../../assets/components/tiptap-node/image-node/image-node.css';import '../../../assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css';import '../../../assets/components/tiptap-node/heading-node/heading-node.css';import '../../../assets/components/tiptap-node/code-block-node/code-block-node.css';import '../../../assets/components/tiptap-node/blockquote-node/blockquote-node.css';import '../../../assets/styles/_variables.css';import '../../../assets/styles/_keyframe-animations.css';/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { Highlight as w } from "../../../node_modules/@tiptap/extension-highlight/dist/index.js";
|
|
7
|
+
import { Image as P } from "../../../node_modules/@tiptap/extension-image/dist/index.js";
|
|
8
|
+
import { TaskList as R, TaskItem as M } from "../../../node_modules/@tiptap/extension-list/dist/index.js";
|
|
9
|
+
import { Subscript as U } from "../../../node_modules/@tiptap/extension-subscript/dist/index.js";
|
|
10
|
+
import { Superscript as z } from "../../../node_modules/@tiptap/extension-superscript/dist/index.js";
|
|
11
|
+
import { TextAlign as N } from "../../../node_modules/@tiptap/extension-text-align/dist/index.js";
|
|
12
|
+
import { Typography as A } from "../../../node_modules/@tiptap/extension-typography/dist/index.js";
|
|
13
|
+
import { Selection as j, Placeholder as F } from "../../../node_modules/@tiptap/extensions/dist/index.js";
|
|
14
|
+
import { StarterKit as V } from "@tiptap/starter-kit";
|
|
15
|
+
/* empty css */
|
|
16
|
+
/* empty css */
|
|
17
|
+
/* empty css */
|
|
18
|
+
import { HorizontalRule as D } from "../../tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js";
|
|
19
|
+
/* empty css */
|
|
20
|
+
/* empty css */
|
|
21
|
+
import { ImageUploadNode as K } from "../../tiptap-node/image-upload-node/image-upload-node-extension.js";
|
|
22
|
+
/* empty css */
|
|
23
|
+
/* empty css */
|
|
24
|
+
import { ArrowLeftIcon as O } from "../../tiptap-icons/arrow-left-icon.js";
|
|
25
|
+
import { HighlighterIcon as _ } from "../../tiptap-icons/highlighter-icon.js";
|
|
26
|
+
import { LinkIcon as q } from "../../tiptap-icons/link-icon.js";
|
|
27
|
+
import { useCursorVisibility as G } from "../../../hooks/use-cursor-visibility.js";
|
|
28
|
+
import { useIsMobile as W } from "../../../hooks/use-mobile.js";
|
|
29
|
+
import { useWindowSize as X } from "../../../hooks/use-window-size.js";
|
|
30
|
+
import { handleImageUpload as Z, MAX_FILE_SIZE as $ } from "../../../lib/tiptap-utils.js";
|
|
31
|
+
/* empty css */
|
|
32
|
+
import { InsertTableButton as J } from "../../tiptap-ui/insert-table-button/insert-table-button.js";
|
|
33
|
+
import Q from "../../tiptap-ui/table-actions-toolbar/table-actions-toolbar.js";
|
|
34
|
+
import { useTiptapEditor as Y } from "../../../hooks/use-tiptap-editor.js";
|
|
35
|
+
import { TableKit as tt } from "../../../node_modules/@tiptap/extension-table/dist/index.js";
|
|
36
|
+
import { Toolbar as ot, ToolbarGroup as m, ToolbarSeparator as a } from "../../tiptap-ui-primitive/toolbar/toolbar.js";
|
|
37
|
+
import { UndoRedoButton as T } from "../../tiptap-ui/undo-redo-button/undo-redo-button.js";
|
|
38
|
+
import { HeadingDropdownMenu as rt } from "../../tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js";
|
|
39
|
+
import { ListDropdownMenu as et } from "../../tiptap-ui/list-dropdown-menu/list-dropdown-menu.js";
|
|
40
|
+
import { BlockquoteButton as it } from "../../tiptap-ui/blockquote-button/blockquote-button.js";
|
|
41
|
+
import { CodeBlockButton as nt } from "../../tiptap-ui/code-block-button/code-block-button.js";
|
|
42
|
+
import { MarkButton as l } from "../../tiptap-ui/mark-button/mark-button.js";
|
|
43
|
+
import { ColorHighlightPopover as lt, ColorHighlightPopoverButton as mt, ColorHighlightPopoverContent as at } from "../../tiptap-ui/color-highlight-popover/color-highlight-popover.js";
|
|
44
|
+
import { LinkPopover as pt, LinkButton as ct, LinkContent as st } from "../../tiptap-ui/link-popover/link-popover.js";
|
|
45
|
+
import { TextAlignButton as d } from "../../tiptap-ui/text-align-button/text-align-button.js";
|
|
46
|
+
import { Button as ut } from "../../tiptap-ui-primitive/button/button.js";
|
|
47
|
+
const ft = ({
|
|
48
|
+
onHighlighterClick: n,
|
|
49
|
+
onLinkClick: r,
|
|
50
|
+
isMobile: i
|
|
1790
51
|
}) => {
|
|
1791
|
-
const { editor:
|
|
1792
|
-
return /* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
/* @__PURE__ */
|
|
52
|
+
const { editor: p } = Y();
|
|
53
|
+
return /* @__PURE__ */ e(y, { children: [
|
|
54
|
+
/* @__PURE__ */ e(m, { children: [
|
|
55
|
+
/* @__PURE__ */ t(T, { action: "undo" }),
|
|
56
|
+
/* @__PURE__ */ t(T, { action: "redo" })
|
|
1796
57
|
] }),
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
|
|
58
|
+
/* @__PURE__ */ t(a, {}),
|
|
59
|
+
/* @__PURE__ */ e(m, { children: [
|
|
60
|
+
/* @__PURE__ */ t(rt, { levels: [1, 2, 3, 4], portal: i }),
|
|
61
|
+
/* @__PURE__ */ t(
|
|
62
|
+
et,
|
|
1802
63
|
{
|
|
1803
64
|
types: ["bulletList", "orderedList", "taskList"],
|
|
1804
|
-
portal:
|
|
65
|
+
portal: i
|
|
1805
66
|
}
|
|
1806
67
|
),
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ t(it, {}),
|
|
69
|
+
/* @__PURE__ */ t(nt, {})
|
|
1809
70
|
] }),
|
|
1810
|
-
/* @__PURE__ */
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
|
|
1818
|
-
|
|
71
|
+
/* @__PURE__ */ t(a, {}),
|
|
72
|
+
/* @__PURE__ */ e(m, { children: [
|
|
73
|
+
/* @__PURE__ */ t(l, { type: "bold" }),
|
|
74
|
+
/* @__PURE__ */ t(l, { type: "italic" }),
|
|
75
|
+
/* @__PURE__ */ t(l, { type: "strike" }),
|
|
76
|
+
/* @__PURE__ */ t(l, { type: "code" }),
|
|
77
|
+
/* @__PURE__ */ t(l, { type: "underline" }),
|
|
78
|
+
i ? /* @__PURE__ */ t(mt, { onClick: n }) : /* @__PURE__ */ t(lt, {}),
|
|
79
|
+
i ? /* @__PURE__ */ t(ct, { onClick: r }) : /* @__PURE__ */ t(pt, {})
|
|
1819
80
|
] }),
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ t(a, {}),
|
|
82
|
+
/* @__PURE__ */ e(m, { children: [
|
|
83
|
+
/* @__PURE__ */ t(l, { type: "superscript" }),
|
|
84
|
+
/* @__PURE__ */ t(l, { type: "subscript" })
|
|
1824
85
|
] }),
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ t(a, {}),
|
|
87
|
+
/* @__PURE__ */ e(m, { children: [
|
|
88
|
+
/* @__PURE__ */ t(d, { align: "left" }),
|
|
89
|
+
/* @__PURE__ */ t(d, { align: "center" }),
|
|
90
|
+
/* @__PURE__ */ t(d, { align: "right" }),
|
|
91
|
+
/* @__PURE__ */ t(d, { align: "justify" })
|
|
1831
92
|
] }),
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
-
|
|
93
|
+
/* @__PURE__ */ t(a, {}),
|
|
94
|
+
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(J, { onClick: () => {
|
|
95
|
+
p && p.chain().focus().insertTable({ rows: 3, cols: 3 }).run();
|
|
1835
96
|
} }) }),
|
|
1836
|
-
|
|
97
|
+
i && /* @__PURE__ */ t(a, {})
|
|
1837
98
|
] });
|
|
1838
|
-
},
|
|
1839
|
-
type:
|
|
1840
|
-
onBack:
|
|
1841
|
-
}) => /* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
|
|
99
|
+
}, dt = ({
|
|
100
|
+
type: n,
|
|
101
|
+
onBack: r
|
|
102
|
+
}) => /* @__PURE__ */ e(y, { children: [
|
|
103
|
+
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ e(ut, { "data-style": "ghost", onClick: r, children: [
|
|
104
|
+
/* @__PURE__ */ t(O, { className: "tiptap-button-icon" }),
|
|
105
|
+
n === "highlighter" ? /* @__PURE__ */ t(_, { className: "tiptap-button-icon" }) : /* @__PURE__ */ t(q, { className: "tiptap-button-icon" })
|
|
1845
106
|
] }) }),
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
|
|
107
|
+
/* @__PURE__ */ t(a, {}),
|
|
108
|
+
n === "highlighter" ? /* @__PURE__ */ t(at, {}) : /* @__PURE__ */ t(st, {})
|
|
1848
109
|
] });
|
|
1849
|
-
function
|
|
1850
|
-
themeMode:
|
|
1851
|
-
content:
|
|
1852
|
-
onContentChange:
|
|
1853
|
-
placeholder:
|
|
1854
|
-
ref:
|
|
110
|
+
function mo({
|
|
111
|
+
themeMode: n,
|
|
112
|
+
content: r,
|
|
113
|
+
onContentChange: i,
|
|
114
|
+
placeholder: p = "",
|
|
115
|
+
ref: b
|
|
1855
116
|
}) {
|
|
1856
|
-
const
|
|
117
|
+
const c = W(), { height: L } = X(), [s, u] = S(
|
|
1857
118
|
"main"
|
|
1858
|
-
),
|
|
119
|
+
), k = C(null), g = C(!1), o = H({
|
|
1859
120
|
immediatelyRender: !0,
|
|
1860
121
|
shouldRerenderOnTransaction: !1,
|
|
1861
122
|
editorProps: {
|
|
@@ -1868,93 +129,93 @@ function gn({
|
|
|
1868
129
|
}
|
|
1869
130
|
},
|
|
1870
131
|
extensions: [
|
|
1871
|
-
|
|
132
|
+
V.configure({
|
|
1872
133
|
horizontalRule: !1,
|
|
1873
134
|
link: {
|
|
1874
135
|
openOnClick: !1,
|
|
1875
136
|
enableClickSelection: !0
|
|
1876
137
|
}
|
|
1877
138
|
}),
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
139
|
+
D,
|
|
140
|
+
N.configure({ types: ["heading", "paragraph"] }),
|
|
141
|
+
R,
|
|
142
|
+
M.configure({ nested: !0 }),
|
|
143
|
+
w.configure({ multicolor: !0 }),
|
|
144
|
+
P,
|
|
145
|
+
A,
|
|
146
|
+
z,
|
|
147
|
+
U,
|
|
148
|
+
j,
|
|
149
|
+
K.configure({
|
|
1889
150
|
accept: "image/*",
|
|
1890
|
-
maxSize:
|
|
151
|
+
maxSize: $,
|
|
1891
152
|
limit: 3,
|
|
1892
|
-
upload:
|
|
1893
|
-
onError: (
|
|
153
|
+
upload: Z,
|
|
154
|
+
onError: (f) => console.error("Upload failed:", f)
|
|
1894
155
|
}),
|
|
1895
|
-
|
|
156
|
+
tt.configure({
|
|
1896
157
|
table: {
|
|
1897
158
|
resizable: !0
|
|
1898
159
|
}
|
|
1899
160
|
}),
|
|
1900
|
-
|
|
1901
|
-
placeholder:
|
|
161
|
+
F.configure({
|
|
162
|
+
placeholder: p
|
|
1902
163
|
})
|
|
1903
164
|
],
|
|
1904
|
-
content:
|
|
1905
|
-
onUpdate: ({ editor:
|
|
1906
|
-
if (!
|
|
1907
|
-
const
|
|
1908
|
-
|
|
165
|
+
content: r,
|
|
166
|
+
onUpdate: ({ editor: f }) => {
|
|
167
|
+
if (!g.current && i) {
|
|
168
|
+
const B = f.getHTML();
|
|
169
|
+
i(B);
|
|
1909
170
|
}
|
|
1910
171
|
}
|
|
1911
|
-
}),
|
|
1912
|
-
editor:
|
|
1913
|
-
overlayHeight:
|
|
172
|
+
}), I = G({
|
|
173
|
+
editor: o,
|
|
174
|
+
overlayHeight: k.current?.getBoundingClientRect().height ?? 0
|
|
1914
175
|
});
|
|
1915
|
-
return
|
|
1916
|
-
!
|
|
1917
|
-
}, [
|
|
1918
|
-
|
|
1919
|
-
}, [
|
|
1920
|
-
document.documentElement.classList.toggle("dark",
|
|
1921
|
-
}, [
|
|
1922
|
-
|
|
176
|
+
return h(() => {
|
|
177
|
+
!c && s !== "main" && u("main");
|
|
178
|
+
}, [c, s]), h(() => {
|
|
179
|
+
o && r !== void 0 && o.getHTML() !== r && (g.current = !0, o.commands.setContent(r, { emitUpdate: !1 }), g.current = !1);
|
|
180
|
+
}, [r, o]), h(() => {
|
|
181
|
+
document.documentElement.classList.toggle("dark", n === "dark");
|
|
182
|
+
}, [n]), x(
|
|
183
|
+
b,
|
|
1923
184
|
() => ({
|
|
1924
|
-
getEditor: () =>
|
|
185
|
+
getEditor: () => o
|
|
1925
186
|
}),
|
|
1926
|
-
[
|
|
1927
|
-
),
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
|
|
187
|
+
[o]
|
|
188
|
+
), o ? /* @__PURE__ */ t("div", { className: "simple-editor-wrapper", children: /* @__PURE__ */ e(v.Provider, { value: { editor: o }, children: [
|
|
189
|
+
/* @__PURE__ */ t(
|
|
190
|
+
ot,
|
|
1930
191
|
{
|
|
1931
|
-
ref:
|
|
192
|
+
ref: k,
|
|
1932
193
|
style: {
|
|
1933
|
-
...
|
|
1934
|
-
bottom: `calc(100% - ${
|
|
194
|
+
...c ? {
|
|
195
|
+
bottom: `calc(100% - ${L - I.y}px)`
|
|
1935
196
|
} : {}
|
|
1936
197
|
},
|
|
1937
|
-
children:
|
|
1938
|
-
|
|
198
|
+
children: s === "main" ? /* @__PURE__ */ t(
|
|
199
|
+
ft,
|
|
1939
200
|
{
|
|
1940
|
-
onHighlighterClick: () =>
|
|
1941
|
-
onLinkClick: () =>
|
|
1942
|
-
isMobile:
|
|
201
|
+
onHighlighterClick: () => u("highlighter"),
|
|
202
|
+
onLinkClick: () => u("link"),
|
|
203
|
+
isMobile: c
|
|
1943
204
|
}
|
|
1944
|
-
) : /* @__PURE__ */
|
|
1945
|
-
|
|
205
|
+
) : /* @__PURE__ */ t(
|
|
206
|
+
dt,
|
|
1946
207
|
{
|
|
1947
|
-
type:
|
|
1948
|
-
onBack: () =>
|
|
208
|
+
type: s === "highlighter" ? "highlighter" : "link",
|
|
209
|
+
onBack: () => u("main")
|
|
1949
210
|
}
|
|
1950
211
|
)
|
|
1951
212
|
}
|
|
1952
213
|
),
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
|
|
214
|
+
/* @__PURE__ */ t(Q, {}),
|
|
215
|
+
/* @__PURE__ */ t(
|
|
216
|
+
E,
|
|
1956
217
|
{
|
|
1957
|
-
editor:
|
|
218
|
+
editor: o,
|
|
1958
219
|
role: "presentation",
|
|
1959
220
|
className: "simple-editor-content"
|
|
1960
221
|
}
|
|
@@ -1962,5 +223,5 @@ function gn({
|
|
|
1962
223
|
] }) }) : null;
|
|
1963
224
|
}
|
|
1964
225
|
export {
|
|
1965
|
-
|
|
226
|
+
mo as SimpleEditor
|
|
1966
227
|
};
|