lexical-medium-editor 1.2.19 → 1.2.20
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-lib/index.es.js +747 -726
- package/dist-lib/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.es.js
CHANGED
|
@@ -1,219 +1,219 @@
|
|
|
1
1
|
import './lexical-medium-editor.css';
|
|
2
|
-
import { jsxs as D, Fragment as
|
|
3
|
-
import { AutoFocusPlugin as
|
|
2
|
+
import { jsxs as D, Fragment as rt, jsx as h } from "react/jsx-runtime";
|
|
3
|
+
import { AutoFocusPlugin as Nt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
4
4
|
import { LexicalComposer as xt } from "@lexical/react/LexicalComposer";
|
|
5
5
|
import { RichTextPlugin as Tt } from "@lexical/react/LexicalRichTextPlugin";
|
|
6
6
|
import { HistoryPlugin as At } from "@lexical/react/LexicalHistoryPlugin";
|
|
7
|
-
import { LexicalErrorBoundary as
|
|
7
|
+
import { LexicalErrorBoundary as Lt } from "@lexical/react/LexicalErrorBoundary";
|
|
8
8
|
import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
|
|
9
|
-
import { createCommand as Z, $getSelection as
|
|
10
|
-
import { useEffect as b, useState as O, useRef as ee, useLayoutEffect as Dt, useCallback as
|
|
11
|
-
import { createPortal as
|
|
9
|
+
import { createCommand as Z, $getSelection as $, $isRangeSelection as k, $createParagraphNode as Ce, COMMAND_PRIORITY_HIGH as F, $getRoot as me, CLICK_COMMAND as St, COMMAND_PRIORITY_LOW as ke, TextNode as se, $isParagraphNode as J, $getCharacterOffsets as $t, FORMAT_TEXT_COMMAND as Ae, SELECTION_CHANGE_COMMAND as Y, BLUR_COMMAND as ae, $getNodeByKey as j, $isLineBreakNode as ie, $getPreviousSelection as ye, KEY_BACKSPACE_COMMAND as Oe, $isNodeSelection as pe, $setSelection as Pe, PASTE_COMMAND as _e, KEY_ARROW_RIGHT_COMMAND as Ft, $getAdjacentNode as we, $createTextNode as kt, COMMAND_PRIORITY_NORMAL as wt, KEY_ENTER_COMMAND as It, $isTextNode as Mt, ParagraphNode as Ot, $createLineBreakNode as Pt, KEY_TAB_COMMAND as _t } from "lexical";
|
|
10
|
+
import { useEffect as b, useState as O, useRef as ee, useLayoutEffect as Dt, useCallback as ge } from "react";
|
|
11
|
+
import { createPortal as De } from "react-dom";
|
|
12
12
|
import { $findMatchingParent as I, $dfs as Bt } from "@lexical/utils";
|
|
13
|
-
import { Toolbar as
|
|
13
|
+
import { Toolbar as Be, TextField as Ht, Input as it, Group as oe, Button as q, ToggleButton as ne, Separator as Ke, ComboBox as Rt, Popover as ot, ListBox as zt, ListBoxItem as Gt, DialogTrigger as Wt, FileTrigger as Kt } from "react-aria-components";
|
|
14
14
|
import { IconCheck as Ut, IconX as qt, IconBold as jt, IconItalic as Yt, IconCode as Zt, IconTextSize as Qt, IconBlockquote as Xt, IconLink as Vt, IconCaretDownFilled as Jt, IconPlus as en, IconPhoto as tn, IconCodePlus as nn, IconLineDashed as rn } from "@tabler/icons-react";
|
|
15
|
-
import { $isAtNodeEnd as
|
|
16
|
-
import { $createHeadingNode as at, HeadingNode as sn, $createQuoteNode as an, $isHeadingNode as
|
|
15
|
+
import { $isAtNodeEnd as Ue, $setBlocksType as st, createDOMRange as on } from "@lexical/selection";
|
|
16
|
+
import { $createHeadingNode as at, HeadingNode as sn, $createQuoteNode as an, $isHeadingNode as Ie, $isQuoteNode as ln } from "@lexical/rich-text";
|
|
17
17
|
import { $toggleLink as cn, $isLinkNode as un } from "@lexical/link";
|
|
18
|
-
import { $isListNode as dn, $isListItemNode as
|
|
19
|
-
import { $ as V, a as X, b as W, H as gn, c as fn, I as
|
|
20
|
-
import { $isCodeNode as
|
|
21
|
-
import { NodeEventPlugin as
|
|
18
|
+
import { $isListNode as dn, $isListItemNode as qe, $insertList as je } from "@lexical/list";
|
|
19
|
+
import { $ as V, a as X, b as W, H as gn, c as fn, I as Ye, d as fe, e as hn, f as re, M as be, g as mn, h as Le, i as U, j as pn, k as Se } from "./ImageNode-Cqkp_4Y6.js";
|
|
20
|
+
import { $isCodeNode as ve, getCodeLanguages as bn, getLanguageFriendlyName as $e, registerCodeHighlighting as vn, $createCodeNode as Ze } from "@lexical/code";
|
|
21
|
+
import { NodeEventPlugin as He } from "@lexical/react/LexicalNodeEventPlugin";
|
|
22
22
|
import { ListPlugin as Cn } from "@lexical/react/LexicalListPlugin";
|
|
23
23
|
import { OnChangePlugin as yn } from "@lexical/react/LexicalOnChangePlugin";
|
|
24
|
-
import { ContentEditable as
|
|
25
|
-
import { ClearEditorPlugin as
|
|
24
|
+
import { ContentEditable as En } from "@lexical/react/LexicalContentEditable";
|
|
25
|
+
import { ClearEditorPlugin as Nn } from "@lexical/react/LexicalClearEditorPlugin";
|
|
26
26
|
const B = -1e3;
|
|
27
|
-
function xn(
|
|
28
|
-
if (!
|
|
27
|
+
function xn(n, s, e = 0) {
|
|
28
|
+
if (!s || !s.current)
|
|
29
29
|
return console.error("Invalid popover reference"), {
|
|
30
30
|
x: B,
|
|
31
31
|
y: B
|
|
32
32
|
};
|
|
33
|
-
const
|
|
33
|
+
const t = s.current, { x: o, y: i } = n, { width: r, height: a } = t.getBoundingClientRect(), u = o - r / 2, m = i - a - e;
|
|
34
34
|
return {
|
|
35
35
|
x: u,
|
|
36
36
|
y: m
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function Tn(
|
|
40
|
-
if (!
|
|
39
|
+
function Tn(n) {
|
|
40
|
+
if (!n || typeof n.getBoundingClientRect != "function")
|
|
41
41
|
return console.error("Invalid DOM range"), null;
|
|
42
|
-
const
|
|
42
|
+
const s = n.getBoundingClientRect(), e = s.left + s.width / 2, t = s.top + window.scrollY;
|
|
43
43
|
return {
|
|
44
44
|
x: e,
|
|
45
|
-
y:
|
|
45
|
+
y: t
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function An(
|
|
49
|
-
if (!
|
|
48
|
+
function An(n, s, e = 0) {
|
|
49
|
+
if (!s || !s.current)
|
|
50
50
|
return console.error("Invalid popover reference"), {
|
|
51
51
|
x: B,
|
|
52
52
|
y: B
|
|
53
53
|
};
|
|
54
|
-
const { x:
|
|
54
|
+
const { x: t, y: o } = n, i = s.current, { width: r, height: a } = i.getBoundingClientRect(), u = t - r - e, m = o - a / 2;
|
|
55
55
|
return {
|
|
56
56
|
x: u,
|
|
57
57
|
y: m
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
if (!
|
|
60
|
+
function Ln(n, s, e = 16, t = 12) {
|
|
61
|
+
if (!s || !s.current)
|
|
62
62
|
return console.error("Invalid popover reference"), {
|
|
63
63
|
x: B,
|
|
64
64
|
y: B
|
|
65
65
|
};
|
|
66
|
-
const o =
|
|
66
|
+
const o = s.current, { x: i, y: r } = n, { width: a } = o.getBoundingClientRect(), u = i - a - e, m = r + t;
|
|
67
67
|
return {
|
|
68
68
|
x: u,
|
|
69
69
|
y: m
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
const lt = Z("TOGGLE_HEADING_COMMAND"), ct = Z("TOGGLE_QUOTE_COMMAND"), ut = Z("TOGGLE_LINK_COMMAND");
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
return
|
|
73
|
+
function Ee(n) {
|
|
74
|
+
const s = n.anchor, e = n.focus, t = n.anchor.getNode(), o = n.focus.getNode();
|
|
75
|
+
return t === o ? t : n.isBackward() ? Ue(e) ? t : o : Ue(s) ? t : o;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
const
|
|
79
|
-
return
|
|
77
|
+
function Qe(n) {
|
|
78
|
+
const s = I(n, Ie);
|
|
79
|
+
return s ? s.getTag() : null;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
81
|
+
function Sn(n) {
|
|
82
|
+
const s = {
|
|
83
83
|
isHeadingOne: !1,
|
|
84
84
|
isHeadingTwo: !1,
|
|
85
85
|
isHeadingThree: !1
|
|
86
|
-
}, e =
|
|
87
|
-
if (!e.length) return
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
86
|
+
}, e = n.getNodes();
|
|
87
|
+
if (!e.length) return s;
|
|
88
|
+
const t = Qe(e[0]);
|
|
89
|
+
if (!t) return s;
|
|
90
90
|
if (e.every(
|
|
91
|
-
(
|
|
91
|
+
(i) => Qe(i) === t
|
|
92
92
|
)) {
|
|
93
|
-
const
|
|
93
|
+
const i = {
|
|
94
94
|
h1: "isHeadingOne",
|
|
95
95
|
h2: "isHeadingTwo",
|
|
96
96
|
h3: "isHeadingThree"
|
|
97
|
-
}[
|
|
98
|
-
|
|
97
|
+
}[t];
|
|
98
|
+
i && (s[i] = !0);
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return s;
|
|
101
101
|
}
|
|
102
102
|
function $n() {
|
|
103
|
-
const [
|
|
104
|
-
return b(() =>
|
|
103
|
+
const [n] = M();
|
|
104
|
+
return b(() => n.registerCommand(
|
|
105
105
|
lt,
|
|
106
106
|
(e) => {
|
|
107
|
-
const { isHeadingOne:
|
|
108
|
-
if (k(
|
|
109
|
-
let
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
() =>
|
|
107
|
+
const { isHeadingOne: t, isHeadingTwo: o, isHeadingThree: i } = e, r = $();
|
|
108
|
+
if (k(r)) {
|
|
109
|
+
let a;
|
|
110
|
+
t || o ? a = "h3" : i ? a = null : a = "h2", st(
|
|
111
|
+
r,
|
|
112
|
+
() => a ? at(a) : Ce()
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
return !0;
|
|
116
116
|
},
|
|
117
|
-
|
|
118
|
-
), [
|
|
117
|
+
F
|
|
118
|
+
), [n]), null;
|
|
119
119
|
}
|
|
120
120
|
function Fn() {
|
|
121
|
-
const [
|
|
121
|
+
const [n] = M();
|
|
122
122
|
return b(() => {
|
|
123
|
-
const
|
|
123
|
+
const s = n.registerNodeTransform(
|
|
124
124
|
sn,
|
|
125
125
|
(e) => {
|
|
126
126
|
if (e.getTag() !== "h2")
|
|
127
127
|
return;
|
|
128
|
-
const o =
|
|
128
|
+
const o = me().getFirstChild();
|
|
129
129
|
if (o !== null && e.is(o)) {
|
|
130
|
-
const
|
|
131
|
-
|
|
130
|
+
const i = e.getChildren(), r = at("h1");
|
|
131
|
+
r.append(...i), e.replace(r);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
135
|
return () => {
|
|
136
|
-
|
|
136
|
+
s();
|
|
137
137
|
};
|
|
138
|
-
}, [
|
|
138
|
+
}, [n]), null;
|
|
139
139
|
}
|
|
140
|
-
function kn(
|
|
141
|
-
return I(
|
|
140
|
+
function kn(n) {
|
|
141
|
+
return I(n, ln);
|
|
142
142
|
}
|
|
143
|
-
function wn(
|
|
144
|
-
const
|
|
145
|
-
return
|
|
143
|
+
function wn(n) {
|
|
144
|
+
const s = n.getNodes();
|
|
145
|
+
return s.length ? s.length > 0 && s.every((e) => kn(e)) : !1;
|
|
146
146
|
}
|
|
147
147
|
function In() {
|
|
148
|
-
const [
|
|
149
|
-
return b(() =>
|
|
148
|
+
const [n] = M();
|
|
149
|
+
return b(() => n.registerCommand(
|
|
150
150
|
ct,
|
|
151
151
|
(e) => {
|
|
152
|
-
const
|
|
153
|
-
return k(
|
|
154
|
-
|
|
155
|
-
() => e.isQuote ?
|
|
152
|
+
const t = $();
|
|
153
|
+
return k(t) && st(
|
|
154
|
+
t,
|
|
155
|
+
() => e.isQuote ? Ce() : an()
|
|
156
156
|
), !0;
|
|
157
157
|
},
|
|
158
|
-
|
|
159
|
-
), [
|
|
158
|
+
F
|
|
159
|
+
), [n]), null;
|
|
160
160
|
}
|
|
161
|
-
function dt(
|
|
162
|
-
if (!k(
|
|
161
|
+
function dt(n) {
|
|
162
|
+
if (!k(n))
|
|
163
163
|
return null;
|
|
164
|
-
const
|
|
165
|
-
return I(
|
|
164
|
+
const s = Ee(n);
|
|
165
|
+
return I(s, un);
|
|
166
166
|
}
|
|
167
167
|
function Mn() {
|
|
168
|
-
const [
|
|
169
|
-
return b(() =>
|
|
170
|
-
|
|
168
|
+
const [n] = M();
|
|
169
|
+
return b(() => n.registerCommand(
|
|
170
|
+
St,
|
|
171
171
|
(e) => {
|
|
172
|
-
const
|
|
172
|
+
const t = $(), o = dt(t);
|
|
173
173
|
return o && (e.metaKey || e.ctrlKey) ? (window.open(o.getURL(), "_blank"), !0) : !1;
|
|
174
174
|
},
|
|
175
|
-
|
|
176
|
-
), [
|
|
175
|
+
ke
|
|
176
|
+
), [n]), b(() => n.registerCommand(
|
|
177
177
|
ut,
|
|
178
178
|
(e) => (cn(e), !0),
|
|
179
|
-
|
|
180
|
-
), [
|
|
179
|
+
F
|
|
180
|
+
), [n]), null;
|
|
181
181
|
}
|
|
182
182
|
function On() {
|
|
183
|
-
const [
|
|
184
|
-
return b(() =>
|
|
183
|
+
const [n] = M(), s = "heading-above";
|
|
184
|
+
return b(() => n.registerNodeTransform(
|
|
185
185
|
se,
|
|
186
|
-
(
|
|
187
|
-
const o = I(
|
|
188
|
-
if (!o ||
|
|
186
|
+
(t) => {
|
|
187
|
+
const o = I(t, J) || I(t, dn);
|
|
188
|
+
if (!o || Ie(o))
|
|
189
189
|
return;
|
|
190
|
-
const
|
|
191
|
-
if (!
|
|
190
|
+
const i = o, r = n.getElementByKey(i.getKey());
|
|
191
|
+
if (!r)
|
|
192
192
|
return;
|
|
193
|
-
const
|
|
194
|
-
u && !m ?
|
|
193
|
+
const a = i.getPreviousSibling(), u = Ie(a), m = r.classList.contains(s);
|
|
194
|
+
u && !m ? r.classList.add(s) : !u && m && r.classList.remove(s);
|
|
195
195
|
}
|
|
196
|
-
), [
|
|
196
|
+
), [n]), null;
|
|
197
197
|
}
|
|
198
|
-
function Pn({ isHeadingOneFirst:
|
|
199
|
-
return /* @__PURE__ */ D(
|
|
198
|
+
function Pn({ isHeadingOneFirst: n }) {
|
|
199
|
+
return /* @__PURE__ */ D(rt, { children: [
|
|
200
200
|
/* @__PURE__ */ h($n, {}),
|
|
201
|
-
|
|
201
|
+
n && /* @__PURE__ */ h(Fn, {}),
|
|
202
202
|
/* @__PURE__ */ h(In, {}),
|
|
203
203
|
/* @__PURE__ */ h(Mn, {}),
|
|
204
204
|
/* @__PURE__ */ h(On, {})
|
|
205
205
|
] });
|
|
206
206
|
}
|
|
207
|
-
function _n({ style:
|
|
208
|
-
const [
|
|
209
|
-
return /* @__PURE__ */ D(
|
|
207
|
+
function _n({ style: n, closeToolbar: s, existingLinkURL: e }) {
|
|
208
|
+
const [t] = M(), [o, i] = O(e);
|
|
209
|
+
return /* @__PURE__ */ D(Be, { style: n, "aria-details": "link toolbar", id: "link-toolbar", children: [
|
|
210
210
|
/* @__PURE__ */ h(
|
|
211
211
|
Ht,
|
|
212
212
|
{
|
|
213
213
|
"aria-label": "url",
|
|
214
214
|
autoFocus: !0,
|
|
215
215
|
defaultValue: o,
|
|
216
|
-
onChange:
|
|
216
|
+
onChange: i,
|
|
217
217
|
children: /* @__PURE__ */ h(it, { placeholder: "Enter Link" })
|
|
218
218
|
}
|
|
219
219
|
),
|
|
@@ -223,23 +223,23 @@ function _n({ style: t, closeToolbar: a, existingLinkURL: e }) {
|
|
|
223
223
|
{
|
|
224
224
|
"aria-label": "Update link",
|
|
225
225
|
onPress: () => {
|
|
226
|
-
const
|
|
227
|
-
|
|
226
|
+
const r = o === "" ? null : o;
|
|
227
|
+
t.dispatchCommand(ut, r), s();
|
|
228
228
|
},
|
|
229
229
|
children: /* @__PURE__ */ h(Ut, { size: K })
|
|
230
230
|
}
|
|
231
231
|
),
|
|
232
|
-
/* @__PURE__ */ h(q, { "aria-label": "Discard changes", onPress:
|
|
232
|
+
/* @__PURE__ */ h(q, { "aria-label": "Discard changes", onPress: s, children: /* @__PURE__ */ h(qt, { size: K }) })
|
|
233
233
|
] }),
|
|
234
234
|
/* @__PURE__ */ h("div", { className: "inline-toolbar-pointer" })
|
|
235
235
|
] });
|
|
236
236
|
}
|
|
237
237
|
const K = 24, Dn = 16;
|
|
238
|
-
function Bn({ editor:
|
|
239
|
-
const [
|
|
238
|
+
function Bn({ editor: n }) {
|
|
239
|
+
const [s, e] = O(null), [t, o] = O({
|
|
240
240
|
x: B,
|
|
241
241
|
y: B
|
|
242
|
-
}),
|
|
242
|
+
}), i = ee(null), [r, a] = O({
|
|
243
243
|
isBold: !1,
|
|
244
244
|
isItalic: !1,
|
|
245
245
|
isCode: !1,
|
|
@@ -247,44 +247,44 @@ function Bn({ editor: t }) {
|
|
|
247
247
|
isHeadingTwo: !1,
|
|
248
248
|
isHeadingThree: !1,
|
|
249
249
|
isQuote: !1
|
|
250
|
-
}), [u, m] = O(!1), [
|
|
250
|
+
}), [u, m] = O(!1), [A, L] = O(0), [S, T] = O(""), E = (p) => {
|
|
251
251
|
if (k(p)) {
|
|
252
|
-
|
|
252
|
+
a({
|
|
253
253
|
isBold: p.hasFormat("bold"),
|
|
254
254
|
isItalic: p.hasFormat("italic"),
|
|
255
255
|
isCode: p.hasFormat("code"),
|
|
256
256
|
isQuote: wn(p)
|
|
257
257
|
});
|
|
258
|
-
const y =
|
|
259
|
-
|
|
258
|
+
const y = Sn(p);
|
|
259
|
+
a((l) => ({
|
|
260
260
|
...l,
|
|
261
261
|
...y
|
|
262
262
|
}));
|
|
263
263
|
const x = dt(p);
|
|
264
|
-
|
|
264
|
+
T(x ? x.getURL() : "");
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
return b(() => {
|
|
268
|
-
|
|
269
|
-
const p =
|
|
270
|
-
|
|
268
|
+
n.read(() => {
|
|
269
|
+
const p = $();
|
|
270
|
+
E(p);
|
|
271
271
|
});
|
|
272
|
-
}, [
|
|
272
|
+
}, [n]), b(() => n.registerUpdateListener(
|
|
273
273
|
({ editorState: y }) => {
|
|
274
274
|
y.read(() => {
|
|
275
|
-
const x =
|
|
276
|
-
|
|
275
|
+
const x = $();
|
|
276
|
+
E(x);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
), [
|
|
280
|
-
|
|
281
|
-
const p =
|
|
279
|
+
), [n]), b(() => {
|
|
280
|
+
n.read(() => {
|
|
281
|
+
const p = $();
|
|
282
282
|
if (k(p)) {
|
|
283
283
|
const [y, x] = p.getStartEndPoints(), [l, c] = [
|
|
284
284
|
y.getNode(),
|
|
285
285
|
x.getNode()
|
|
286
286
|
], [d, g] = $t(p), f = on(
|
|
287
|
-
|
|
287
|
+
n,
|
|
288
288
|
l,
|
|
289
289
|
d,
|
|
290
290
|
c,
|
|
@@ -293,31 +293,31 @@ function Bn({ editor: t }) {
|
|
|
293
293
|
e(Tn(f));
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
-
}, [
|
|
296
|
+
}, [n, r]), b(() => {
|
|
297
297
|
var p;
|
|
298
|
-
|
|
298
|
+
s ? (o(
|
|
299
299
|
xn(
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
s,
|
|
301
|
+
i,
|
|
302
302
|
Dn
|
|
303
303
|
)
|
|
304
304
|
), setTimeout(() => {
|
|
305
305
|
var y;
|
|
306
|
-
(y =
|
|
307
|
-
}, 50)) : (p =
|
|
308
|
-
}, [
|
|
309
|
-
if (
|
|
310
|
-
const p = window.getComputedStyle(
|
|
311
|
-
|
|
306
|
+
(y = i.current) == null || y.classList.add("visible");
|
|
307
|
+
}, 50)) : (p = i.current) == null || p.classList.remove("visible");
|
|
308
|
+
}, [s]), Dt(() => {
|
|
309
|
+
if (i.current) {
|
|
310
|
+
const p = window.getComputedStyle(i.current), y = parseFloat(p.width);
|
|
311
|
+
L(y);
|
|
312
312
|
}
|
|
313
|
-
}, [
|
|
313
|
+
}, [s]), s && (u ? /* @__PURE__ */ h(
|
|
314
314
|
_n,
|
|
315
315
|
{
|
|
316
316
|
style: {
|
|
317
317
|
position: "absolute",
|
|
318
|
-
top:
|
|
319
|
-
left:
|
|
320
|
-
width:
|
|
318
|
+
top: t.y,
|
|
319
|
+
left: t.x,
|
|
320
|
+
width: A
|
|
321
321
|
},
|
|
322
322
|
closeToolbar: () => {
|
|
323
323
|
m(!1), e(null);
|
|
@@ -325,25 +325,25 @@ function Bn({ editor: t }) {
|
|
|
325
325
|
existingLinkURL: S
|
|
326
326
|
}
|
|
327
327
|
) : /* @__PURE__ */ D(
|
|
328
|
-
|
|
328
|
+
Be,
|
|
329
329
|
{
|
|
330
330
|
style: {
|
|
331
331
|
position: "absolute",
|
|
332
|
-
top:
|
|
333
|
-
left:
|
|
332
|
+
top: t.y,
|
|
333
|
+
left: t.x
|
|
334
334
|
},
|
|
335
335
|
"aria-label": "Text formatting",
|
|
336
336
|
id: "inline-toolbar",
|
|
337
|
-
ref:
|
|
337
|
+
ref: i,
|
|
338
338
|
children: [
|
|
339
339
|
/* @__PURE__ */ D(oe, { "aria-label": "Style", children: [
|
|
340
340
|
/* @__PURE__ */ h(
|
|
341
341
|
ne,
|
|
342
342
|
{
|
|
343
343
|
"aria-label": "Bold",
|
|
344
|
-
isSelected:
|
|
345
|
-
isDisabled:
|
|
346
|
-
onChange: () =>
|
|
344
|
+
isSelected: r.isBold,
|
|
345
|
+
isDisabled: r.isCode || r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
|
|
346
|
+
onChange: () => n.dispatchCommand(Ae, "bold"),
|
|
347
347
|
children: /* @__PURE__ */ h(jt, { size: K })
|
|
348
348
|
}
|
|
349
349
|
),
|
|
@@ -351,9 +351,9 @@ function Bn({ editor: t }) {
|
|
|
351
351
|
ne,
|
|
352
352
|
{
|
|
353
353
|
"aria-label": "Italic",
|
|
354
|
-
isSelected:
|
|
355
|
-
isDisabled:
|
|
356
|
-
onChange: () =>
|
|
354
|
+
isSelected: r.isItalic,
|
|
355
|
+
isDisabled: r.isCode || r.isHeadingOne,
|
|
356
|
+
onChange: () => n.dispatchCommand(Ae, "italic"),
|
|
357
357
|
children: /* @__PURE__ */ h(Yt, { size: K })
|
|
358
358
|
}
|
|
359
359
|
),
|
|
@@ -361,21 +361,21 @@ function Bn({ editor: t }) {
|
|
|
361
361
|
ne,
|
|
362
362
|
{
|
|
363
363
|
"aria-label": "inline-code",
|
|
364
|
-
isDisabled:
|
|
365
|
-
isSelected:
|
|
366
|
-
onChange: () =>
|
|
364
|
+
isDisabled: r.isHeadingOne,
|
|
365
|
+
isSelected: r.isCode,
|
|
366
|
+
onChange: () => n.dispatchCommand(Ae, "code"),
|
|
367
367
|
children: /* @__PURE__ */ h(Zt, { size: K })
|
|
368
368
|
}
|
|
369
369
|
)
|
|
370
370
|
] }),
|
|
371
|
-
/* @__PURE__ */ h(
|
|
371
|
+
/* @__PURE__ */ h(Ke, { orientation: "vertical" }),
|
|
372
372
|
/* @__PURE__ */ D(oe, { "aria-label": "Text Blocks", children: [
|
|
373
373
|
/* @__PURE__ */ h(
|
|
374
374
|
ne,
|
|
375
375
|
{
|
|
376
376
|
"aria-label": "Heading",
|
|
377
|
-
isSelected:
|
|
378
|
-
onChange: () =>
|
|
377
|
+
isSelected: r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
|
|
378
|
+
onChange: () => n.dispatchCommand(lt, r),
|
|
379
379
|
children: /* @__PURE__ */ h(Qt, { size: K })
|
|
380
380
|
}
|
|
381
381
|
),
|
|
@@ -383,18 +383,18 @@ function Bn({ editor: t }) {
|
|
|
383
383
|
ne,
|
|
384
384
|
{
|
|
385
385
|
"aria-label": "Quote",
|
|
386
|
-
isSelected:
|
|
387
|
-
onChange: () =>
|
|
386
|
+
isSelected: r.isQuote,
|
|
387
|
+
onChange: () => n.dispatchCommand(ct, r),
|
|
388
388
|
children: /* @__PURE__ */ h(Xt, { size: K })
|
|
389
389
|
}
|
|
390
390
|
)
|
|
391
391
|
] }),
|
|
392
|
-
/* @__PURE__ */ h(
|
|
392
|
+
/* @__PURE__ */ h(Ke, { orientation: "vertical" }),
|
|
393
393
|
/* @__PURE__ */ h(oe, { "aria-label": "Links", children: /* @__PURE__ */ h(
|
|
394
394
|
q,
|
|
395
395
|
{
|
|
396
396
|
onPress: () => m(!0),
|
|
397
|
-
isDisabled:
|
|
397
|
+
isDisabled: r.isHeadingOne,
|
|
398
398
|
children: /* @__PURE__ */ h(Vt, { size: K })
|
|
399
399
|
}
|
|
400
400
|
) }),
|
|
@@ -405,36 +405,40 @@ function Bn({ editor: t }) {
|
|
|
405
405
|
}
|
|
406
406
|
const Hn = document.body;
|
|
407
407
|
function Rn() {
|
|
408
|
-
const [
|
|
409
|
-
return b(() => e.
|
|
408
|
+
const [n, s] = O(!1), [e] = M();
|
|
409
|
+
return b(() => e.registerEditableListener((t) => {
|
|
410
|
+
t || s(!1);
|
|
411
|
+
}), [e]), b(() => e.registerCommand(
|
|
410
412
|
Y,
|
|
411
413
|
() => {
|
|
412
|
-
|
|
414
|
+
if (!e.isEditable())
|
|
415
|
+
return s(!1), !1;
|
|
416
|
+
const o = $();
|
|
413
417
|
if (!k(o) || o.isCollapsed())
|
|
414
|
-
return
|
|
415
|
-
const
|
|
416
|
-
(m) => I(m,
|
|
418
|
+
return s(!1), !1;
|
|
419
|
+
const i = o.getNodes(), r = i.some((m) => V(m)), a = i.length === 1 && (X(i[0]) || I(i[0], W)), u = i.some(
|
|
420
|
+
(m) => I(m, ve)
|
|
417
421
|
);
|
|
418
|
-
return
|
|
422
|
+
return s(!r && !a && !u), !1;
|
|
419
423
|
},
|
|
420
|
-
|
|
424
|
+
F
|
|
421
425
|
), [e]), b(() => e.registerCommand(
|
|
422
|
-
|
|
426
|
+
ae,
|
|
423
427
|
() => (setTimeout(() => {
|
|
424
|
-
const o = document.getElementById("inline-toolbar"),
|
|
425
|
-
o && (o ===
|
|
428
|
+
const o = document.getElementById("inline-toolbar"), i = document.getElementById("link-toolbar"), r = document.activeElement;
|
|
429
|
+
o && (o === r || o.contains(r)) || i && (i === r || i.contains(r)) || s(!1);
|
|
426
430
|
}, 0), !1),
|
|
427
|
-
|
|
428
|
-
), [e]),
|
|
431
|
+
F
|
|
432
|
+
), [e]), n && De(/* @__PURE__ */ h(Bn, { editor: e }), Hn);
|
|
429
433
|
}
|
|
430
|
-
var
|
|
431
|
-
function zn(
|
|
432
|
-
return
|
|
434
|
+
var Xe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
435
|
+
function zn(n) {
|
|
436
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
433
437
|
}
|
|
434
|
-
var
|
|
438
|
+
var Fe = { exports: {} }, Ve;
|
|
435
439
|
function Gn() {
|
|
436
|
-
return
|
|
437
|
-
var
|
|
440
|
+
return Ve || (Ve = 1, function(n) {
|
|
441
|
+
var s = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
438
442
|
/**
|
|
439
443
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
440
444
|
*
|
|
@@ -443,8 +447,8 @@ function Gn() {
|
|
|
443
447
|
* @namespace
|
|
444
448
|
* @public
|
|
445
449
|
*/
|
|
446
|
-
var e = function(
|
|
447
|
-
var o = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,
|
|
450
|
+
var e = function(t) {
|
|
451
|
+
var o = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, i = 0, r = {}, a = {
|
|
448
452
|
/**
|
|
449
453
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
450
454
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -466,7 +470,7 @@ function Gn() {
|
|
|
466
470
|
* @memberof Prism
|
|
467
471
|
* @public
|
|
468
472
|
*/
|
|
469
|
-
manual:
|
|
473
|
+
manual: t.Prism && t.Prism.manual,
|
|
470
474
|
/**
|
|
471
475
|
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
472
476
|
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
@@ -488,7 +492,7 @@ function Gn() {
|
|
|
488
492
|
* @memberof Prism
|
|
489
493
|
* @public
|
|
490
494
|
*/
|
|
491
|
-
disableWorkerMessageHandler:
|
|
495
|
+
disableWorkerMessageHandler: t.Prism && t.Prism.disableWorkerMessageHandler,
|
|
492
496
|
/**
|
|
493
497
|
* A namespace for utility methods.
|
|
494
498
|
*
|
|
@@ -528,7 +532,7 @@ function Gn() {
|
|
|
528
532
|
* @returns {number}
|
|
529
533
|
*/
|
|
530
534
|
objId: function(l) {
|
|
531
|
-
return l.__id || Object.defineProperty(l, "__id", { value: ++
|
|
535
|
+
return l.__id || Object.defineProperty(l, "__id", { value: ++i }), l.__id;
|
|
532
536
|
},
|
|
533
537
|
/**
|
|
534
538
|
* Creates a deep clone of the given object.
|
|
@@ -543,9 +547,9 @@ function Gn() {
|
|
|
543
547
|
clone: function l(c, d) {
|
|
544
548
|
d = d || {};
|
|
545
549
|
var g, f;
|
|
546
|
-
switch (
|
|
550
|
+
switch (a.util.type(c)) {
|
|
547
551
|
case "Object":
|
|
548
|
-
if (f =
|
|
552
|
+
if (f = a.util.objId(c), d[f])
|
|
549
553
|
return d[f];
|
|
550
554
|
g = /** @type {Record<string, any>} */
|
|
551
555
|
{}, d[f] = g;
|
|
@@ -556,10 +560,10 @@ function Gn() {
|
|
|
556
560
|
g
|
|
557
561
|
);
|
|
558
562
|
case "Array":
|
|
559
|
-
return f =
|
|
563
|
+
return f = a.util.objId(c), d[f] ? d[f] : (g = [], d[f] = g, /** @type {Array} */
|
|
560
564
|
/** @type {any} */
|
|
561
|
-
c.forEach(function(
|
|
562
|
-
g[v] = l(
|
|
565
|
+
c.forEach(function(N, v) {
|
|
566
|
+
g[v] = l(N, d);
|
|
563
567
|
}), /** @type {any} */
|
|
564
568
|
g);
|
|
565
569
|
default:
|
|
@@ -663,10 +667,10 @@ function Gn() {
|
|
|
663
667
|
/**
|
|
664
668
|
* The grammar for plain, unformatted text.
|
|
665
669
|
*/
|
|
666
|
-
plain:
|
|
667
|
-
plaintext:
|
|
668
|
-
text:
|
|
669
|
-
txt:
|
|
670
|
+
plain: r,
|
|
671
|
+
plaintext: r,
|
|
672
|
+
text: r,
|
|
673
|
+
txt: r,
|
|
670
674
|
/**
|
|
671
675
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
672
676
|
*
|
|
@@ -696,7 +700,7 @@ function Gn() {
|
|
|
696
700
|
* });
|
|
697
701
|
*/
|
|
698
702
|
extend: function(l, c) {
|
|
699
|
-
var d =
|
|
703
|
+
var d = a.util.clone(a.languages[l]);
|
|
700
704
|
for (var g in c)
|
|
701
705
|
d[g] = c[g];
|
|
702
706
|
return d;
|
|
@@ -778,29 +782,29 @@ function Gn() {
|
|
|
778
782
|
*/
|
|
779
783
|
insertBefore: function(l, c, d, g) {
|
|
780
784
|
g = g || /** @type {any} */
|
|
781
|
-
|
|
785
|
+
a.languages;
|
|
782
786
|
var f = g[l], C = {};
|
|
783
|
-
for (var
|
|
784
|
-
if (f.hasOwnProperty(
|
|
785
|
-
if (
|
|
787
|
+
for (var N in f)
|
|
788
|
+
if (f.hasOwnProperty(N)) {
|
|
789
|
+
if (N == c)
|
|
786
790
|
for (var v in d)
|
|
787
791
|
d.hasOwnProperty(v) && (C[v] = d[v]);
|
|
788
|
-
d.hasOwnProperty(
|
|
792
|
+
d.hasOwnProperty(N) || (C[N] = f[N]);
|
|
789
793
|
}
|
|
790
794
|
var w = g[l];
|
|
791
|
-
return g[l] = C,
|
|
795
|
+
return g[l] = C, a.languages.DFS(a.languages, function(P, z) {
|
|
792
796
|
z === w && P != l && (this[P] = C);
|
|
793
797
|
}), C;
|
|
794
798
|
},
|
|
795
799
|
// Traverse a language definition with Depth First Search
|
|
796
800
|
DFS: function l(c, d, g, f) {
|
|
797
801
|
f = f || {};
|
|
798
|
-
var C =
|
|
799
|
-
for (var
|
|
800
|
-
if (c.hasOwnProperty(
|
|
801
|
-
d.call(c,
|
|
802
|
-
var v = c[
|
|
803
|
-
w === "Object" && !f[C(v)] ? (f[C(v)] = !0, l(v, d, null, f)) : w === "Array" && !f[C(v)] && (f[C(v)] = !0, l(v, d,
|
|
802
|
+
var C = a.util.objId;
|
|
803
|
+
for (var N in c)
|
|
804
|
+
if (c.hasOwnProperty(N)) {
|
|
805
|
+
d.call(c, N, c[N], g || N);
|
|
806
|
+
var v = c[N], w = a.util.type(v);
|
|
807
|
+
w === "Object" && !f[C(v)] ? (f[C(v)] = !0, l(v, d, null, f)) : w === "Array" && !f[C(v)] && (f[C(v)] = !0, l(v, d, N, f));
|
|
804
808
|
}
|
|
805
809
|
}
|
|
806
810
|
},
|
|
@@ -818,7 +822,7 @@ function Gn() {
|
|
|
818
822
|
* @public
|
|
819
823
|
*/
|
|
820
824
|
highlightAll: function(l, c) {
|
|
821
|
-
|
|
825
|
+
a.highlightAllUnder(document, l, c);
|
|
822
826
|
},
|
|
823
827
|
/**
|
|
824
828
|
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
@@ -841,9 +845,9 @@ function Gn() {
|
|
|
841
845
|
container: l,
|
|
842
846
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
843
847
|
};
|
|
844
|
-
|
|
848
|
+
a.hooks.run("before-highlightall", g), g.elements = Array.prototype.slice.apply(g.container.querySelectorAll(g.selector)), a.hooks.run("before-all-elements-highlight", g);
|
|
845
849
|
for (var f = 0, C; C = g.elements[f++]; )
|
|
846
|
-
|
|
850
|
+
a.highlightElement(C, c === !0, g.callback);
|
|
847
851
|
},
|
|
848
852
|
/**
|
|
849
853
|
* Highlights the code inside a single element.
|
|
@@ -874,29 +878,29 @@ function Gn() {
|
|
|
874
878
|
* @public
|
|
875
879
|
*/
|
|
876
880
|
highlightElement: function(l, c, d) {
|
|
877
|
-
var g =
|
|
878
|
-
|
|
881
|
+
var g = a.util.getLanguage(l), f = a.languages[g];
|
|
882
|
+
a.util.setLanguage(l, g);
|
|
879
883
|
var C = l.parentElement;
|
|
880
|
-
C && C.nodeName.toLowerCase() === "pre" &&
|
|
881
|
-
var
|
|
884
|
+
C && C.nodeName.toLowerCase() === "pre" && a.util.setLanguage(C, g);
|
|
885
|
+
var N = l.textContent, v = {
|
|
882
886
|
element: l,
|
|
883
887
|
language: g,
|
|
884
888
|
grammar: f,
|
|
885
|
-
code:
|
|
889
|
+
code: N
|
|
886
890
|
};
|
|
887
891
|
function w(z) {
|
|
888
|
-
v.highlightedCode = z,
|
|
892
|
+
v.highlightedCode = z, a.hooks.run("before-insert", v), v.element.innerHTML = v.highlightedCode, a.hooks.run("after-highlight", v), a.hooks.run("complete", v), d && d.call(v.element);
|
|
889
893
|
}
|
|
890
|
-
if (
|
|
891
|
-
|
|
894
|
+
if (a.hooks.run("before-sanity-check", v), C = v.element.parentElement, C && C.nodeName.toLowerCase() === "pre" && !C.hasAttribute("tabindex") && C.setAttribute("tabindex", "0"), !v.code) {
|
|
895
|
+
a.hooks.run("complete", v), d && d.call(v.element);
|
|
892
896
|
return;
|
|
893
897
|
}
|
|
894
|
-
if (
|
|
895
|
-
w(
|
|
898
|
+
if (a.hooks.run("before-highlight", v), !v.grammar) {
|
|
899
|
+
w(a.util.encode(v.code));
|
|
896
900
|
return;
|
|
897
901
|
}
|
|
898
|
-
if (c &&
|
|
899
|
-
var P = new Worker(
|
|
902
|
+
if (c && t.Worker) {
|
|
903
|
+
var P = new Worker(a.filename);
|
|
900
904
|
P.onmessage = function(z) {
|
|
901
905
|
w(z.data);
|
|
902
906
|
}, P.postMessage(JSON.stringify({
|
|
@@ -905,7 +909,7 @@ function Gn() {
|
|
|
905
909
|
immediateClose: !0
|
|
906
910
|
}));
|
|
907
911
|
} else
|
|
908
|
-
w(
|
|
912
|
+
w(a.highlight(v.code, v.grammar, v.language));
|
|
909
913
|
},
|
|
910
914
|
/**
|
|
911
915
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -933,9 +937,9 @@ function Gn() {
|
|
|
933
937
|
grammar: c,
|
|
934
938
|
language: d
|
|
935
939
|
};
|
|
936
|
-
if (
|
|
940
|
+
if (a.hooks.run("before-tokenize", g), !g.grammar)
|
|
937
941
|
throw new Error('The language "' + g.language + '" has no grammar.');
|
|
938
|
-
return g.tokens =
|
|
942
|
+
return g.tokens = a.tokenize(g.code, g.grammar), a.hooks.run("after-tokenize", g), u.stringify(a.util.encode(g.tokens), g.language);
|
|
939
943
|
},
|
|
940
944
|
/**
|
|
941
945
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -968,8 +972,8 @@ function Gn() {
|
|
|
968
972
|
c[g] = d[g];
|
|
969
973
|
delete c.rest;
|
|
970
974
|
}
|
|
971
|
-
var f = new
|
|
972
|
-
return S(f, f.head, l),
|
|
975
|
+
var f = new L();
|
|
976
|
+
return S(f, f.head, l), A(l, f, c, f.head, 0), E(f);
|
|
973
977
|
},
|
|
974
978
|
/**
|
|
975
979
|
* @namespace
|
|
@@ -991,7 +995,7 @@ function Gn() {
|
|
|
991
995
|
* @public
|
|
992
996
|
*/
|
|
993
997
|
add: function(l, c) {
|
|
994
|
-
var d =
|
|
998
|
+
var d = a.hooks.all;
|
|
995
999
|
d[l] = d[l] || [], d[l].push(c);
|
|
996
1000
|
},
|
|
997
1001
|
/**
|
|
@@ -1004,7 +1008,7 @@ function Gn() {
|
|
|
1004
1008
|
* @public
|
|
1005
1009
|
*/
|
|
1006
1010
|
run: function(l, c) {
|
|
1007
|
-
var d =
|
|
1011
|
+
var d = a.hooks.all[l];
|
|
1008
1012
|
if (!(!d || !d.length))
|
|
1009
1013
|
for (var g = 0, f; f = d[g++]; )
|
|
1010
1014
|
f(c);
|
|
@@ -1012,7 +1016,7 @@ function Gn() {
|
|
|
1012
1016
|
},
|
|
1013
1017
|
Token: u
|
|
1014
1018
|
};
|
|
1015
|
-
|
|
1019
|
+
t.Prism = a;
|
|
1016
1020
|
function u(l, c, d, g) {
|
|
1017
1021
|
this.type = l, this.content = c, this.alias = d, this.length = (g || "").length | 0;
|
|
1018
1022
|
}
|
|
@@ -1033,11 +1037,11 @@ function Gn() {
|
|
|
1033
1037
|
attributes: {},
|
|
1034
1038
|
language: d
|
|
1035
1039
|
}, C = c.alias;
|
|
1036
|
-
C && (Array.isArray(C) ? Array.prototype.push.apply(f.classes, C) : f.classes.push(C)),
|
|
1037
|
-
var
|
|
1040
|
+
C && (Array.isArray(C) ? Array.prototype.push.apply(f.classes, C) : f.classes.push(C)), a.hooks.run("wrap", f);
|
|
1041
|
+
var N = "";
|
|
1038
1042
|
for (var v in f.attributes)
|
|
1039
|
-
|
|
1040
|
-
return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' +
|
|
1043
|
+
N += " " + v + '="' + (f.attributes[v] || "").replace(/"/g, """) + '"';
|
|
1044
|
+
return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' + N + ">" + f.content + "</" + f.tag + ">";
|
|
1041
1045
|
};
|
|
1042
1046
|
function m(l, c, d, g) {
|
|
1043
1047
|
l.lastIndex = c;
|
|
@@ -1048,56 +1052,56 @@ function Gn() {
|
|
|
1048
1052
|
}
|
|
1049
1053
|
return f;
|
|
1050
1054
|
}
|
|
1051
|
-
function
|
|
1052
|
-
for (var
|
|
1053
|
-
if (!(!d.hasOwnProperty(
|
|
1054
|
-
var v = d[
|
|
1055
|
+
function A(l, c, d, g, f, C) {
|
|
1056
|
+
for (var N in d)
|
|
1057
|
+
if (!(!d.hasOwnProperty(N) || !d[N])) {
|
|
1058
|
+
var v = d[N];
|
|
1055
1059
|
v = Array.isArray(v) ? v : [v];
|
|
1056
1060
|
for (var w = 0; w < v.length; ++w) {
|
|
1057
|
-
if (C && C.cause ==
|
|
1061
|
+
if (C && C.cause == N + "," + w)
|
|
1058
1062
|
return;
|
|
1059
|
-
var P = v[w], z = P.inside,
|
|
1060
|
-
if (
|
|
1063
|
+
var P = v[w], z = P.inside, Re = !!P.lookbehind, ze = !!P.greedy, vt = P.alias;
|
|
1064
|
+
if (ze && !P.pattern.global) {
|
|
1061
1065
|
var Ct = P.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1062
1066
|
P.pattern = RegExp(P.pattern.source, Ct + "g");
|
|
1063
1067
|
}
|
|
1064
|
-
for (var
|
|
1068
|
+
for (var Ge = P.pattern || P, _ = g.next, R = f; _ !== c.tail && !(C && R >= C.reach); R += _.value.length, _ = _.next) {
|
|
1065
1069
|
var Q = _.value;
|
|
1066
1070
|
if (c.length > l.length)
|
|
1067
1071
|
return;
|
|
1068
1072
|
if (!(Q instanceof u)) {
|
|
1069
|
-
var
|
|
1070
|
-
if (
|
|
1071
|
-
if (H = m(
|
|
1073
|
+
var le = 1, H;
|
|
1074
|
+
if (ze) {
|
|
1075
|
+
if (H = m(Ge, R, l, Re), !H || H.index >= l.length)
|
|
1072
1076
|
break;
|
|
1073
|
-
var
|
|
1074
|
-
for (G += _.value.length;
|
|
1077
|
+
var ce = H.index, yt = H.index + H[0].length, G = R;
|
|
1078
|
+
for (G += _.value.length; ce >= G; )
|
|
1075
1079
|
_ = _.next, G += _.value.length;
|
|
1076
1080
|
if (G -= _.value.length, R = G, _.value instanceof u)
|
|
1077
1081
|
continue;
|
|
1078
1082
|
for (var te = _; te !== c.tail && (G < yt || typeof te.value == "string"); te = te.next)
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
} else if (H = m(
|
|
1083
|
+
le++, G += te.value.length;
|
|
1084
|
+
le--, Q = l.slice(R, G), H.index -= R;
|
|
1085
|
+
} else if (H = m(Ge, 0, Q, Re), !H)
|
|
1082
1086
|
continue;
|
|
1083
|
-
var
|
|
1084
|
-
C &&
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
var
|
|
1088
|
-
if (_ = S(c,
|
|
1089
|
-
var
|
|
1090
|
-
cause:
|
|
1091
|
-
reach:
|
|
1087
|
+
var ce = H.index, ue = H[0], Ne = Q.slice(0, ce), We = Q.slice(ce + ue.length), xe = R + Q.length;
|
|
1088
|
+
C && xe > C.reach && (C.reach = xe);
|
|
1089
|
+
var de = _.prev;
|
|
1090
|
+
Ne && (de = S(c, de, Ne), R += Ne.length), T(c, de, le);
|
|
1091
|
+
var Et = new u(N, z ? a.tokenize(ue, z) : ue, vt, ue);
|
|
1092
|
+
if (_ = S(c, de, Et), We && S(c, _, We), le > 1) {
|
|
1093
|
+
var Te = {
|
|
1094
|
+
cause: N + "," + w,
|
|
1095
|
+
reach: xe
|
|
1092
1096
|
};
|
|
1093
|
-
|
|
1097
|
+
A(l, c, d, _.prev, R, Te), C && Te.reach > C.reach && (C.reach = Te.reach);
|
|
1094
1098
|
}
|
|
1095
1099
|
}
|
|
1096
1100
|
}
|
|
1097
1101
|
}
|
|
1098
1102
|
}
|
|
1099
1103
|
}
|
|
1100
|
-
function
|
|
1104
|
+
function L() {
|
|
1101
1105
|
var l = { value: null, prev: null, next: null }, c = { value: null, prev: l, next: null };
|
|
1102
1106
|
l.next = c, this.head = l, this.tail = c, this.length = 0;
|
|
1103
1107
|
}
|
|
@@ -1105,33 +1109,33 @@ function Gn() {
|
|
|
1105
1109
|
var g = c.next, f = { value: d, prev: c, next: g };
|
|
1106
1110
|
return c.next = f, g.prev = f, l.length++, f;
|
|
1107
1111
|
}
|
|
1108
|
-
function
|
|
1112
|
+
function T(l, c, d) {
|
|
1109
1113
|
for (var g = c.next, f = 0; f < d && g !== l.tail; f++)
|
|
1110
1114
|
g = g.next;
|
|
1111
1115
|
c.next = g, g.prev = c, l.length -= f;
|
|
1112
1116
|
}
|
|
1113
|
-
function
|
|
1117
|
+
function E(l) {
|
|
1114
1118
|
for (var c = [], d = l.head.next; d !== l.tail; )
|
|
1115
1119
|
c.push(d.value), d = d.next;
|
|
1116
1120
|
return c;
|
|
1117
1121
|
}
|
|
1118
|
-
if (!
|
|
1119
|
-
return
|
|
1122
|
+
if (!t.document)
|
|
1123
|
+
return t.addEventListener && (a.disableWorkerMessageHandler || t.addEventListener("message", function(l) {
|
|
1120
1124
|
var c = JSON.parse(l.data), d = c.language, g = c.code, f = c.immediateClose;
|
|
1121
|
-
|
|
1122
|
-
}, !1)),
|
|
1123
|
-
var p =
|
|
1124
|
-
p && (
|
|
1125
|
+
t.postMessage(a.highlight(g, a.languages[d], d)), f && t.close();
|
|
1126
|
+
}, !1)), a;
|
|
1127
|
+
var p = a.util.currentScript();
|
|
1128
|
+
p && (a.filename = p.src, p.hasAttribute("data-manual") && (a.manual = !0));
|
|
1125
1129
|
function y() {
|
|
1126
|
-
|
|
1130
|
+
a.manual || a.highlightAll();
|
|
1127
1131
|
}
|
|
1128
|
-
if (!
|
|
1132
|
+
if (!a.manual) {
|
|
1129
1133
|
var x = document.readyState;
|
|
1130
1134
|
x === "loading" || x === "interactive" && p && p.defer ? document.addEventListener("DOMContentLoaded", y) : window.requestAnimationFrame ? window.requestAnimationFrame(y) : window.setTimeout(y, 16);
|
|
1131
1135
|
}
|
|
1132
|
-
return
|
|
1133
|
-
}(
|
|
1134
|
-
|
|
1136
|
+
return a;
|
|
1137
|
+
}(s);
|
|
1138
|
+
n.exports && (n.exports = e), typeof Xe < "u" && (Xe.Prism = e), e.languages.markup = {
|
|
1135
1139
|
comment: {
|
|
1136
1140
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1137
1141
|
greedy: !0
|
|
@@ -1208,8 +1212,8 @@ function Gn() {
|
|
|
1208
1212
|
},
|
|
1209
1213
|
/&#x?[\da-f]{1,8};/i
|
|
1210
1214
|
]
|
|
1211
|
-
}, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(
|
|
1212
|
-
|
|
1215
|
+
}, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(t) {
|
|
1216
|
+
t.type === "entity" && (t.attributes.title = t.content.replace(/&/, "&"));
|
|
1213
1217
|
}), Object.defineProperty(e.languages.markup.tag, "addInlined", {
|
|
1214
1218
|
/**
|
|
1215
1219
|
* Adds an inlined language to markup.
|
|
@@ -1222,22 +1226,22 @@ function Gn() {
|
|
|
1222
1226
|
* @example
|
|
1223
1227
|
* addInlined('style', 'css');
|
|
1224
1228
|
*/
|
|
1225
|
-
value: function(o,
|
|
1226
|
-
var
|
|
1227
|
-
|
|
1229
|
+
value: function(o, i) {
|
|
1230
|
+
var r = {};
|
|
1231
|
+
r["language-" + i] = {
|
|
1228
1232
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1229
1233
|
lookbehind: !0,
|
|
1230
|
-
inside: e.languages[
|
|
1231
|
-
},
|
|
1232
|
-
var
|
|
1234
|
+
inside: e.languages[i]
|
|
1235
|
+
}, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1236
|
+
var a = {
|
|
1233
1237
|
"included-cdata": {
|
|
1234
1238
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1235
|
-
inside:
|
|
1239
|
+
inside: r
|
|
1236
1240
|
}
|
|
1237
1241
|
};
|
|
1238
|
-
|
|
1242
|
+
a["language-" + i] = {
|
|
1239
1243
|
pattern: /[\s\S]+/,
|
|
1240
|
-
inside: e.languages[
|
|
1244
|
+
inside: e.languages[i]
|
|
1241
1245
|
};
|
|
1242
1246
|
var u = {};
|
|
1243
1247
|
u[o] = {
|
|
@@ -1246,7 +1250,7 @@ function Gn() {
|
|
|
1246
1250
|
}), "i"),
|
|
1247
1251
|
lookbehind: !0,
|
|
1248
1252
|
greedy: !0,
|
|
1249
|
-
inside:
|
|
1253
|
+
inside: a
|
|
1250
1254
|
}, e.languages.insertBefore("markup", "cdata", u);
|
|
1251
1255
|
}
|
|
1252
1256
|
}), Object.defineProperty(e.languages.markup.tag, "addAttribute", {
|
|
@@ -1261,10 +1265,10 @@ function Gn() {
|
|
|
1261
1265
|
* @example
|
|
1262
1266
|
* addAttribute('style', 'css');
|
|
1263
1267
|
*/
|
|
1264
|
-
value: function(
|
|
1268
|
+
value: function(t, o) {
|
|
1265
1269
|
e.languages.markup.tag.inside["special-attr"].push({
|
|
1266
1270
|
pattern: RegExp(
|
|
1267
|
-
/(^|["'\s])/.source + "(?:" +
|
|
1271
|
+
/(^|["'\s])/.source + "(?:" + t + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
1268
1272
|
"i"
|
|
1269
1273
|
),
|
|
1270
1274
|
lookbehind: !0,
|
|
@@ -1291,9 +1295,9 @@ function Gn() {
|
|
|
1291
1295
|
}
|
|
1292
1296
|
});
|
|
1293
1297
|
}
|
|
1294
|
-
}), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, function(
|
|
1298
|
+
}), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, function(t) {
|
|
1295
1299
|
var o = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1296
|
-
|
|
1300
|
+
t.languages.css = {
|
|
1297
1301
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1298
1302
|
atrule: {
|
|
1299
1303
|
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + o.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
@@ -1342,9 +1346,9 @@ function Gn() {
|
|
|
1342
1346
|
lookbehind: !0
|
|
1343
1347
|
},
|
|
1344
1348
|
punctuation: /[(){};:,]/
|
|
1345
|
-
},
|
|
1346
|
-
var
|
|
1347
|
-
|
|
1349
|
+
}, t.languages.css.atrule.inside.rest = t.languages.css;
|
|
1350
|
+
var i = t.languages.markup;
|
|
1351
|
+
i && (i.tag.addInlined("style", "css"), i.tag.addAttribute("style", "css"));
|
|
1348
1352
|
}(e), e.languages.clike = {
|
|
1349
1353
|
comment: [
|
|
1350
1354
|
{
|
|
@@ -1509,9 +1513,9 @@ function Gn() {
|
|
|
1509
1513
|
if (typeof e > "u" || typeof document > "u")
|
|
1510
1514
|
return;
|
|
1511
1515
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1512
|
-
var
|
|
1516
|
+
var t = "Loading…", o = function(p, y) {
|
|
1513
1517
|
return "✖ Error " + p + " while fetching file: " + y;
|
|
1514
|
-
},
|
|
1518
|
+
}, i = "✖ Error: File does not exist or is empty", r = {
|
|
1515
1519
|
js: "javascript",
|
|
1516
1520
|
py: "python",
|
|
1517
1521
|
rb: "ruby",
|
|
@@ -1521,14 +1525,14 @@ function Gn() {
|
|
|
1521
1525
|
bat: "batch",
|
|
1522
1526
|
h: "c",
|
|
1523
1527
|
tex: "latex"
|
|
1524
|
-
},
|
|
1528
|
+
}, a = "data-src-status", u = "loading", m = "loaded", A = "failed", L = "pre[data-src]:not([" + a + '="' + m + '"]):not([' + a + '="' + u + '"])';
|
|
1525
1529
|
function S(p, y, x) {
|
|
1526
1530
|
var l = new XMLHttpRequest();
|
|
1527
1531
|
l.open("GET", p, !0), l.onreadystatechange = function() {
|
|
1528
|
-
l.readyState == 4 && (l.status < 400 && l.responseText ? y(l.responseText) : l.status >= 400 ? x(o(l.status, l.statusText)) : x(
|
|
1532
|
+
l.readyState == 4 && (l.status < 400 && l.responseText ? y(l.responseText) : l.status >= 400 ? x(o(l.status, l.statusText)) : x(i));
|
|
1529
1533
|
}, l.send(null);
|
|
1530
1534
|
}
|
|
1531
|
-
function
|
|
1535
|
+
function T(p) {
|
|
1532
1536
|
var y = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p || "");
|
|
1533
1537
|
if (y) {
|
|
1534
1538
|
var x = Number(y[1]), l = y[2], c = y[3];
|
|
@@ -1536,37 +1540,37 @@ function Gn() {
|
|
|
1536
1540
|
}
|
|
1537
1541
|
}
|
|
1538
1542
|
e.hooks.add("before-highlightall", function(p) {
|
|
1539
|
-
p.selector += ", " +
|
|
1543
|
+
p.selector += ", " + L;
|
|
1540
1544
|
}), e.hooks.add("before-sanity-check", function(p) {
|
|
1541
1545
|
var y = (
|
|
1542
1546
|
/** @type {HTMLPreElement} */
|
|
1543
1547
|
p.element
|
|
1544
1548
|
);
|
|
1545
|
-
if (y.matches(
|
|
1546
|
-
p.code = "", y.setAttribute(
|
|
1549
|
+
if (y.matches(L)) {
|
|
1550
|
+
p.code = "", y.setAttribute(a, u);
|
|
1547
1551
|
var x = y.appendChild(document.createElement("CODE"));
|
|
1548
|
-
x.textContent =
|
|
1552
|
+
x.textContent = t;
|
|
1549
1553
|
var l = y.getAttribute("data-src"), c = p.language;
|
|
1550
1554
|
if (c === "none") {
|
|
1551
1555
|
var d = (/\.(\w+)$/.exec(l) || [, "none"])[1];
|
|
1552
|
-
c =
|
|
1556
|
+
c = r[d] || d;
|
|
1553
1557
|
}
|
|
1554
1558
|
e.util.setLanguage(x, c), e.util.setLanguage(y, c);
|
|
1555
1559
|
var g = e.plugins.autoloader;
|
|
1556
1560
|
g && g.loadLanguages(c), S(
|
|
1557
1561
|
l,
|
|
1558
1562
|
function(f) {
|
|
1559
|
-
y.setAttribute(
|
|
1560
|
-
var C =
|
|
1563
|
+
y.setAttribute(a, m);
|
|
1564
|
+
var C = T(y.getAttribute("data-range"));
|
|
1561
1565
|
if (C) {
|
|
1562
|
-
var
|
|
1563
|
-
v < 0 && (v +=
|
|
1566
|
+
var N = f.split(/\r\n?|\n/g), v = C[0], w = C[1] == null ? N.length : C[1];
|
|
1567
|
+
v < 0 && (v += N.length), v = Math.max(0, Math.min(v - 1, N.length)), w < 0 && (w += N.length), w = Math.max(0, Math.min(w, N.length)), f = N.slice(v, w).join(`
|
|
1564
1568
|
`), y.hasAttribute("data-start") || y.setAttribute("data-start", String(v + 1));
|
|
1565
1569
|
}
|
|
1566
1570
|
x.textContent = f, e.highlightElement(x);
|
|
1567
1571
|
},
|
|
1568
1572
|
function(f) {
|
|
1569
|
-
y.setAttribute(
|
|
1573
|
+
y.setAttribute(a, A), x.textContent = f;
|
|
1570
1574
|
}
|
|
1571
1575
|
);
|
|
1572
1576
|
}
|
|
@@ -1579,64 +1583,64 @@ function Gn() {
|
|
|
1579
1583
|
* @param {ParentNode} [container=document]
|
|
1580
1584
|
*/
|
|
1581
1585
|
highlight: function(y) {
|
|
1582
|
-
for (var x = (y || document).querySelectorAll(
|
|
1586
|
+
for (var x = (y || document).querySelectorAll(L), l = 0, c; c = x[l++]; )
|
|
1583
1587
|
e.highlightElement(c);
|
|
1584
1588
|
}
|
|
1585
1589
|
};
|
|
1586
|
-
var
|
|
1590
|
+
var E = !1;
|
|
1587
1591
|
e.fileHighlight = function() {
|
|
1588
|
-
|
|
1592
|
+
E || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), E = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1589
1593
|
};
|
|
1590
1594
|
}();
|
|
1591
|
-
}(
|
|
1595
|
+
}(Fe)), Fe.exports;
|
|
1592
1596
|
}
|
|
1593
1597
|
var Wn = Gn();
|
|
1594
1598
|
const Kn = /* @__PURE__ */ zn(Wn);
|
|
1595
1599
|
typeof globalThis < "u" && (globalThis.Prism = Kn);
|
|
1596
|
-
function Un({ codeBlockCoords:
|
|
1597
|
-
const [e] = M(), [
|
|
1600
|
+
function Un({ codeBlockCoords: n, codeNodeKey: s }) {
|
|
1601
|
+
const [e] = M(), [t, o] = O({
|
|
1598
1602
|
x: B,
|
|
1599
1603
|
y: B
|
|
1600
|
-
}),
|
|
1601
|
-
new Set(u.map((
|
|
1602
|
-
),
|
|
1603
|
-
return u.forEach((
|
|
1604
|
-
const S =
|
|
1605
|
-
|
|
1604
|
+
}), i = ee(null), [r, a] = O(""), u = bn(), m = Array.from(
|
|
1605
|
+
new Set(u.map((L) => $e(L)))
|
|
1606
|
+
), A = {};
|
|
1607
|
+
return u.forEach((L) => {
|
|
1608
|
+
const S = $e(L);
|
|
1609
|
+
A[S] || (A[S] = L);
|
|
1606
1610
|
}), b(() => {
|
|
1607
|
-
o(
|
|
1608
|
-
}, [
|
|
1611
|
+
o(Ln(n, i));
|
|
1612
|
+
}, [n]), b(() => {
|
|
1609
1613
|
e.read(() => {
|
|
1610
|
-
if (
|
|
1611
|
-
const S = j(
|
|
1612
|
-
|
|
1614
|
+
if (s) {
|
|
1615
|
+
const S = j(s).getLanguage();
|
|
1616
|
+
a($e(S));
|
|
1613
1617
|
}
|
|
1614
1618
|
});
|
|
1615
|
-
}, [e,
|
|
1619
|
+
}, [e, s]), /* @__PURE__ */ D(
|
|
1616
1620
|
Rt,
|
|
1617
1621
|
{
|
|
1618
1622
|
id: "code-highlight-menu",
|
|
1619
|
-
ref:
|
|
1623
|
+
ref: i,
|
|
1620
1624
|
style: {
|
|
1621
1625
|
position: "absolute",
|
|
1622
|
-
top:
|
|
1623
|
-
left:
|
|
1626
|
+
top: t.y,
|
|
1627
|
+
left: t.x
|
|
1624
1628
|
},
|
|
1625
1629
|
"aria-label": "Code menu",
|
|
1626
|
-
inputValue:
|
|
1627
|
-
onInputChange: (
|
|
1628
|
-
const S =
|
|
1630
|
+
inputValue: r,
|
|
1631
|
+
onInputChange: (L) => {
|
|
1632
|
+
const S = A[L];
|
|
1629
1633
|
e.dispatchCommand(ft, [
|
|
1630
|
-
|
|
1634
|
+
s,
|
|
1631
1635
|
S
|
|
1632
|
-
]),
|
|
1636
|
+
]), a(L);
|
|
1633
1637
|
},
|
|
1634
1638
|
children: [
|
|
1635
1639
|
/* @__PURE__ */ D("div", { children: [
|
|
1636
1640
|
/* @__PURE__ */ h(it, {}),
|
|
1637
1641
|
/* @__PURE__ */ h(q, { children: /* @__PURE__ */ h(Jt, { size: 24 }) })
|
|
1638
1642
|
] }),
|
|
1639
|
-
/* @__PURE__ */ h(ot, { children: /* @__PURE__ */ h(zt, { children: m.map((
|
|
1643
|
+
/* @__PURE__ */ h(ot, { children: /* @__PURE__ */ h(zt, { children: m.map((L, S) => /* @__PURE__ */ h(Gt, { children: L }, S)) }) })
|
|
1640
1644
|
]
|
|
1641
1645
|
}
|
|
1642
1646
|
);
|
|
@@ -1647,106 +1651,106 @@ const qn = document.body, gt = Z(
|
|
|
1647
1651
|
"SET_CODE_LANGUAGE_COMMAND"
|
|
1648
1652
|
);
|
|
1649
1653
|
function jn() {
|
|
1650
|
-
const [
|
|
1651
|
-
|
|
1652
|
-
}, []),
|
|
1653
|
-
const
|
|
1654
|
-
return !!(
|
|
1655
|
-
}, []),
|
|
1656
|
-
const
|
|
1657
|
-
return
|
|
1658
|
-
}, [
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
}, [m,
|
|
1654
|
+
const [n, s] = O(null), [e, t] = O(null), [o, i] = O(!1), [r, a] = O(!1), [u] = M(), m = ge(() => {
|
|
1655
|
+
s(null), t(null);
|
|
1656
|
+
}, []), A = ge(() => {
|
|
1657
|
+
const T = document.getElementById("code-highlight-menu"), E = document.activeElement;
|
|
1658
|
+
return !!(T && E && (T === E || T.contains(E)));
|
|
1659
|
+
}, []), L = ge(() => {
|
|
1660
|
+
const T = A();
|
|
1661
|
+
return a(T), T;
|
|
1662
|
+
}, [A]), S = ge(() => {
|
|
1663
|
+
const T = L();
|
|
1664
|
+
i(!1), T || m();
|
|
1665
|
+
}, [m, L]);
|
|
1662
1666
|
return b(() => u.registerCommand(
|
|
1663
1667
|
Y,
|
|
1664
1668
|
() => {
|
|
1665
|
-
const
|
|
1669
|
+
const E = L(), p = u.getRootElement();
|
|
1666
1670
|
if (p) {
|
|
1667
1671
|
const c = p === document.activeElement || p.contains(document.activeElement);
|
|
1668
|
-
|
|
1672
|
+
i((d) => d === c ? d : c);
|
|
1669
1673
|
}
|
|
1670
|
-
const y =
|
|
1674
|
+
const y = $();
|
|
1671
1675
|
if (!k(y))
|
|
1672
|
-
return
|
|
1673
|
-
const x =
|
|
1676
|
+
return E || m(), !1;
|
|
1677
|
+
const x = Ee(y), l = I(x, ve);
|
|
1674
1678
|
if (l) {
|
|
1675
1679
|
const d = u.getElementByKey(l.getKey()).getBoundingClientRect(), g = d.right, f = d.top + window.scrollY;
|
|
1676
|
-
|
|
1680
|
+
s({ x: g, y: f }), t(l.getKey());
|
|
1677
1681
|
} else
|
|
1678
|
-
|
|
1682
|
+
E || m();
|
|
1679
1683
|
return !1;
|
|
1680
1684
|
},
|
|
1681
|
-
|
|
1682
|
-
), [u,
|
|
1683
|
-
|
|
1685
|
+
F
|
|
1686
|
+
), [u, L, m]), b(() => u.registerCommand(
|
|
1687
|
+
ae,
|
|
1684
1688
|
() => (setTimeout(S, 0), !1),
|
|
1685
|
-
|
|
1689
|
+
F
|
|
1686
1690
|
), [u, S]), b(() => {
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
},
|
|
1691
|
+
const T = () => {
|
|
1692
|
+
i(!0), a(!1);
|
|
1693
|
+
}, E = () => setTimeout(S, 0);
|
|
1690
1694
|
return u.registerRootListener((p, y) => {
|
|
1691
|
-
p && (p.addEventListener("focus",
|
|
1695
|
+
p && (p.addEventListener("focus", T), p.addEventListener("blur", E)), y && (y.removeEventListener("focus", T), y.removeEventListener("blur", E));
|
|
1692
1696
|
});
|
|
1693
|
-
}, [u, S]),
|
|
1694
|
-
/* @__PURE__ */ h(Un, { codeBlockCoords:
|
|
1697
|
+
}, [u, S]), n && (o || r) && De(
|
|
1698
|
+
/* @__PURE__ */ h(Un, { codeBlockCoords: n, codeNodeKey: e }),
|
|
1695
1699
|
qn
|
|
1696
1700
|
);
|
|
1697
1701
|
}
|
|
1698
1702
|
function Yn() {
|
|
1699
|
-
const [
|
|
1700
|
-
return b(() => vn(
|
|
1703
|
+
const [n] = M();
|
|
1704
|
+
return b(() => vn(n), [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
1701
1705
|
if (!e.isSimpleText())
|
|
1702
1706
|
return;
|
|
1703
|
-
const
|
|
1704
|
-
if (
|
|
1705
|
-
const o = e.getPreviousSibling(),
|
|
1706
|
-
if (
|
|
1707
|
-
if (
|
|
1707
|
+
const t = e.getTextContent();
|
|
1708
|
+
if (t.startsWith("``` ")) {
|
|
1709
|
+
const o = e.getPreviousSibling(), i = I(e, J), r = i !== null && i.getChildrenSize() === 1, a = ie(o);
|
|
1710
|
+
if (r || a) {
|
|
1711
|
+
if (t.length > 4)
|
|
1708
1712
|
return;
|
|
1709
|
-
const u =
|
|
1713
|
+
const u = Ze();
|
|
1710
1714
|
e.replace(u), u.select();
|
|
1711
1715
|
const m = u.getNextSibling();
|
|
1712
1716
|
ie(m) && m.remove();
|
|
1713
1717
|
return;
|
|
1714
1718
|
}
|
|
1715
1719
|
}
|
|
1716
|
-
}), [
|
|
1720
|
+
}), [n]), b(() => n.registerCommand(
|
|
1717
1721
|
gt,
|
|
1718
1722
|
() => {
|
|
1719
|
-
const e =
|
|
1723
|
+
const e = ye();
|
|
1720
1724
|
if (k(e)) {
|
|
1721
|
-
const
|
|
1722
|
-
return e.insertNodes([
|
|
1723
|
-
|
|
1725
|
+
const t = Ze();
|
|
1726
|
+
return e.insertNodes([t]), t.selectStart(), setTimeout(() => {
|
|
1727
|
+
n.focus();
|
|
1724
1728
|
}, 0), !0;
|
|
1725
1729
|
}
|
|
1726
1730
|
return !1;
|
|
1727
1731
|
},
|
|
1728
|
-
|
|
1729
|
-
), [
|
|
1732
|
+
F
|
|
1733
|
+
), [n]), b(() => n.registerCommand(
|
|
1730
1734
|
ft,
|
|
1731
1735
|
(e) => {
|
|
1732
|
-
const [
|
|
1733
|
-
return
|
|
1736
|
+
const [t, o] = e, i = j(t);
|
|
1737
|
+
return ve(i) ? (i.setLanguage(o), !0) : !1;
|
|
1734
1738
|
},
|
|
1735
|
-
|
|
1736
|
-
), [
|
|
1737
|
-
|
|
1739
|
+
F
|
|
1740
|
+
), [n]), b(() => n.registerCommand(
|
|
1741
|
+
Oe,
|
|
1738
1742
|
(e) => {
|
|
1739
|
-
const
|
|
1740
|
-
if (!k(
|
|
1743
|
+
const t = $();
|
|
1744
|
+
if (!k(t) || !t.isCollapsed())
|
|
1741
1745
|
return !1;
|
|
1742
|
-
const o =
|
|
1743
|
-
return
|
|
1746
|
+
const o = t.anchor.getNode(), i = I(o, ve);
|
|
1747
|
+
return i && t.anchor.offset === 0 && i.getTextContent() === "" ? (i.remove(), !0) : !1;
|
|
1744
1748
|
},
|
|
1745
|
-
|
|
1746
|
-
), [
|
|
1749
|
+
F
|
|
1750
|
+
), [n]), null;
|
|
1747
1751
|
}
|
|
1748
1752
|
function Zn() {
|
|
1749
|
-
return /* @__PURE__ */ D(
|
|
1753
|
+
return /* @__PURE__ */ D(rt, { children: [
|
|
1750
1754
|
/* @__PURE__ */ h(Yn, {}),
|
|
1751
1755
|
/* @__PURE__ */ h(jn, {})
|
|
1752
1756
|
] });
|
|
@@ -1755,121 +1759,130 @@ const ht = Z(
|
|
|
1755
1759
|
"INSERT_HORIZONTAL_DIVIDER_COMMAND"
|
|
1756
1760
|
);
|
|
1757
1761
|
function Qn() {
|
|
1758
|
-
const [
|
|
1762
|
+
const [n] = M();
|
|
1759
1763
|
return b(() => {
|
|
1760
|
-
if (!
|
|
1764
|
+
if (!n.hasNodes([gn]))
|
|
1761
1765
|
throw new Error("HorizontalDividerNode not registered on editor");
|
|
1762
|
-
return
|
|
1766
|
+
return n.registerCommand(
|
|
1763
1767
|
ht,
|
|
1764
1768
|
() => {
|
|
1765
|
-
const e =
|
|
1769
|
+
const e = ye();
|
|
1766
1770
|
if (k(e)) {
|
|
1767
|
-
const
|
|
1768
|
-
e.insertNodes([
|
|
1769
|
-
let o =
|
|
1770
|
-
return o || (o =
|
|
1771
|
-
|
|
1771
|
+
const t = fn();
|
|
1772
|
+
e.insertNodes([t]);
|
|
1773
|
+
let o = t.getNextSibling() || t.getParent().getNextSibling();
|
|
1774
|
+
return o || (o = Ce(), t.insertAfter(o)), o.selectStart(), setTimeout(() => {
|
|
1775
|
+
n.focus();
|
|
1772
1776
|
}, 0), !0;
|
|
1773
1777
|
}
|
|
1774
1778
|
return !1;
|
|
1775
1779
|
},
|
|
1776
|
-
|
|
1780
|
+
F
|
|
1777
1781
|
);
|
|
1778
|
-
}, [
|
|
1782
|
+
}, [n]), null;
|
|
1779
1783
|
}
|
|
1780
|
-
const
|
|
1781
|
-
function
|
|
1782
|
-
return
|
|
1784
|
+
const Me = Z("INSERT_IMAGE_COMMAND"), Je = "selected";
|
|
1785
|
+
function et(n) {
|
|
1786
|
+
return n && n.type && n.type.startsWith("image/");
|
|
1783
1787
|
}
|
|
1784
|
-
function
|
|
1785
|
-
const e =
|
|
1788
|
+
function tt(n, s) {
|
|
1789
|
+
const e = ye() || $();
|
|
1786
1790
|
if (!k(e))
|
|
1787
1791
|
return null;
|
|
1788
|
-
const
|
|
1789
|
-
e.insertNodes([
|
|
1790
|
-
let o =
|
|
1791
|
-
return o || (o =
|
|
1792
|
+
const t = hn(n, s);
|
|
1793
|
+
e.insertNodes([t]);
|
|
1794
|
+
let o = t.getNextSibling() || t.getParent().getNextSibling();
|
|
1795
|
+
return o || (o = Ce(), t.insertAfter(o)), t.select(), t.getKey();
|
|
1792
1796
|
}
|
|
1793
|
-
function Xn({ onImageUpload:
|
|
1794
|
-
const [
|
|
1797
|
+
function Xn({ onImageUpload: n }) {
|
|
1798
|
+
const [s] = M(), e = ee(null), t = ee(n);
|
|
1795
1799
|
b(() => {
|
|
1796
|
-
|
|
1797
|
-
}, [
|
|
1798
|
-
if (!
|
|
1800
|
+
t.current = n;
|
|
1801
|
+
}, [n]), b(() => {
|
|
1802
|
+
if (!s.hasNode(Ye))
|
|
1799
1803
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
1800
|
-
}, [
|
|
1801
|
-
const o = (
|
|
1802
|
-
const u =
|
|
1803
|
-
u && Promise.resolve().then(() => u(
|
|
1804
|
+
}, [s]);
|
|
1805
|
+
const o = (i, r, a) => {
|
|
1806
|
+
const u = t.current;
|
|
1807
|
+
u && Promise.resolve().then(() => u(r)).then((m) => {
|
|
1804
1808
|
if (typeof m != "string" || !m)
|
|
1805
1809
|
throw new Error("onImageUpload must resolve to a URL string");
|
|
1806
|
-
|
|
1807
|
-
const
|
|
1808
|
-
|
|
1809
|
-
}), URL.revokeObjectURL(
|
|
1810
|
+
s.update(() => {
|
|
1811
|
+
const A = j(i);
|
|
1812
|
+
fe(A) && (A.setSrc(m), A.setUploadState(re.UPLOADED));
|
|
1813
|
+
}), URL.revokeObjectURL(a);
|
|
1810
1814
|
}).catch((m) => {
|
|
1811
|
-
console.error("ImagePlugin: image upload failed", m),
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1815
|
+
console.error("ImagePlugin: image upload failed", m), s.update(() => {
|
|
1816
|
+
const A = j(i);
|
|
1817
|
+
fe(A) && A.setUploadState(re.ERROR);
|
|
1814
1818
|
});
|
|
1815
1819
|
});
|
|
1816
1820
|
};
|
|
1817
|
-
return b(() =>
|
|
1818
|
-
|
|
1819
|
-
(
|
|
1820
|
-
if (typeof
|
|
1821
|
-
return
|
|
1822
|
-
if (
|
|
1823
|
-
const
|
|
1824
|
-
|
|
1821
|
+
return b(() => s.registerCommand(
|
|
1822
|
+
Me,
|
|
1823
|
+
(r) => {
|
|
1824
|
+
if (typeof r == "string")
|
|
1825
|
+
return tt(r, re.UPLOADED), !0;
|
|
1826
|
+
if (r instanceof File && et(r)) {
|
|
1827
|
+
const a = URL.createObjectURL(r), u = !!t.current, m = tt(
|
|
1828
|
+
a,
|
|
1825
1829
|
u ? re.UPLOADING : re.UPLOADED
|
|
1826
1830
|
);
|
|
1827
|
-
return m && u && o(m,
|
|
1831
|
+
return m && u && o(m, r, a), !0;
|
|
1828
1832
|
}
|
|
1829
1833
|
return !1;
|
|
1830
1834
|
},
|
|
1831
|
-
|
|
1832
|
-
), [
|
|
1835
|
+
F
|
|
1836
|
+
), [s]), b(() => s.registerCommand(
|
|
1833
1837
|
Y,
|
|
1834
1838
|
() => {
|
|
1835
|
-
e.current && (e.current.classList.remove(
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1838
|
-
const
|
|
1839
|
-
if (
|
|
1840
|
-
const u =
|
|
1841
|
-
u.classList.add(
|
|
1839
|
+
e.current && (e.current.classList.remove(Je), e.current = null);
|
|
1840
|
+
const r = $();
|
|
1841
|
+
if (pe(r) && r.getNodes().length === 1) {
|
|
1842
|
+
const a = r.getNodes()[0];
|
|
1843
|
+
if (fe(a)) {
|
|
1844
|
+
const u = s.getElementByKey(a.getKey());
|
|
1845
|
+
u.classList.add(Je), e.current = u;
|
|
1842
1846
|
}
|
|
1843
1847
|
}
|
|
1844
1848
|
return !1;
|
|
1845
1849
|
},
|
|
1846
|
-
|
|
1847
|
-
), [
|
|
1848
|
-
|
|
1849
|
-
(
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1852
|
-
|
|
1850
|
+
ke
|
|
1851
|
+
), [s]), b(() => s.registerCommand(
|
|
1852
|
+
ae,
|
|
1853
|
+
() => {
|
|
1854
|
+
const r = $();
|
|
1855
|
+
return pe(r) && r.getNodes().length === 1 && fe(r.getNodes()[0]) && Pe(null), !1;
|
|
1856
|
+
},
|
|
1857
|
+
ke
|
|
1858
|
+
), [s]), b(() => s.registerCommand(
|
|
1859
|
+
_e,
|
|
1860
|
+
(r) => {
|
|
1861
|
+
const a = r.clipboardData;
|
|
1862
|
+
if (!a) return !1;
|
|
1863
|
+
const u = Array.from(a.files).filter(et);
|
|
1853
1864
|
if (u.length !== 1) return !1;
|
|
1854
|
-
const m =
|
|
1855
|
-
return k(m) ? (
|
|
1865
|
+
const m = $() || ye();
|
|
1866
|
+
return k(m) ? (r.preventDefault(), s.dispatchCommand(Me, u[0]), !0) : !1;
|
|
1856
1867
|
},
|
|
1857
|
-
|
|
1858
|
-
), [
|
|
1859
|
-
|
|
1868
|
+
F
|
|
1869
|
+
), [s]), /* @__PURE__ */ h(
|
|
1870
|
+
He,
|
|
1860
1871
|
{
|
|
1861
|
-
nodeType:
|
|
1872
|
+
nodeType: Ye,
|
|
1862
1873
|
eventType: "click",
|
|
1863
|
-
eventListener: (
|
|
1864
|
-
|
|
1874
|
+
eventListener: (i, r, a) => {
|
|
1875
|
+
if (!r.isEditable())
|
|
1876
|
+
return;
|
|
1877
|
+
j(a).select();
|
|
1865
1878
|
}
|
|
1866
1879
|
}
|
|
1867
1880
|
);
|
|
1868
1881
|
}
|
|
1869
|
-
const
|
|
1882
|
+
const he = 24;
|
|
1870
1883
|
function Vn() {
|
|
1871
|
-
const [
|
|
1872
|
-
return /* @__PURE__ */ h(
|
|
1884
|
+
const [n] = M();
|
|
1885
|
+
return /* @__PURE__ */ h(Be, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ D(oe, { "aria-label": "Media", children: [
|
|
1873
1886
|
/* @__PURE__ */ h(
|
|
1874
1887
|
Kt,
|
|
1875
1888
|
{
|
|
@@ -1877,15 +1890,15 @@ function Vn() {
|
|
|
1877
1890
|
onSelect: (e) => {
|
|
1878
1891
|
if (!e || e.length === 0)
|
|
1879
1892
|
return;
|
|
1880
|
-
const
|
|
1881
|
-
if (!
|
|
1893
|
+
const t = e[0];
|
|
1894
|
+
if (!t.type.startsWith("image/")) {
|
|
1882
1895
|
alert("Please select an image file.");
|
|
1883
1896
|
return;
|
|
1884
1897
|
}
|
|
1885
|
-
|
|
1898
|
+
n.dispatchCommand(Me, t);
|
|
1886
1899
|
},
|
|
1887
1900
|
allowsMultiple: !1,
|
|
1888
|
-
children: /* @__PURE__ */ h(q, { "aria-label": "image", children: /* @__PURE__ */ h(tn, { size:
|
|
1901
|
+
children: /* @__PURE__ */ h(q, { "aria-label": "image", children: /* @__PURE__ */ h(tn, { size: he }) })
|
|
1889
1902
|
}
|
|
1890
1903
|
),
|
|
1891
1904
|
/* @__PURE__ */ h(
|
|
@@ -1893,9 +1906,9 @@ function Vn() {
|
|
|
1893
1906
|
{
|
|
1894
1907
|
"aria-label": "code block",
|
|
1895
1908
|
onPress: () => {
|
|
1896
|
-
|
|
1909
|
+
n.dispatchCommand(gt, void 0);
|
|
1897
1910
|
},
|
|
1898
|
-
children: /* @__PURE__ */ h(nn, { size:
|
|
1911
|
+
children: /* @__PURE__ */ h(nn, { size: he })
|
|
1899
1912
|
}
|
|
1900
1913
|
),
|
|
1901
1914
|
/* @__PURE__ */ h(
|
|
@@ -1903,112 +1916,116 @@ function Vn() {
|
|
|
1903
1916
|
{
|
|
1904
1917
|
"aria-label": "horizontal divider",
|
|
1905
1918
|
onPress: () => {
|
|
1906
|
-
|
|
1919
|
+
n.dispatchCommand(
|
|
1907
1920
|
ht,
|
|
1908
1921
|
void 0
|
|
1909
1922
|
);
|
|
1910
1923
|
},
|
|
1911
|
-
children: /* @__PURE__ */ h(rn, { size:
|
|
1924
|
+
children: /* @__PURE__ */ h(rn, { size: he })
|
|
1912
1925
|
}
|
|
1913
1926
|
)
|
|
1914
1927
|
] }) });
|
|
1915
1928
|
}
|
|
1916
1929
|
function Jn({
|
|
1917
|
-
selectionRectCoords:
|
|
1918
|
-
TOOLBAR_OFFSET:
|
|
1930
|
+
selectionRectCoords: n,
|
|
1931
|
+
TOOLBAR_OFFSET: s,
|
|
1919
1932
|
toolbarTriggerId: e,
|
|
1920
|
-
toolbarPopoverId:
|
|
1933
|
+
toolbarPopoverId: t
|
|
1921
1934
|
}) {
|
|
1922
|
-
const [o,
|
|
1935
|
+
const [o, i] = O({
|
|
1923
1936
|
x: B,
|
|
1924
1937
|
y: B
|
|
1925
|
-
}),
|
|
1938
|
+
}), r = ee(null);
|
|
1926
1939
|
return b(() => {
|
|
1927
|
-
|
|
1940
|
+
i(
|
|
1928
1941
|
An(
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1942
|
+
n,
|
|
1943
|
+
r,
|
|
1944
|
+
s
|
|
1932
1945
|
)
|
|
1933
1946
|
);
|
|
1934
|
-
}, [
|
|
1947
|
+
}, [n]), /* @__PURE__ */ D(Wt, { children: [
|
|
1935
1948
|
/* @__PURE__ */ h(
|
|
1936
1949
|
q,
|
|
1937
1950
|
{
|
|
1938
1951
|
"aria-label": "Block toolbar trigger",
|
|
1939
1952
|
className: "block-toolbar-trigger",
|
|
1940
1953
|
id: e,
|
|
1941
|
-
ref:
|
|
1954
|
+
ref: r,
|
|
1942
1955
|
style: {
|
|
1943
1956
|
position: "absolute",
|
|
1944
1957
|
top: o.y,
|
|
1945
1958
|
left: o.x
|
|
1946
1959
|
},
|
|
1947
|
-
children: /* @__PURE__ */ h(en, { size:
|
|
1960
|
+
children: /* @__PURE__ */ h(en, { size: he })
|
|
1948
1961
|
}
|
|
1949
1962
|
),
|
|
1950
1963
|
/* @__PURE__ */ h(
|
|
1951
1964
|
ot,
|
|
1952
1965
|
{
|
|
1953
1966
|
className: "block-toolbar-popover",
|
|
1954
|
-
id:
|
|
1967
|
+
id: t,
|
|
1955
1968
|
placement: "end",
|
|
1956
1969
|
shouldFlip: !1,
|
|
1957
|
-
offset:
|
|
1970
|
+
offset: s,
|
|
1958
1971
|
children: /* @__PURE__ */ h(Vn, {})
|
|
1959
1972
|
}
|
|
1960
1973
|
)
|
|
1961
1974
|
] });
|
|
1962
1975
|
}
|
|
1963
1976
|
const er = document.body;
|
|
1964
|
-
function tr({ toolbarGap:
|
|
1965
|
-
const [
|
|
1977
|
+
function tr({ toolbarGap: n }) {
|
|
1978
|
+
const [s, e] = O(null), [t] = M(), [o, i] = O(!1), [r, a] = O(!1), u = ee(Math.random().toString(36).substring(2, 9)), m = `block-toolbar-trigger-${u.current}`, A = `block-toolbar-popover-${u.current}`, L = () => i(!0), S = (T) => {
|
|
1966
1979
|
setTimeout(() => {
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1980
|
+
const E = document.getElementById(m);
|
|
1981
|
+
E && (E === document.activeElement || E.contains(document.activeElement) || E.contains(T.relatedTarget)) || i(!1);
|
|
1969
1982
|
}, 10);
|
|
1970
1983
|
};
|
|
1971
1984
|
return b(() => {
|
|
1972
|
-
const
|
|
1973
|
-
const p = !!document.getElementById(
|
|
1974
|
-
|
|
1975
|
-
},
|
|
1976
|
-
return
|
|
1985
|
+
const T = () => {
|
|
1986
|
+
const p = !!document.getElementById(A);
|
|
1987
|
+
a(p);
|
|
1988
|
+
}, E = new MutationObserver(T);
|
|
1989
|
+
return E.observe(document.body, {
|
|
1977
1990
|
childList: !0,
|
|
1978
1991
|
subtree: !0
|
|
1979
|
-
}),
|
|
1980
|
-
}, []), b(() =>
|
|
1981
|
-
(
|
|
1982
|
-
|
|
1992
|
+
}), T(), () => E.disconnect();
|
|
1993
|
+
}, []), b(() => t.registerRootListener(
|
|
1994
|
+
(E, p) => {
|
|
1995
|
+
E && (E.addEventListener("focus", L), E.addEventListener("blur", S)), p && (p.removeEventListener("focus", L), p.removeEventListener("blur", S));
|
|
1983
1996
|
}
|
|
1984
|
-
), [
|
|
1997
|
+
), [t]), b(() => t.registerEditableListener((T) => {
|
|
1998
|
+
T || e(null);
|
|
1999
|
+
}), [t]), b(() => t.registerCommand(
|
|
1985
2000
|
Y,
|
|
1986
2001
|
() => {
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2002
|
+
if (!t.isEditable())
|
|
2003
|
+
return e(null), !1;
|
|
2004
|
+
const E = t.getRootElement();
|
|
2005
|
+
if (E) {
|
|
2006
|
+
const x = E === document.activeElement || E.contains(document.activeElement);
|
|
2007
|
+
x !== o && i(x);
|
|
1991
2008
|
}
|
|
1992
|
-
const p =
|
|
2009
|
+
const p = $();
|
|
1993
2010
|
if (!k(p) || !p.isCollapsed())
|
|
1994
2011
|
return e(null), !1;
|
|
1995
|
-
const y =
|
|
2012
|
+
const y = Ee(p);
|
|
1996
2013
|
if (J(y) && y.getTextContent() === "") {
|
|
1997
|
-
const l =
|
|
2014
|
+
const l = t.getElementByKey(y.getKey()).getBoundingClientRect(), c = l.left, d = l.top + l.height / 2 + window.scrollY;
|
|
1998
2015
|
e({ x: c, y: d });
|
|
1999
2016
|
} else
|
|
2000
2017
|
e(null);
|
|
2001
2018
|
return !1;
|
|
2002
2019
|
},
|
|
2003
|
-
|
|
2004
|
-
), [
|
|
2020
|
+
F
|
|
2021
|
+
), [t]), s && (o || r) && De(
|
|
2005
2022
|
/* @__PURE__ */ h(
|
|
2006
2023
|
Jn,
|
|
2007
2024
|
{
|
|
2008
|
-
selectionRectCoords:
|
|
2009
|
-
TOOLBAR_OFFSET:
|
|
2025
|
+
selectionRectCoords: s,
|
|
2026
|
+
TOOLBAR_OFFSET: n,
|
|
2010
2027
|
toolbarTriggerId: m,
|
|
2011
|
-
toolbarPopoverId:
|
|
2028
|
+
toolbarPopoverId: A
|
|
2012
2029
|
}
|
|
2013
2030
|
),
|
|
2014
2031
|
er
|
|
@@ -2020,305 +2037,309 @@ const nr = [
|
|
|
2020
2037
|
], rr = [
|
|
2021
2038
|
["$$", "$$"],
|
|
2022
2039
|
["\\[", "\\]"]
|
|
2023
|
-
],
|
|
2040
|
+
], nt = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), mt = (n, s) => {
|
|
2024
2041
|
let e = null;
|
|
2025
|
-
for (const [
|
|
2026
|
-
const
|
|
2027
|
-
`(.*?)(${
|
|
2042
|
+
for (const [t, o] of s) {
|
|
2043
|
+
const r = new RegExp(
|
|
2044
|
+
`(.*?)(${nt(t)})(.*?)(${nt(o)})`,
|
|
2028
2045
|
"g"
|
|
2029
|
-
).exec(
|
|
2030
|
-
if (
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2033
|
-
const u =
|
|
2046
|
+
).exec(n);
|
|
2047
|
+
if (r) {
|
|
2048
|
+
const a = r[3];
|
|
2049
|
+
if (a && a.trim() !== "") {
|
|
2050
|
+
const u = r.index + r[1].length, m = r.index + r[0].length;
|
|
2034
2051
|
(!e || u < e.start) && (e = {
|
|
2035
2052
|
start: u,
|
|
2036
2053
|
end: m,
|
|
2037
|
-
content:
|
|
2054
|
+
content: t + a + o
|
|
2038
2055
|
});
|
|
2039
2056
|
}
|
|
2040
2057
|
}
|
|
2041
2058
|
}
|
|
2042
2059
|
return e;
|
|
2043
|
-
}, pt = (
|
|
2044
|
-
if (!k(
|
|
2060
|
+
}, pt = (n, s) => {
|
|
2061
|
+
if (!k(n))
|
|
2045
2062
|
return null;
|
|
2046
|
-
const e =
|
|
2047
|
-
return !o || !
|
|
2048
|
-
}, bt = (
|
|
2063
|
+
const e = n.anchor.getNode(), t = n.focus.getNode(), o = s(e) ? e : I(e, s), i = s(t) ? t : I(t, s);
|
|
2064
|
+
return !o || !i ? null : o.getKey() === i.getKey() ? o : null;
|
|
2065
|
+
}, bt = (n) => n.getData("text/plain") || n.getData("text") || n.getData("text/uri-list");
|
|
2049
2066
|
function ir() {
|
|
2050
|
-
const [
|
|
2067
|
+
const [n] = M();
|
|
2051
2068
|
return b(() => {
|
|
2052
|
-
if (!
|
|
2069
|
+
if (!n.hasNodes([be, mn]))
|
|
2053
2070
|
throw new Error(
|
|
2054
2071
|
"MathInlinePlugin: MathNode or MathHighlightNodeInline not registered on editor"
|
|
2055
2072
|
);
|
|
2056
|
-
}, [
|
|
2073
|
+
}, [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2057
2074
|
if (!e.isSimpleText() || X(e) || I(e, W))
|
|
2058
2075
|
return;
|
|
2059
|
-
const
|
|
2076
|
+
const t = e.getTextContent(), o = mt(t, nr);
|
|
2060
2077
|
if (o) {
|
|
2061
|
-
const { start:
|
|
2078
|
+
const { start: i, end: r, content: a } = o;
|
|
2062
2079
|
let u;
|
|
2063
|
-
const m = U(
|
|
2064
|
-
return
|
|
2080
|
+
const m = U(a, !0);
|
|
2081
|
+
return i === 0 ? ([u] = e.splitText(r), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(i, r), u.replace(m)), m;
|
|
2065
2082
|
}
|
|
2066
|
-
}), [
|
|
2083
|
+
}), [n]), b(() => n.registerCommand(
|
|
2067
2084
|
Y,
|
|
2068
2085
|
() => {
|
|
2069
|
-
const e =
|
|
2070
|
-
if (
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2073
|
-
const
|
|
2074
|
-
if (
|
|
2075
|
-
let u =
|
|
2086
|
+
const e = $(), t = /* @__PURE__ */ new Set();
|
|
2087
|
+
if (pe(e)) {
|
|
2088
|
+
const r = e.getNodes();
|
|
2089
|
+
if (r.length === 1 && V(r[0]) && n.isEditable()) {
|
|
2090
|
+
const a = r[0];
|
|
2091
|
+
if (a.isInline()) {
|
|
2092
|
+
let u = a.getEquation();
|
|
2076
2093
|
u.startsWith("$") && u.endsWith("$") ? u = u.slice(1, -1) : u.startsWith("\\(") && u.endsWith("\\)") && (u = u.slice(2, -2));
|
|
2077
|
-
const m =
|
|
2078
|
-
return
|
|
2094
|
+
const m = Le(u);
|
|
2095
|
+
return a.replace(m), m.select(), !0;
|
|
2079
2096
|
}
|
|
2080
2097
|
}
|
|
2081
|
-
} else k(e) && e.getNodes().forEach((
|
|
2082
|
-
return
|
|
2083
|
-
if (X(
|
|
2084
|
-
let
|
|
2085
|
-
if (!
|
|
2086
|
-
|
|
2098
|
+
} else k(e) && e.getNodes().forEach((r) => t.add(r.getKey()));
|
|
2099
|
+
return me().getAllTextNodes().forEach((r) => {
|
|
2100
|
+
if (X(r) && !t.has(r.getKey())) {
|
|
2101
|
+
let a = r.getTextContent();
|
|
2102
|
+
if (!a) {
|
|
2103
|
+
r.remove();
|
|
2087
2104
|
return;
|
|
2088
2105
|
}
|
|
2089
2106
|
let u = !1;
|
|
2090
|
-
|
|
2091
|
-
const m = u ? U(`$$${
|
|
2092
|
-
|
|
2107
|
+
a.startsWith("$") && a.endsWith("$") && a.length >= 2 && (a = a.slice(1, -1), u = !0);
|
|
2108
|
+
const m = u ? U(`$$${a}$$`, !1) : U(`$${a}$`, !0);
|
|
2109
|
+
r.replace(m);
|
|
2093
2110
|
}
|
|
2094
2111
|
}), !1;
|
|
2095
2112
|
},
|
|
2096
|
-
|
|
2097
|
-
), [
|
|
2098
|
-
|
|
2099
|
-
() => (
|
|
2100
|
-
|
|
2101
|
-
if (X(
|
|
2102
|
-
let o =
|
|
2113
|
+
F
|
|
2114
|
+
), [n]), b(() => n.registerCommand(
|
|
2115
|
+
ae,
|
|
2116
|
+
() => (n.update(() => {
|
|
2117
|
+
me().getAllTextNodes().forEach((t) => {
|
|
2118
|
+
if (X(t)) {
|
|
2119
|
+
let o = t.getTextContent();
|
|
2103
2120
|
if (!o) {
|
|
2104
|
-
|
|
2121
|
+
t.remove();
|
|
2105
2122
|
return;
|
|
2106
2123
|
}
|
|
2107
|
-
let
|
|
2108
|
-
o.startsWith("$") && o.endsWith("$") && o.length >= 2 && (o = o.slice(1, -1),
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2124
|
+
let i = !1;
|
|
2125
|
+
o.startsWith("$") && o.endsWith("$") && o.length >= 2 && (o = o.slice(1, -1), i = !0);
|
|
2126
|
+
const r = i ? U(`$$${o}$$`, !1) : U(`$${o}$`, !0);
|
|
2127
|
+
t.replace(r), Pe(null);
|
|
2111
2128
|
}
|
|
2112
2129
|
});
|
|
2113
2130
|
}), !1),
|
|
2114
|
-
|
|
2115
|
-
), [
|
|
2131
|
+
F
|
|
2132
|
+
), [n]), b(() => n.registerCommand(
|
|
2116
2133
|
Ft,
|
|
2117
|
-
(
|
|
2118
|
-
const e =
|
|
2134
|
+
(s) => {
|
|
2135
|
+
const e = $();
|
|
2119
2136
|
if (!k(e) || !e.isCollapsed())
|
|
2120
2137
|
return !1;
|
|
2121
|
-
const
|
|
2122
|
-
if (V(
|
|
2123
|
-
let
|
|
2124
|
-
|
|
2125
|
-
const
|
|
2126
|
-
return
|
|
2138
|
+
const t = we(e.anchor, !1);
|
|
2139
|
+
if (V(t) && t.isInline()) {
|
|
2140
|
+
let i = t.getEquation();
|
|
2141
|
+
i.startsWith("$") && i.endsWith("$") ? i = i.slice(1, -1) : i.startsWith("\\(") && i.endsWith("\\)") && (i = i.slice(2, -2));
|
|
2142
|
+
const r = Le(i);
|
|
2143
|
+
return t.replace(r), r.select(0, 0), !0;
|
|
2127
2144
|
}
|
|
2128
2145
|
return !1;
|
|
2129
2146
|
},
|
|
2130
|
-
|
|
2131
|
-
), [
|
|
2132
|
-
|
|
2133
|
-
(
|
|
2134
|
-
const e =
|
|
2147
|
+
F
|
|
2148
|
+
), [n]), b(() => n.registerCommand(
|
|
2149
|
+
Oe,
|
|
2150
|
+
(s) => {
|
|
2151
|
+
const e = $();
|
|
2135
2152
|
if (!k(e) || !e.isCollapsed())
|
|
2136
2153
|
return !1;
|
|
2137
|
-
const
|
|
2138
|
-
if (V(
|
|
2139
|
-
let
|
|
2140
|
-
|
|
2141
|
-
const
|
|
2142
|
-
return
|
|
2154
|
+
const t = we(e.anchor, !0);
|
|
2155
|
+
if (V(t) && t.isInline()) {
|
|
2156
|
+
let i = t.getEquation();
|
|
2157
|
+
i.startsWith("$") && i.endsWith("$") ? i = i.slice(1, -1) : i.startsWith("\\(") && i.endsWith("\\)") && (i = i.slice(2, -2));
|
|
2158
|
+
const r = Le(i);
|
|
2159
|
+
return t.replace(r), r.select(), !0;
|
|
2143
2160
|
}
|
|
2144
2161
|
return !1;
|
|
2145
2162
|
},
|
|
2146
|
-
|
|
2147
|
-
), [
|
|
2148
|
-
|
|
2149
|
-
(
|
|
2150
|
-
const e =
|
|
2163
|
+
F
|
|
2164
|
+
), [n]), b(() => n.registerCommand(
|
|
2165
|
+
_e,
|
|
2166
|
+
(s) => {
|
|
2167
|
+
const e = s.clipboardData;
|
|
2151
2168
|
if (!e)
|
|
2152
2169
|
return !1;
|
|
2153
|
-
const
|
|
2170
|
+
const t = $();
|
|
2154
2171
|
if (!pt(
|
|
2155
|
-
|
|
2172
|
+
t,
|
|
2156
2173
|
X
|
|
2157
2174
|
))
|
|
2158
2175
|
return !1;
|
|
2159
|
-
const
|
|
2160
|
-
return
|
|
2176
|
+
const i = bt(e);
|
|
2177
|
+
return i ? (s.preventDefault(), t.insertText(i), !0) : !1;
|
|
2161
2178
|
},
|
|
2162
|
-
|
|
2163
|
-
), [
|
|
2179
|
+
F
|
|
2180
|
+
), [n]), b(() => n.registerCommand(
|
|
2164
2181
|
Y,
|
|
2165
2182
|
() => {
|
|
2166
|
-
const
|
|
2167
|
-
if (!k(
|
|
2183
|
+
const s = $();
|
|
2184
|
+
if (!k(s) || !s.isCollapsed())
|
|
2168
2185
|
return !1;
|
|
2169
|
-
const e =
|
|
2186
|
+
const e = s.anchor.getNode();
|
|
2170
2187
|
return X(e) && (e.getNextSibling() || e.insertAfter(kt(" "))), !1;
|
|
2171
2188
|
},
|
|
2172
2189
|
wt
|
|
2173
|
-
), [
|
|
2190
|
+
), [n]), // Register click event for MathNode
|
|
2174
2191
|
/* @__PURE__ */ h(
|
|
2175
|
-
|
|
2192
|
+
He,
|
|
2176
2193
|
{
|
|
2177
|
-
nodeType:
|
|
2194
|
+
nodeType: be,
|
|
2178
2195
|
eventType: "click",
|
|
2179
|
-
eventListener: (
|
|
2180
|
-
|
|
2196
|
+
eventListener: (s, e, t) => {
|
|
2197
|
+
if (!e.isEditable())
|
|
2198
|
+
return;
|
|
2199
|
+
const o = j(t);
|
|
2181
2200
|
o && o.isInline() && o.select();
|
|
2182
2201
|
}
|
|
2183
2202
|
}
|
|
2184
2203
|
);
|
|
2185
2204
|
}
|
|
2186
2205
|
function or() {
|
|
2187
|
-
const [
|
|
2206
|
+
const [n] = M();
|
|
2188
2207
|
return b(() => {
|
|
2189
|
-
if (!
|
|
2208
|
+
if (!n.hasNodes([be, pn]))
|
|
2190
2209
|
throw new Error(
|
|
2191
2210
|
"MathBlockPlugin: MathNode or MathHighlightNodeBlock not registered on editor"
|
|
2192
2211
|
);
|
|
2193
|
-
}, [
|
|
2212
|
+
}, [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2194
2213
|
if (!e.isSimpleText() || I(e, W))
|
|
2195
2214
|
return;
|
|
2196
|
-
const
|
|
2197
|
-
if (
|
|
2198
|
-
const
|
|
2199
|
-
if (
|
|
2200
|
-
if (
|
|
2215
|
+
const t = e.getTextContent();
|
|
2216
|
+
if (t.startsWith("$$ ")) {
|
|
2217
|
+
const i = e.getPreviousSibling(), r = I(e, J), a = r !== null && r.getChildrenSize() === 1, u = ie(i);
|
|
2218
|
+
if (a || u) {
|
|
2219
|
+
if (t.length > 3)
|
|
2201
2220
|
return;
|
|
2202
2221
|
const m = Se("");
|
|
2203
2222
|
e.replace(m), m.select();
|
|
2204
|
-
const
|
|
2205
|
-
ie(
|
|
2223
|
+
const A = m.getNextSibling();
|
|
2224
|
+
ie(A) && A.remove();
|
|
2206
2225
|
return;
|
|
2207
2226
|
}
|
|
2208
2227
|
}
|
|
2209
|
-
const o = mt(
|
|
2228
|
+
const o = mt(t, rr);
|
|
2210
2229
|
if (o) {
|
|
2211
|
-
const { start:
|
|
2230
|
+
const { start: i, end: r, content: a } = o;
|
|
2212
2231
|
let u;
|
|
2213
|
-
const m = U(
|
|
2214
|
-
return
|
|
2232
|
+
const m = U(a, !1);
|
|
2233
|
+
return i === 0 ? ([u] = e.splitText(r), u.insertBefore(m), u.remove()) : ([, u] = e.splitText(i, r), u.replace(m)), m;
|
|
2215
2234
|
}
|
|
2216
|
-
}), [
|
|
2235
|
+
}), [n]), b(() => n.registerCommand(
|
|
2217
2236
|
Y,
|
|
2218
2237
|
() => {
|
|
2219
|
-
const e =
|
|
2220
|
-
if (
|
|
2221
|
-
const
|
|
2222
|
-
if (
|
|
2223
|
-
const
|
|
2224
|
-
if (!
|
|
2225
|
-
let u =
|
|
2238
|
+
const e = $(), t = /* @__PURE__ */ new Set();
|
|
2239
|
+
if (pe(e)) {
|
|
2240
|
+
const r = e.getNodes();
|
|
2241
|
+
if (r.length === 1 && V(r[0]) && n.isEditable()) {
|
|
2242
|
+
const a = r[0];
|
|
2243
|
+
if (!a.isInline()) {
|
|
2244
|
+
let u = a.getEquation();
|
|
2226
2245
|
(u.startsWith("$$") && u.endsWith("$$") || u.startsWith("\\[") && u.endsWith("\\]")) && (u = u.slice(2, -2));
|
|
2227
2246
|
const m = Se(u);
|
|
2228
|
-
return
|
|
2247
|
+
return a.replace(m), m.select(), !0;
|
|
2229
2248
|
}
|
|
2230
2249
|
}
|
|
2231
|
-
} else k(e) && e.getNodes().forEach((
|
|
2232
|
-
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2250
|
+
} else k(e) && e.getNodes().forEach((r) => {
|
|
2251
|
+
t.add(r.getKey());
|
|
2252
|
+
const a = I(r, W);
|
|
2253
|
+
a && t.add(a.getKey());
|
|
2235
2254
|
});
|
|
2236
|
-
const
|
|
2237
|
-
for (const [,
|
|
2238
|
-
if (W(
|
|
2239
|
-
const
|
|
2240
|
-
if (!
|
|
2241
|
-
|
|
2255
|
+
const i = n.getEditorState()._nodeMap;
|
|
2256
|
+
for (const [, r] of i)
|
|
2257
|
+
if (W(r) && r.isAttached() && !t.has(r.getKey())) {
|
|
2258
|
+
const a = r.getTextContent();
|
|
2259
|
+
if (!a) {
|
|
2260
|
+
r.remove();
|
|
2242
2261
|
continue;
|
|
2243
2262
|
}
|
|
2244
|
-
const u = U(`$$${
|
|
2245
|
-
|
|
2263
|
+
const u = U(`$$${a}$$`, !1);
|
|
2264
|
+
r.replace(u);
|
|
2246
2265
|
}
|
|
2247
2266
|
return !1;
|
|
2248
2267
|
},
|
|
2249
|
-
|
|
2250
|
-
), [
|
|
2251
|
-
|
|
2252
|
-
() => (
|
|
2253
|
-
const
|
|
2254
|
-
Bt(
|
|
2255
|
-
if (W(
|
|
2256
|
-
const o =
|
|
2268
|
+
F
|
|
2269
|
+
), [n]), b(() => n.registerCommand(
|
|
2270
|
+
ae,
|
|
2271
|
+
() => (n.update(() => {
|
|
2272
|
+
const s = me();
|
|
2273
|
+
Bt(s).forEach(({ node: t }) => {
|
|
2274
|
+
if (W(t)) {
|
|
2275
|
+
const o = t.getTextContent();
|
|
2257
2276
|
if (!o) {
|
|
2258
|
-
|
|
2277
|
+
t.remove();
|
|
2259
2278
|
return;
|
|
2260
2279
|
}
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2280
|
+
const i = U(`$$${o}$$`, !1);
|
|
2281
|
+
t.replace(i), Pe(null);
|
|
2263
2282
|
}
|
|
2264
2283
|
});
|
|
2265
2284
|
}), !1),
|
|
2266
|
-
|
|
2267
|
-
), [
|
|
2285
|
+
F
|
|
2286
|
+
), [n]), b(() => n.registerCommand(
|
|
2268
2287
|
It,
|
|
2269
2288
|
() => {
|
|
2270
|
-
const e =
|
|
2289
|
+
const e = $();
|
|
2271
2290
|
if (!k(e))
|
|
2272
2291
|
return !1;
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2292
|
+
const t = e.getNodes()[0], o = I(
|
|
2293
|
+
t,
|
|
2275
2294
|
W
|
|
2276
2295
|
);
|
|
2277
2296
|
if (!o)
|
|
2278
2297
|
return !1;
|
|
2279
|
-
const
|
|
2280
|
-
return e.isCollapsed() && (e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === 0 && o.getChildrenSize() === 0 ||
|
|
2298
|
+
const i = o.getLastChild();
|
|
2299
|
+
return e.isCollapsed() && (e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === 0 && o.getChildrenSize() === 0 || i && ie(i) && e.anchor.getNode().getKey() === o.getKey() && e.anchor.offset === o.getChildrenSize() || i && Mt(i) && e.anchor.getNode().getKey() === i.getKey() && e.anchor.offset === i.getTextContent().length) ? !1 : (e.insertLineBreak(), !0);
|
|
2281
2300
|
},
|
|
2282
|
-
|
|
2283
|
-
), [
|
|
2284
|
-
|
|
2285
|
-
(
|
|
2286
|
-
const e =
|
|
2301
|
+
F
|
|
2302
|
+
), [n]), b(() => n.registerCommand(
|
|
2303
|
+
Oe,
|
|
2304
|
+
(s) => {
|
|
2305
|
+
const e = $();
|
|
2287
2306
|
if (!k(e) || !e.isCollapsed())
|
|
2288
2307
|
return !1;
|
|
2289
|
-
const
|
|
2290
|
-
if (V(
|
|
2291
|
-
let
|
|
2292
|
-
(
|
|
2293
|
-
const
|
|
2294
|
-
return
|
|
2308
|
+
const t = we(e.anchor, !0);
|
|
2309
|
+
if (V(t) && !t.isInline()) {
|
|
2310
|
+
let i = t.getEquation();
|
|
2311
|
+
(i.startsWith("$$") && i.endsWith("$$") || i.startsWith("\\[") && i.endsWith("\\]")) && (i = i.slice(2, -2));
|
|
2312
|
+
const r = Se(i);
|
|
2313
|
+
return t.replace(r), r.select(), !0;
|
|
2295
2314
|
}
|
|
2296
2315
|
return !1;
|
|
2297
2316
|
},
|
|
2298
|
-
|
|
2299
|
-
), [
|
|
2300
|
-
|
|
2301
|
-
(
|
|
2302
|
-
const e =
|
|
2317
|
+
F
|
|
2318
|
+
), [n]), b(() => n.registerCommand(
|
|
2319
|
+
_e,
|
|
2320
|
+
(s) => {
|
|
2321
|
+
const e = s.clipboardData;
|
|
2303
2322
|
if (!e)
|
|
2304
2323
|
return !1;
|
|
2305
|
-
const
|
|
2324
|
+
const t = $();
|
|
2306
2325
|
if (!pt(
|
|
2307
|
-
|
|
2326
|
+
t,
|
|
2308
2327
|
W
|
|
2309
2328
|
))
|
|
2310
2329
|
return !1;
|
|
2311
|
-
const
|
|
2312
|
-
return
|
|
2330
|
+
const i = bt(e);
|
|
2331
|
+
return i ? (s.preventDefault(), t.insertRawText(i), !0) : !1;
|
|
2313
2332
|
},
|
|
2314
|
-
|
|
2315
|
-
), [
|
|
2316
|
-
|
|
2333
|
+
F
|
|
2334
|
+
), [n]), /* @__PURE__ */ h(
|
|
2335
|
+
He,
|
|
2317
2336
|
{
|
|
2318
|
-
nodeType:
|
|
2337
|
+
nodeType: be,
|
|
2319
2338
|
eventType: "click",
|
|
2320
|
-
eventListener: (
|
|
2321
|
-
|
|
2339
|
+
eventListener: (s, e, t) => {
|
|
2340
|
+
if (!e.isEditable())
|
|
2341
|
+
return;
|
|
2342
|
+
const o = j(t);
|
|
2322
2343
|
o && !o.isInline() && o.select();
|
|
2323
2344
|
}
|
|
2324
2345
|
}
|
|
@@ -2326,100 +2347,100 @@ function or() {
|
|
|
2326
2347
|
}
|
|
2327
2348
|
const sr = 3;
|
|
2328
2349
|
function ar() {
|
|
2329
|
-
const [
|
|
2330
|
-
return b(() =>
|
|
2350
|
+
const [n] = M();
|
|
2351
|
+
return b(() => n.registerNodeTransform(
|
|
2331
2352
|
Ot,
|
|
2332
2353
|
(e) => {
|
|
2333
|
-
const
|
|
2334
|
-
if (
|
|
2354
|
+
const t = e.getParent();
|
|
2355
|
+
if (qe(t)) {
|
|
2335
2356
|
const o = Pt();
|
|
2336
2357
|
e.replace(o), o.selectEnd();
|
|
2337
2358
|
}
|
|
2338
2359
|
}
|
|
2339
|
-
), [
|
|
2360
|
+
), [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2340
2361
|
if (!I(e, J) || I(e, J).getFirstDescendant() !== e)
|
|
2341
2362
|
return;
|
|
2342
|
-
const o =
|
|
2363
|
+
const o = $();
|
|
2343
2364
|
if (k(o) && o.isCollapsed()) {
|
|
2344
|
-
const
|
|
2345
|
-
e.getTextContent() === "1. " &&
|
|
2365
|
+
const r = o.anchor.offset;
|
|
2366
|
+
e.getTextContent() === "1. " && r === 3 ? (je("number"), e.setTextContent("")) : e.getTextContent() === "- " && r === 2 && (je("bullet"), e.setTextContent(""));
|
|
2346
2367
|
}
|
|
2347
|
-
}), [
|
|
2368
|
+
}), [n]), b(() => n.registerCommand(
|
|
2348
2369
|
_t,
|
|
2349
2370
|
(e) => {
|
|
2350
|
-
const
|
|
2351
|
-
if (!k(
|
|
2371
|
+
const t = $();
|
|
2372
|
+
if (!k(t))
|
|
2352
2373
|
return !1;
|
|
2353
|
-
const o =
|
|
2354
|
-
if (!
|
|
2374
|
+
const o = Ee(t), i = I(o, qe);
|
|
2375
|
+
if (!i)
|
|
2355
2376
|
return !1;
|
|
2356
|
-
const
|
|
2377
|
+
const r = i.getIndent();
|
|
2357
2378
|
if (e.shiftKey) {
|
|
2358
|
-
if (
|
|
2379
|
+
if (r <= 0)
|
|
2359
2380
|
return !1;
|
|
2360
|
-
|
|
2381
|
+
i.setIndent(r - 1);
|
|
2361
2382
|
} else {
|
|
2362
|
-
if (
|
|
2383
|
+
if (r > sr)
|
|
2363
2384
|
return !1;
|
|
2364
|
-
|
|
2385
|
+
i.setIndent(r + 1);
|
|
2365
2386
|
}
|
|
2366
2387
|
return !0;
|
|
2367
2388
|
},
|
|
2368
|
-
|
|
2369
|
-
), [
|
|
2389
|
+
F
|
|
2390
|
+
), [n]), null;
|
|
2370
2391
|
}
|
|
2371
2392
|
function lr() {
|
|
2372
|
-
const [
|
|
2393
|
+
const [n] = M(), s = (e) => {
|
|
2373
2394
|
e.key === "Tab" && e.preventDefault();
|
|
2374
2395
|
};
|
|
2375
|
-
return b(() =>
|
|
2376
|
-
(
|
|
2377
|
-
|
|
2396
|
+
return b(() => n.registerRootListener(
|
|
2397
|
+
(t, o) => {
|
|
2398
|
+
t && t.addEventListener("keydown", s), o && o.removeEventListener("keydown", s);
|
|
2378
2399
|
}
|
|
2379
|
-
), [
|
|
2400
|
+
), [n]), null;
|
|
2380
2401
|
}
|
|
2381
|
-
function cr({ editorRef:
|
|
2382
|
-
const [
|
|
2402
|
+
function cr({ editorRef: n }) {
|
|
2403
|
+
const [s] = M();
|
|
2383
2404
|
return b(() => {
|
|
2384
|
-
if (
|
|
2385
|
-
return
|
|
2386
|
-
|
|
2405
|
+
if (n)
|
|
2406
|
+
return n.current = s, () => {
|
|
2407
|
+
n && (n.current = null);
|
|
2387
2408
|
};
|
|
2388
|
-
}, [
|
|
2409
|
+
}, [s, n]), null;
|
|
2389
2410
|
}
|
|
2390
2411
|
function Or({
|
|
2391
|
-
initialConfig:
|
|
2392
|
-
onChange:
|
|
2412
|
+
initialConfig: n,
|
|
2413
|
+
onChange: s,
|
|
2393
2414
|
editorRef: e,
|
|
2394
|
-
blockToolbarGap:
|
|
2415
|
+
blockToolbarGap: t,
|
|
2395
2416
|
spellCheck: o,
|
|
2396
|
-
isHeadingOneFirst:
|
|
2397
|
-
onImageUpload:
|
|
2417
|
+
isHeadingOneFirst: i,
|
|
2418
|
+
onImageUpload: r
|
|
2398
2419
|
}) {
|
|
2399
|
-
return /* @__PURE__ */ D(xt, { initialConfig:
|
|
2420
|
+
return /* @__PURE__ */ D(xt, { initialConfig: n, children: [
|
|
2400
2421
|
/* @__PURE__ */ h(
|
|
2401
2422
|
Tt,
|
|
2402
2423
|
{
|
|
2403
|
-
contentEditable: /* @__PURE__ */ h(
|
|
2404
|
-
ErrorBoundary:
|
|
2424
|
+
contentEditable: /* @__PURE__ */ h(En, { spellCheck: o, className: "editor-input" }),
|
|
2425
|
+
ErrorBoundary: Lt
|
|
2405
2426
|
}
|
|
2406
2427
|
),
|
|
2407
|
-
/* @__PURE__ */ h(Pn, { isHeadingOneFirst:
|
|
2428
|
+
/* @__PURE__ */ h(Pn, { isHeadingOneFirst: i }),
|
|
2408
2429
|
/* @__PURE__ */ h(Rn, {}),
|
|
2409
|
-
/* @__PURE__ */ h(tr, { toolbarGap:
|
|
2410
|
-
/* @__PURE__ */ h(
|
|
2430
|
+
/* @__PURE__ */ h(tr, { toolbarGap: t }),
|
|
2431
|
+
/* @__PURE__ */ h(Nt, {}),
|
|
2411
2432
|
/* @__PURE__ */ h(At, {}),
|
|
2412
2433
|
/* @__PURE__ */ h(ir, {}),
|
|
2413
2434
|
/* @__PURE__ */ h(or, {}),
|
|
2414
2435
|
/* @__PURE__ */ h(Zn, {}),
|
|
2415
2436
|
/* @__PURE__ */ h(Qn, {}),
|
|
2416
|
-
/* @__PURE__ */ h(Xn, { onImageUpload:
|
|
2437
|
+
/* @__PURE__ */ h(Xn, { onImageUpload: r }),
|
|
2417
2438
|
/* @__PURE__ */ h(Cn, {}),
|
|
2418
2439
|
/* @__PURE__ */ h(ar, {}),
|
|
2419
2440
|
/* @__PURE__ */ h(lr, {}),
|
|
2420
|
-
/* @__PURE__ */ h(yn, { onChange:
|
|
2441
|
+
/* @__PURE__ */ h(yn, { onChange: s }),
|
|
2421
2442
|
/* @__PURE__ */ h(cr, { editorRef: e }),
|
|
2422
|
-
/* @__PURE__ */ h(
|
|
2443
|
+
/* @__PURE__ */ h(Nn, {})
|
|
2423
2444
|
] });
|
|
2424
2445
|
}
|
|
2425
2446
|
export {
|