lexical-medium-editor 1.2.18 → 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/{ImageNode-BhH71HMX.js → ImageNode-Cqkp_4Y6.js} +92 -71
- package/dist-lib/ImageNode-Cqkp_4Y6.js.map +1 -0
- package/dist-lib/editorConfig.es.js +3 -3
- package/dist-lib/index.es.js +982 -948
- package/dist-lib/index.es.js.map +1 -1
- package/dist-lib/lexical-medium-editor.css +1 -1
- package/package.json +1 -1
- package/dist-lib/ImageNode-BhH71HMX.js.map +0 -1
package/dist-lib/index.es.js
CHANGED
|
@@ -1,245 +1,245 @@
|
|
|
1
1
|
import './lexical-medium-editor.css';
|
|
2
|
-
import { jsxs as D, Fragment as
|
|
3
|
-
import { AutoFocusPlugin as
|
|
4
|
-
import { LexicalComposer as
|
|
5
|
-
import { RichTextPlugin as
|
|
6
|
-
import { HistoryPlugin as
|
|
7
|
-
import { LexicalErrorBoundary 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
|
+
import { LexicalComposer as xt } from "@lexical/react/LexicalComposer";
|
|
5
|
+
import { RichTextPlugin as Tt } from "@lexical/react/LexicalRichTextPlugin";
|
|
6
|
+
import { HistoryPlugin as At } from "@lexical/react/LexicalHistoryPlugin";
|
|
7
|
+
import { LexicalErrorBoundary as Lt } from "@lexical/react/LexicalErrorBoundary";
|
|
8
8
|
import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
|
|
9
|
-
import { createCommand as
|
|
10
|
-
import { useEffect as
|
|
11
|
-
import { createPortal as
|
|
12
|
-
import { $findMatchingParent as I, $dfs as
|
|
13
|
-
import { Toolbar as
|
|
14
|
-
import { IconCheck as
|
|
15
|
-
import { $isAtNodeEnd as
|
|
16
|
-
import { $createHeadingNode as
|
|
17
|
-
import { $toggleLink as
|
|
18
|
-
import { $isListNode as
|
|
19
|
-
import { $ as
|
|
20
|
-
import { $isCodeNode as
|
|
21
|
-
import { NodeEventPlugin as
|
|
22
|
-
import { ListPlugin as
|
|
23
|
-
import { OnChangePlugin as
|
|
24
|
-
import { ContentEditable as
|
|
25
|
-
import { ClearEditorPlugin 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
|
+
import { $findMatchingParent as I, $dfs as Bt } from "@lexical/utils";
|
|
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
|
+
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 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
|
+
import { $toggleLink as cn, $isLinkNode as un } from "@lexical/link";
|
|
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
|
+
import { ListPlugin as Cn } from "@lexical/react/LexicalListPlugin";
|
|
23
|
+
import { OnChangePlugin as yn } from "@lexical/react/LexicalOnChangePlugin";
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
const
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
return
|
|
72
|
+
const lt = Z("TOGGLE_HEADING_COMMAND"), ct = Z("TOGGLE_QUOTE_COMMAND"), ut = Z("TOGGLE_LINK_COMMAND");
|
|
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
|
-
function
|
|
103
|
-
const [
|
|
104
|
-
return
|
|
105
|
-
|
|
102
|
+
function $n() {
|
|
103
|
+
const [n] = M();
|
|
104
|
+
return b(() => n.registerCommand(
|
|
105
|
+
lt,
|
|
106
106
|
(e) => {
|
|
107
|
-
const { isHeadingOne:
|
|
108
|
-
if (
|
|
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
|
-
function
|
|
121
|
-
const [
|
|
122
|
-
return
|
|
123
|
-
const
|
|
124
|
-
|
|
120
|
+
function Fn() {
|
|
121
|
+
const [n] = M();
|
|
122
|
+
return b(() => {
|
|
123
|
+
const s = n.registerNodeTransform(
|
|
124
|
+
sn,
|
|
125
125
|
(e) => {
|
|
126
126
|
if (e.getTag() !== "h2")
|
|
127
127
|
return;
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
128
|
+
const o = me().getFirstChild();
|
|
129
|
+
if (o !== null && e.is(o)) {
|
|
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
|
|
141
|
-
return I(
|
|
140
|
+
function kn(n) {
|
|
141
|
+
return I(n, ln);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
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
|
-
function
|
|
148
|
-
const [
|
|
149
|
-
return
|
|
150
|
-
|
|
147
|
+
function In() {
|
|
148
|
+
const [n] = M();
|
|
149
|
+
return b(() => n.registerCommand(
|
|
150
|
+
ct,
|
|
151
151
|
(e) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
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
|
|
162
|
-
if (!
|
|
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
|
-
function
|
|
168
|
-
const [
|
|
169
|
-
return
|
|
170
|
-
|
|
167
|
+
function Mn() {
|
|
168
|
+
const [n] = M();
|
|
169
|
+
return b(() => n.registerCommand(
|
|
170
|
+
St,
|
|
171
171
|
(e) => {
|
|
172
|
-
const
|
|
173
|
-
return
|
|
172
|
+
const t = $(), o = dt(t);
|
|
173
|
+
return o && (e.metaKey || e.ctrlKey) ? (window.open(o.getURL(), "_blank"), !0) : !1;
|
|
174
174
|
},
|
|
175
|
-
|
|
176
|
-
), [
|
|
177
|
-
|
|
178
|
-
(e) => (
|
|
179
|
-
|
|
180
|
-
), [
|
|
175
|
+
ke
|
|
176
|
+
), [n]), b(() => n.registerCommand(
|
|
177
|
+
ut,
|
|
178
|
+
(e) => (cn(e), !0),
|
|
179
|
+
F
|
|
180
|
+
), [n]), null;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
(
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
182
|
+
function On() {
|
|
183
|
+
const [n] = M(), s = "heading-above";
|
|
184
|
+
return b(() => n.registerNodeTransform(
|
|
185
|
+
se,
|
|
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
|
|
199
|
-
return /* @__PURE__ */ D(
|
|
200
|
-
/* @__PURE__ */ h(
|
|
201
|
-
|
|
202
|
-
/* @__PURE__ */ h(
|
|
203
|
-
/* @__PURE__ */ h(
|
|
204
|
-
/* @__PURE__ */ h(
|
|
198
|
+
function Pn({ isHeadingOneFirst: n }) {
|
|
199
|
+
return /* @__PURE__ */ D(rt, { children: [
|
|
200
|
+
/* @__PURE__ */ h($n, {}),
|
|
201
|
+
n && /* @__PURE__ */ h(Fn, {}),
|
|
202
|
+
/* @__PURE__ */ h(In, {}),
|
|
203
|
+
/* @__PURE__ */ h(Mn, {}),
|
|
204
|
+
/* @__PURE__ */ h(On, {})
|
|
205
205
|
] });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
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
|
-
defaultValue:
|
|
216
|
-
onChange:
|
|
217
|
-
children: /* @__PURE__ */ h(
|
|
215
|
+
defaultValue: o,
|
|
216
|
+
onChange: i,
|
|
217
|
+
children: /* @__PURE__ */ h(it, { placeholder: "Enter Link" })
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
|
-
/* @__PURE__ */ D(
|
|
220
|
+
/* @__PURE__ */ D(oe, { "aria-label": "edit link", children: [
|
|
221
221
|
/* @__PURE__ */ h(
|
|
222
|
-
|
|
222
|
+
q,
|
|
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
|
-
children: /* @__PURE__ */ h(
|
|
229
|
+
children: /* @__PURE__ */ h(Ut, { size: K })
|
|
230
230
|
}
|
|
231
231
|
),
|
|
232
|
-
/* @__PURE__ */ h(
|
|
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
|
-
const K = 24,
|
|
238
|
-
function
|
|
239
|
-
const [
|
|
237
|
+
const K = 24, Dn = 16;
|
|
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,76 +247,76 @@ function Pn({ editor: t }) {
|
|
|
247
247
|
isHeadingTwo: !1,
|
|
248
248
|
isHeadingThree: !1,
|
|
249
249
|
isQuote: !1
|
|
250
|
-
}), [u, m] = O(!1), [A,
|
|
251
|
-
if (
|
|
252
|
-
|
|
250
|
+
}), [u, m] = O(!1), [A, L] = O(0), [S, T] = O(""), E = (p) => {
|
|
251
|
+
if (k(p)) {
|
|
252
|
+
a({
|
|
253
253
|
isBold: p.hasFormat("bold"),
|
|
254
254
|
isItalic: p.hasFormat("italic"),
|
|
255
255
|
isCode: p.hasFormat("code"),
|
|
256
|
-
isQuote:
|
|
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
|
-
const
|
|
264
|
-
|
|
263
|
+
const x = dt(p);
|
|
264
|
+
T(x ? x.getURL() : "");
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
const p =
|
|
270
|
-
|
|
267
|
+
return b(() => {
|
|
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
|
|
276
|
-
|
|
275
|
+
const x = $();
|
|
276
|
+
E(x);
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
), [
|
|
280
|
-
|
|
281
|
-
const p =
|
|
282
|
-
if (
|
|
283
|
-
const [y,
|
|
279
|
+
), [n]), b(() => {
|
|
280
|
+
n.read(() => {
|
|
281
|
+
const p = $();
|
|
282
|
+
if (k(p)) {
|
|
283
|
+
const [y, x] = p.getStartEndPoints(), [l, c] = [
|
|
284
284
|
y.getNode(),
|
|
285
|
-
|
|
286
|
-
], [d, g] =
|
|
287
|
-
|
|
285
|
+
x.getNode()
|
|
286
|
+
], [d, g] = $t(p), f = on(
|
|
287
|
+
n,
|
|
288
288
|
l,
|
|
289
289
|
d,
|
|
290
290
|
c,
|
|
291
291
|
g
|
|
292
292
|
);
|
|
293
|
-
e(
|
|
293
|
+
e(Tn(f));
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
-
}, [
|
|
296
|
+
}, [n, r]), b(() => {
|
|
297
297
|
var p;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
s ? (o(
|
|
299
|
+
xn(
|
|
300
|
+
s,
|
|
301
|
+
i,
|
|
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
|
-
}, [
|
|
314
|
-
|
|
313
|
+
}, [s]), s && (u ? /* @__PURE__ */ h(
|
|
314
|
+
_n,
|
|
315
315
|
{
|
|
316
316
|
style: {
|
|
317
317
|
position: "absolute",
|
|
318
|
-
top:
|
|
319
|
-
left:
|
|
318
|
+
top: t.y,
|
|
319
|
+
left: t.x,
|
|
320
320
|
width: A
|
|
321
321
|
},
|
|
322
322
|
closeToolbar: () => {
|
|
@@ -325,77 +325,77 @@ function Pn({ 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
|
-
/* @__PURE__ */ D(
|
|
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: () =>
|
|
347
|
-
children: /* @__PURE__ */ h(
|
|
344
|
+
isSelected: r.isBold,
|
|
345
|
+
isDisabled: r.isCode || r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
|
|
346
|
+
onChange: () => n.dispatchCommand(Ae, "bold"),
|
|
347
|
+
children: /* @__PURE__ */ h(jt, { size: K })
|
|
348
348
|
}
|
|
349
349
|
),
|
|
350
350
|
/* @__PURE__ */ h(
|
|
351
|
-
|
|
351
|
+
ne,
|
|
352
352
|
{
|
|
353
353
|
"aria-label": "Italic",
|
|
354
|
-
isSelected:
|
|
355
|
-
isDisabled:
|
|
356
|
-
onChange: () =>
|
|
357
|
-
children: /* @__PURE__ */ h(
|
|
354
|
+
isSelected: r.isItalic,
|
|
355
|
+
isDisabled: r.isCode || r.isHeadingOne,
|
|
356
|
+
onChange: () => n.dispatchCommand(Ae, "italic"),
|
|
357
|
+
children: /* @__PURE__ */ h(Yt, { size: K })
|
|
358
358
|
}
|
|
359
359
|
),
|
|
360
360
|
/* @__PURE__ */ h(
|
|
361
|
-
|
|
361
|
+
ne,
|
|
362
362
|
{
|
|
363
363
|
"aria-label": "inline-code",
|
|
364
|
-
isDisabled:
|
|
365
|
-
isSelected:
|
|
366
|
-
onChange: () =>
|
|
367
|
-
children: /* @__PURE__ */ h(
|
|
364
|
+
isDisabled: r.isHeadingOne,
|
|
365
|
+
isSelected: r.isCode,
|
|
366
|
+
onChange: () => n.dispatchCommand(Ae, "code"),
|
|
367
|
+
children: /* @__PURE__ */ h(Zt, { size: K })
|
|
368
368
|
}
|
|
369
369
|
)
|
|
370
370
|
] }),
|
|
371
|
-
/* @__PURE__ */ h(
|
|
372
|
-
/* @__PURE__ */ D(
|
|
371
|
+
/* @__PURE__ */ h(Ke, { orientation: "vertical" }),
|
|
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: () =>
|
|
379
|
-
children: /* @__PURE__ */ h(
|
|
377
|
+
isSelected: r.isHeadingOne || r.isHeadingTwo || r.isHeadingThree,
|
|
378
|
+
onChange: () => n.dispatchCommand(lt, r),
|
|
379
|
+
children: /* @__PURE__ */ h(Qt, { size: K })
|
|
380
380
|
}
|
|
381
381
|
),
|
|
382
382
|
/* @__PURE__ */ h(
|
|
383
|
-
|
|
383
|
+
ne,
|
|
384
384
|
{
|
|
385
385
|
"aria-label": "Quote",
|
|
386
|
-
isSelected:
|
|
387
|
-
onChange: () =>
|
|
388
|
-
children: /* @__PURE__ */ h(
|
|
386
|
+
isSelected: r.isQuote,
|
|
387
|
+
onChange: () => n.dispatchCommand(ct, r),
|
|
388
|
+
children: /* @__PURE__ */ h(Xt, { size: K })
|
|
389
389
|
}
|
|
390
390
|
)
|
|
391
391
|
] }),
|
|
392
|
-
/* @__PURE__ */ h(
|
|
393
|
-
/* @__PURE__ */ h(
|
|
394
|
-
|
|
392
|
+
/* @__PURE__ */ h(Ke, { orientation: "vertical" }),
|
|
393
|
+
/* @__PURE__ */ h(oe, { "aria-label": "Links", children: /* @__PURE__ */ h(
|
|
394
|
+
q,
|
|
395
395
|
{
|
|
396
396
|
onPress: () => m(!0),
|
|
397
|
-
isDisabled:
|
|
398
|
-
children: /* @__PURE__ */ h(
|
|
397
|
+
isDisabled: r.isHeadingOne,
|
|
398
|
+
children: /* @__PURE__ */ h(Vt, { size: K })
|
|
399
399
|
}
|
|
400
400
|
) }),
|
|
401
401
|
/* @__PURE__ */ h("div", { className: "inline-toolbar-pointer" })
|
|
@@ -403,38 +403,42 @@ function Pn({ editor: t }) {
|
|
|
403
403
|
}
|
|
404
404
|
));
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
function
|
|
408
|
-
const [
|
|
409
|
-
return
|
|
410
|
-
|
|
406
|
+
const Hn = document.body;
|
|
407
|
+
function Rn() {
|
|
408
|
+
const [n, s] = O(!1), [e] = M();
|
|
409
|
+
return b(() => e.registerEditableListener((t) => {
|
|
410
|
+
t || s(!1);
|
|
411
|
+
}), [e]), b(() => e.registerCommand(
|
|
412
|
+
Y,
|
|
411
413
|
() => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
(
|
|
414
|
+
if (!e.isEditable())
|
|
415
|
+
return s(!1), !1;
|
|
416
|
+
const o = $();
|
|
417
|
+
if (!k(o) || o.isCollapsed())
|
|
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
|
-
|
|
421
|
-
), [e]),
|
|
422
|
-
|
|
424
|
+
F
|
|
425
|
+
), [e]), b(() => e.registerCommand(
|
|
426
|
+
ae,
|
|
423
427
|
() => (setTimeout(() => {
|
|
424
|
-
const
|
|
425
|
-
|
|
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
|
|
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
|
|
435
|
-
function
|
|
436
|
-
return
|
|
437
|
-
var
|
|
438
|
+
var Fe = { exports: {} }, Ve;
|
|
439
|
+
function Gn() {
|
|
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 Hn() {
|
|
|
443
447
|
* @namespace
|
|
444
448
|
* @public
|
|
445
449
|
*/
|
|
446
|
-
var e = function(
|
|
447
|
-
var
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
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,23 +547,23 @@ function Hn() {
|
|
|
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;
|
|
552
|
-
for (var
|
|
553
|
-
c.hasOwnProperty(
|
|
556
|
+
for (var C in c)
|
|
557
|
+
c.hasOwnProperty(C) && (g[C] = l(c[C], d));
|
|
554
558
|
return (
|
|
555
559
|
/** @type {any} */
|
|
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[
|
|
565
|
+
c.forEach(function(N, v) {
|
|
566
|
+
g[v] = l(N, d);
|
|
563
567
|
}), /** @type {any} */
|
|
564
568
|
g);
|
|
565
569
|
default:
|
|
@@ -576,7 +580,7 @@ function Hn() {
|
|
|
576
580
|
*/
|
|
577
581
|
getLanguage: function(l) {
|
|
578
582
|
for (; l; ) {
|
|
579
|
-
var c =
|
|
583
|
+
var c = o.exec(l.className);
|
|
580
584
|
if (c)
|
|
581
585
|
return c[1].toLowerCase();
|
|
582
586
|
l = l.parentElement;
|
|
@@ -591,7 +595,7 @@ function Hn() {
|
|
|
591
595
|
* @returns {void}
|
|
592
596
|
*/
|
|
593
597
|
setLanguage: function(l, c) {
|
|
594
|
-
l.className = l.className.replace(RegExp(
|
|
598
|
+
l.className = l.className.replace(RegExp(o, "gi"), ""), l.classList.add("language-" + c);
|
|
595
599
|
},
|
|
596
600
|
/**
|
|
597
601
|
* Returns the script element that is currently executing.
|
|
@@ -663,10 +667,10 @@ function Hn() {
|
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
778
782
|
*/
|
|
779
783
|
insertBefore: function(l, c, d, g) {
|
|
780
784
|
g = g || /** @type {any} */
|
|
781
|
-
|
|
782
|
-
var f = g[l],
|
|
783
|
-
for (var
|
|
784
|
-
if (f.hasOwnProperty(
|
|
785
|
-
if (
|
|
786
|
-
for (var
|
|
787
|
-
d.hasOwnProperty(
|
|
788
|
-
d.hasOwnProperty(
|
|
785
|
+
a.languages;
|
|
786
|
+
var f = g[l], C = {};
|
|
787
|
+
for (var N in f)
|
|
788
|
+
if (f.hasOwnProperty(N)) {
|
|
789
|
+
if (N == c)
|
|
790
|
+
for (var v in d)
|
|
791
|
+
d.hasOwnProperty(v) && (C[v] = d[v]);
|
|
792
|
+
d.hasOwnProperty(N) || (C[N] = f[N]);
|
|
789
793
|
}
|
|
790
|
-
var
|
|
791
|
-
return g[l] =
|
|
792
|
-
z ===
|
|
793
|
-
}),
|
|
794
|
+
var w = g[l];
|
|
795
|
+
return g[l] = C, a.languages.DFS(a.languages, function(P, z) {
|
|
796
|
+
z === w && P != l && (this[P] = C);
|
|
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
|
|
799
|
-
for (var
|
|
800
|
-
if (c.hasOwnProperty(
|
|
801
|
-
d.call(c,
|
|
802
|
-
var
|
|
803
|
-
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
841
845
|
container: l,
|
|
842
846
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
843
847
|
};
|
|
844
|
-
|
|
845
|
-
for (var f = 0,
|
|
846
|
-
|
|
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);
|
|
849
|
+
for (var f = 0, C; C = g.elements[f++]; )
|
|
850
|
+
a.highlightElement(C, c === !0, g.callback);
|
|
847
851
|
},
|
|
848
852
|
/**
|
|
849
853
|
* Highlights the code inside a single element.
|
|
@@ -874,38 +878,38 @@ function Hn() {
|
|
|
874
878
|
* @public
|
|
875
879
|
*/
|
|
876
880
|
highlightElement: function(l, c, d) {
|
|
877
|
-
var g =
|
|
878
|
-
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
var
|
|
881
|
+
var g = a.util.getLanguage(l), f = a.languages[g];
|
|
882
|
+
a.util.setLanguage(l, g);
|
|
883
|
+
var C = l.parentElement;
|
|
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
|
-
function
|
|
888
|
-
|
|
891
|
+
function w(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
|
-
|
|
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({
|
|
903
|
-
language:
|
|
904
|
-
code:
|
|
907
|
+
language: v.language,
|
|
908
|
+
code: v.code,
|
|
905
909
|
immediateClose: !0
|
|
906
910
|
}));
|
|
907
911
|
} else
|
|
908
|
-
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
968
972
|
c[g] = d[g];
|
|
969
973
|
delete c.rest;
|
|
970
974
|
}
|
|
971
|
-
var f = new
|
|
972
|
-
return S(f, f.head, l), A(l, f, c, f.head, 0),
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
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 Hn() {
|
|
|
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
|
}
|
|
@@ -1021,8 +1025,8 @@ function Hn() {
|
|
|
1021
1025
|
return c;
|
|
1022
1026
|
if (Array.isArray(c)) {
|
|
1023
1027
|
var g = "";
|
|
1024
|
-
return c.forEach(function(
|
|
1025
|
-
g += l(
|
|
1028
|
+
return c.forEach(function(w) {
|
|
1029
|
+
g += l(w, d);
|
|
1026
1030
|
}), g;
|
|
1027
1031
|
}
|
|
1028
1032
|
var f = {
|
|
@@ -1032,72 +1036,72 @@ function Hn() {
|
|
|
1032
1036
|
classes: ["token", c.type],
|
|
1033
1037
|
attributes: {},
|
|
1034
1038
|
language: d
|
|
1035
|
-
},
|
|
1036
|
-
|
|
1037
|
-
var
|
|
1038
|
-
for (var
|
|
1039
|
-
|
|
1040
|
-
return "<" + f.tag + ' class="' + f.classes.join(" ") + '"' +
|
|
1039
|
+
}, C = c.alias;
|
|
1040
|
+
C && (Array.isArray(C) ? Array.prototype.push.apply(f.classes, C) : f.classes.push(C)), a.hooks.run("wrap", f);
|
|
1041
|
+
var N = "";
|
|
1042
|
+
for (var v in f.attributes)
|
|
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;
|
|
1044
1048
|
var f = l.exec(d);
|
|
1045
1049
|
if (f && g && f[1]) {
|
|
1046
|
-
var
|
|
1047
|
-
f.index +=
|
|
1050
|
+
var C = f[1].length;
|
|
1051
|
+
f.index += C, f[0] = f[0].slice(C);
|
|
1048
1052
|
}
|
|
1049
1053
|
return f;
|
|
1050
1054
|
}
|
|
1051
|
-
function A(l, c, d, g, f,
|
|
1052
|
-
for (var
|
|
1053
|
-
if (!(!d.hasOwnProperty(
|
|
1054
|
-
var
|
|
1055
|
-
|
|
1056
|
-
for (var
|
|
1057
|
-
if (
|
|
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];
|
|
1059
|
+
v = Array.isArray(v) ? v : [v];
|
|
1060
|
+
for (var w = 0; w < v.length; ++w) {
|
|
1061
|
+
if (C && C.cause == N + "," + w)
|
|
1058
1062
|
return;
|
|
1059
|
-
var P =
|
|
1060
|
-
if (
|
|
1061
|
-
var
|
|
1062
|
-
P.pattern = RegExp(P.pattern.source,
|
|
1063
|
+
var P = v[w], z = P.inside, Re = !!P.lookbehind, ze = !!P.greedy, vt = P.alias;
|
|
1064
|
+
if (ze && !P.pattern.global) {
|
|
1065
|
+
var Ct = P.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1066
|
+
P.pattern = RegExp(P.pattern.source, Ct + "g");
|
|
1063
1067
|
}
|
|
1064
|
-
for (var
|
|
1065
|
-
var
|
|
1068
|
+
for (var Ge = P.pattern || P, _ = g.next, R = f; _ !== c.tail && !(C && R >= C.reach); R += _.value.length, _ = _.next) {
|
|
1069
|
+
var Q = _.value;
|
|
1066
1070
|
if (c.length > l.length)
|
|
1067
1071
|
return;
|
|
1068
|
-
if (!(
|
|
1069
|
-
var
|
|
1070
|
-
if (
|
|
1071
|
-
if (H = m(
|
|
1072
|
+
if (!(Q instanceof u)) {
|
|
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 (
|
|
1075
|
-
_ = _.next,
|
|
1076
|
-
if (
|
|
1077
|
+
var ce = H.index, yt = H.index + H[0].length, G = R;
|
|
1078
|
+
for (G += _.value.length; ce >= G; )
|
|
1079
|
+
_ = _.next, G += _.value.length;
|
|
1080
|
+
if (G -= _.value.length, R = G, _.value instanceof u)
|
|
1077
1081
|
continue;
|
|
1078
|
-
for (var
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
} else if (H = m(
|
|
1082
|
+
for (var te = _; te !== c.tail && (G < yt || typeof te.value == "string"); te = te.next)
|
|
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
|
-
|
|
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
|
-
A(l, c, d, _.prev, R,
|
|
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 Hn() {
|
|
|
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 (!
|
|
1129
|
-
var
|
|
1130
|
-
|
|
1132
|
+
if (!a.manual) {
|
|
1133
|
+
var x = document.readyState;
|
|
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 Hn() {
|
|
|
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,31 +1226,31 @@ function Hn() {
|
|
|
1222
1226
|
* @example
|
|
1223
1227
|
* addInlined('style', 'css');
|
|
1224
1228
|
*/
|
|
1225
|
-
value: function(
|
|
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
|
-
u[
|
|
1247
|
+
u[o] = {
|
|
1244
1248
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
1245
|
-
return
|
|
1249
|
+
return o;
|
|
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 Hn() {
|
|
|
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,
|
|
@@ -1276,8 +1280,8 @@ function Hn() {
|
|
|
1276
1280
|
value: {
|
|
1277
1281
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1278
1282
|
lookbehind: !0,
|
|
1279
|
-
alias: [
|
|
1280
|
-
inside: e.languages[
|
|
1283
|
+
alias: [o, "language-" + o],
|
|
1284
|
+
inside: e.languages[o]
|
|
1281
1285
|
},
|
|
1282
1286
|
punctuation: [
|
|
1283
1287
|
{
|
|
@@ -1291,12 +1295,12 @@ function Hn() {
|
|
|
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(
|
|
1295
|
-
var
|
|
1296
|
-
|
|
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) {
|
|
1299
|
+
var o = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1300
|
+
t.languages.css = {
|
|
1297
1301
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1298
1302
|
atrule: {
|
|
1299
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" +
|
|
1303
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + o.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1300
1304
|
inside: {
|
|
1301
1305
|
rule: /^@[\w-]+/,
|
|
1302
1306
|
"selector-function-argument": {
|
|
@@ -1313,23 +1317,23 @@ function Hn() {
|
|
|
1313
1317
|
},
|
|
1314
1318
|
url: {
|
|
1315
1319
|
// https://drafts.csswg.org/css-values-3/#urls
|
|
1316
|
-
pattern: RegExp("\\burl\\((?:" +
|
|
1320
|
+
pattern: RegExp("\\burl\\((?:" + o.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
1317
1321
|
greedy: !0,
|
|
1318
1322
|
inside: {
|
|
1319
1323
|
function: /^url/i,
|
|
1320
1324
|
punctuation: /^\(|\)$/,
|
|
1321
1325
|
string: {
|
|
1322
|
-
pattern: RegExp("^" +
|
|
1326
|
+
pattern: RegExp("^" + o.source + "$"),
|
|
1323
1327
|
alias: "url"
|
|
1324
1328
|
}
|
|
1325
1329
|
}
|
|
1326
1330
|
},
|
|
1327
1331
|
selector: {
|
|
1328
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` +
|
|
1332
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + o.source + ")*(?=\\s*\\{)"),
|
|
1329
1333
|
lookbehind: !0
|
|
1330
1334
|
},
|
|
1331
1335
|
string: {
|
|
1332
|
-
pattern:
|
|
1336
|
+
pattern: o,
|
|
1333
1337
|
greedy: !0
|
|
1334
1338
|
},
|
|
1335
1339
|
property: {
|
|
@@ -1342,9 +1346,9 @@ function Hn() {
|
|
|
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 Hn() {
|
|
|
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,52 +1525,52 @@ function Hn() {
|
|
|
1521
1525
|
bat: "batch",
|
|
1522
1526
|
h: "c",
|
|
1523
1527
|
tex: "latex"
|
|
1524
|
-
},
|
|
1525
|
-
function S(p, y,
|
|
1528
|
+
}, a = "data-src-status", u = "loading", m = "loaded", A = "failed", L = "pre[data-src]:not([" + a + '="' + m + '"]):not([' + a + '="' + u + '"])';
|
|
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 ?
|
|
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
|
-
var
|
|
1535
|
-
return l ? c ? [
|
|
1538
|
+
var x = Number(y[1]), l = y[2], c = y[3];
|
|
1539
|
+
return l ? c ? [x, Number(c)] : [x, void 0] : [x, x];
|
|
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(
|
|
1547
|
-
var
|
|
1548
|
-
|
|
1549
|
+
if (y.matches(L)) {
|
|
1550
|
+
p.code = "", y.setAttribute(a, u);
|
|
1551
|
+
var x = y.appendChild(document.createElement("CODE"));
|
|
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
|
-
e.util.setLanguage(
|
|
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
|
|
1561
|
-
if (
|
|
1562
|
-
var
|
|
1563
|
-
|
|
1564
|
-
`), y.hasAttribute("data-start") || y.setAttribute("data-start", String(
|
|
1563
|
+
y.setAttribute(a, m);
|
|
1564
|
+
var C = T(y.getAttribute("data-range"));
|
|
1565
|
+
if (C) {
|
|
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(`
|
|
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,837 +1583,867 @@ function Hn() {
|
|
|
1579
1583
|
* @param {ParentNode} [container=document]
|
|
1580
1584
|
*/
|
|
1581
1585
|
highlight: function(y) {
|
|
1582
|
-
for (var
|
|
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
|
-
var
|
|
1594
|
-
const
|
|
1595
|
-
typeof globalThis < "u" && (globalThis.Prism =
|
|
1596
|
-
function
|
|
1597
|
-
const [e] = M(), [
|
|
1597
|
+
var Wn = Gn();
|
|
1598
|
+
const Kn = /* @__PURE__ */ zn(Wn);
|
|
1599
|
+
typeof globalThis < "u" && (globalThis.Prism = Kn);
|
|
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((
|
|
1604
|
+
}), i = ee(null), [r, a] = O(""), u = bn(), m = Array.from(
|
|
1605
|
+
new Set(u.map((L) => $e(L)))
|
|
1602
1606
|
), A = {};
|
|
1603
|
-
return u.forEach((
|
|
1604
|
-
const S =
|
|
1605
|
-
A[S] || (A[S] =
|
|
1606
|
-
}),
|
|
1607
|
-
|
|
1608
|
-
}, [
|
|
1607
|
+
return u.forEach((L) => {
|
|
1608
|
+
const S = $e(L);
|
|
1609
|
+
A[S] || (A[S] = L);
|
|
1610
|
+
}), b(() => {
|
|
1611
|
+
o(Ln(n, i));
|
|
1612
|
+
}, [n]), b(() => {
|
|
1609
1613
|
e.read(() => {
|
|
1610
|
-
if (
|
|
1611
|
-
const S =
|
|
1612
|
-
|
|
1614
|
+
if (s) {
|
|
1615
|
+
const S = j(s).getLanguage();
|
|
1616
|
+
a($e(S));
|
|
1613
1617
|
}
|
|
1614
1618
|
});
|
|
1615
|
-
}, [e,
|
|
1616
|
-
|
|
1619
|
+
}, [e, s]), /* @__PURE__ */ D(
|
|
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 = A[
|
|
1629
|
-
e.dispatchCommand(
|
|
1630
|
-
|
|
1630
|
+
inputValue: r,
|
|
1631
|
+
onInputChange: (L) => {
|
|
1632
|
+
const S = A[L];
|
|
1633
|
+
e.dispatchCommand(ft, [
|
|
1634
|
+
s,
|
|
1631
1635
|
S
|
|
1632
|
-
]),
|
|
1636
|
+
]), a(L);
|
|
1633
1637
|
},
|
|
1634
1638
|
children: [
|
|
1635
1639
|
/* @__PURE__ */ D("div", { children: [
|
|
1636
|
-
/* @__PURE__ */ h(
|
|
1637
|
-
/* @__PURE__ */ h(
|
|
1640
|
+
/* @__PURE__ */ h(it, {}),
|
|
1641
|
+
/* @__PURE__ */ h(q, { children: /* @__PURE__ */ h(Jt, { size: 24 }) })
|
|
1638
1642
|
] }),
|
|
1639
|
-
/* @__PURE__ */ h(
|
|
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
|
);
|
|
1643
1647
|
}
|
|
1644
|
-
const
|
|
1648
|
+
const qn = document.body, gt = Z(
|
|
1645
1649
|
"INSERT_CODE_BLOCK_COMMAND"
|
|
1646
|
-
),
|
|
1650
|
+
), ft = Z(
|
|
1647
1651
|
"SET_CODE_LANGUAGE_COMMAND"
|
|
1648
1652
|
);
|
|
1649
|
-
function
|
|
1650
|
-
const [
|
|
1651
|
-
|
|
1652
|
-
}, []), A =
|
|
1653
|
-
const
|
|
1654
|
-
return !!(
|
|
1655
|
-
}, []),
|
|
1656
|
-
const
|
|
1657
|
-
return
|
|
1658
|
-
}, [A]), S =
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
}, [m,
|
|
1662
|
-
return
|
|
1663
|
-
|
|
1653
|
+
function jn() {
|
|
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]);
|
|
1666
|
+
return b(() => u.registerCommand(
|
|
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 =
|
|
1671
|
-
if (!
|
|
1672
|
-
return
|
|
1673
|
-
const
|
|
1674
|
+
const y = $();
|
|
1675
|
+
if (!k(y))
|
|
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
|
-
|
|
1686
|
-
), [u, S]),
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
},
|
|
1689
|
+
F
|
|
1690
|
+
), [u, S]), b(() => {
|
|
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(
|
|
1695
|
-
|
|
1697
|
+
}, [u, S]), n && (o || r) && De(
|
|
1698
|
+
/* @__PURE__ */ h(Un, { codeBlockCoords: n, codeNodeKey: e }),
|
|
1699
|
+
qn
|
|
1696
1700
|
);
|
|
1697
1701
|
}
|
|
1698
|
-
function
|
|
1699
|
-
const [
|
|
1700
|
-
return
|
|
1702
|
+
function Yn() {
|
|
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
|
|
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
|
-
}), [
|
|
1717
|
-
|
|
1720
|
+
}), [n]), b(() => n.registerCommand(
|
|
1721
|
+
gt,
|
|
1718
1722
|
() => {
|
|
1719
|
-
const e =
|
|
1720
|
-
if (
|
|
1721
|
-
const
|
|
1722
|
-
return e.insertNodes([
|
|
1723
|
-
|
|
1723
|
+
const e = ye();
|
|
1724
|
+
if (k(e)) {
|
|
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
|
-
), [
|
|
1730
|
-
|
|
1732
|
+
F
|
|
1733
|
+
), [n]), b(() => n.registerCommand(
|
|
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 (!
|
|
1743
|
+
const t = $();
|
|
1744
|
+
if (!k(t) || !t.isCollapsed())
|
|
1741
1745
|
return !1;
|
|
1742
|
-
const
|
|
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
|
-
function
|
|
1749
|
-
return /* @__PURE__ */ D(
|
|
1750
|
-
/* @__PURE__ */ h(
|
|
1751
|
-
/* @__PURE__ */ h(
|
|
1752
|
+
function Zn() {
|
|
1753
|
+
return /* @__PURE__ */ D(rt, { children: [
|
|
1754
|
+
/* @__PURE__ */ h(Yn, {}),
|
|
1755
|
+
/* @__PURE__ */ h(jn, {})
|
|
1752
1756
|
] });
|
|
1753
1757
|
}
|
|
1754
|
-
const
|
|
1758
|
+
const ht = Z(
|
|
1755
1759
|
"INSERT_HORIZONTAL_DIVIDER_COMMAND"
|
|
1756
1760
|
);
|
|
1757
|
-
function
|
|
1758
|
-
const [
|
|
1759
|
-
return
|
|
1760
|
-
if (!
|
|
1761
|
+
function Qn() {
|
|
1762
|
+
const [n] = M();
|
|
1763
|
+
return b(() => {
|
|
1764
|
+
if (!n.hasNodes([gn]))
|
|
1761
1765
|
throw new Error("HorizontalDividerNode not registered on editor");
|
|
1762
|
-
return
|
|
1763
|
-
|
|
1766
|
+
return n.registerCommand(
|
|
1767
|
+
ht,
|
|
1764
1768
|
() => {
|
|
1765
|
-
const e =
|
|
1766
|
-
if (
|
|
1767
|
-
const
|
|
1768
|
-
e.insertNodes([
|
|
1769
|
-
let
|
|
1770
|
-
return
|
|
1771
|
-
|
|
1769
|
+
const e = ye();
|
|
1770
|
+
if (k(e)) {
|
|
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
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
+
function tt(n, s) {
|
|
1789
|
+
const e = ye() || $();
|
|
1790
|
+
if (!k(e))
|
|
1791
|
+
return null;
|
|
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();
|
|
1796
|
+
}
|
|
1797
|
+
function Xn({ onImageUpload: n }) {
|
|
1798
|
+
const [s] = M(), e = ee(null), t = ee(n);
|
|
1799
|
+
b(() => {
|
|
1800
|
+
t.current = n;
|
|
1801
|
+
}, [n]), b(() => {
|
|
1802
|
+
if (!s.hasNode(Ye))
|
|
1788
1803
|
throw new Error("ImagePlugin: ImageNode not registered on editor");
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1804
|
+
}, [s]);
|
|
1805
|
+
const o = (i, r, a) => {
|
|
1806
|
+
const u = t.current;
|
|
1807
|
+
u && Promise.resolve().then(() => u(r)).then((m) => {
|
|
1808
|
+
if (typeof m != "string" || !m)
|
|
1809
|
+
throw new Error("onImageUpload must resolve to a URL string");
|
|
1810
|
+
s.update(() => {
|
|
1811
|
+
const A = j(i);
|
|
1812
|
+
fe(A) && (A.setSrc(m), A.setUploadState(re.UPLOADED));
|
|
1813
|
+
}), URL.revokeObjectURL(a);
|
|
1814
|
+
}).catch((m) => {
|
|
1815
|
+
console.error("ImagePlugin: image upload failed", m), s.update(() => {
|
|
1816
|
+
const A = j(i);
|
|
1817
|
+
fe(A) && A.setUploadState(re.ERROR);
|
|
1818
|
+
});
|
|
1819
|
+
});
|
|
1820
|
+
};
|
|
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,
|
|
1829
|
+
u ? re.UPLOADING : re.UPLOADED
|
|
1830
|
+
);
|
|
1831
|
+
return m && u && o(m, r, a), !0;
|
|
1814
1832
|
}
|
|
1815
1833
|
return !1;
|
|
1816
1834
|
},
|
|
1817
|
-
|
|
1818
|
-
), [
|
|
1819
|
-
|
|
1820
|
-
(
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
return !1;
|
|
1830
|
-
const m = URL.createObjectURL(s), A = Ke(m);
|
|
1831
|
-
u.insertNodes([A]);
|
|
1832
|
-
let T = A.getNextSibling() || A.getParent().getNextSibling();
|
|
1833
|
-
return T || (T = re(), A.insertAfter(T)), A.select(), !0;
|
|
1835
|
+
F
|
|
1836
|
+
), [s]), b(() => s.registerCommand(
|
|
1837
|
+
Y,
|
|
1838
|
+
() => {
|
|
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;
|
|
1846
|
+
}
|
|
1834
1847
|
}
|
|
1835
1848
|
return !1;
|
|
1836
1849
|
},
|
|
1837
|
-
|
|
1838
|
-
), [
|
|
1839
|
-
|
|
1840
|
-
|
|
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);
|
|
1864
|
+
if (u.length !== 1) return !1;
|
|
1865
|
+
const m = $() || ye();
|
|
1866
|
+
return k(m) ? (r.preventDefault(), s.dispatchCommand(Me, u[0]), !0) : !1;
|
|
1867
|
+
},
|
|
1868
|
+
F
|
|
1869
|
+
), [s]), /* @__PURE__ */ h(
|
|
1870
|
+
He,
|
|
1841
1871
|
{
|
|
1842
|
-
nodeType:
|
|
1872
|
+
nodeType: Ye,
|
|
1843
1873
|
eventType: "click",
|
|
1844
|
-
eventListener: (
|
|
1845
|
-
|
|
1874
|
+
eventListener: (i, r, a) => {
|
|
1875
|
+
if (!r.isEditable())
|
|
1876
|
+
return;
|
|
1877
|
+
j(a).select();
|
|
1846
1878
|
}
|
|
1847
1879
|
}
|
|
1848
1880
|
);
|
|
1849
1881
|
}
|
|
1850
|
-
const
|
|
1851
|
-
function
|
|
1852
|
-
const [
|
|
1853
|
-
return /* @__PURE__ */ h(
|
|
1882
|
+
const he = 24;
|
|
1883
|
+
function Vn() {
|
|
1884
|
+
const [n] = M();
|
|
1885
|
+
return /* @__PURE__ */ h(Be, { "aria-label": "Block toolbar", id: "block-toolbar", children: /* @__PURE__ */ D(oe, { "aria-label": "Media", children: [
|
|
1854
1886
|
/* @__PURE__ */ h(
|
|
1855
|
-
|
|
1887
|
+
Kt,
|
|
1856
1888
|
{
|
|
1857
1889
|
acceptedFileTypes: ["image/png", "image/jpeg", "image/gif"],
|
|
1858
1890
|
onSelect: (e) => {
|
|
1859
1891
|
if (!e || e.length === 0)
|
|
1860
1892
|
return;
|
|
1861
|
-
const
|
|
1862
|
-
if (!
|
|
1893
|
+
const t = e[0];
|
|
1894
|
+
if (!t.type.startsWith("image/")) {
|
|
1863
1895
|
alert("Please select an image file.");
|
|
1864
1896
|
return;
|
|
1865
1897
|
}
|
|
1866
|
-
|
|
1867
|
-
i.onload = (r) => {
|
|
1868
|
-
var s;
|
|
1869
|
-
const o = (s = r.target) == null ? void 0 : s.result;
|
|
1870
|
-
typeof o == "string" ? t.dispatchCommand(dt, o) : alert("Failed to read file as Data URL.");
|
|
1871
|
-
}, i.onerror = (r) => {
|
|
1872
|
-
console.error("Error reading file:", r), alert("Error reading file.");
|
|
1873
|
-
}, i.readAsDataURL(n);
|
|
1898
|
+
n.dispatchCommand(Me, t);
|
|
1874
1899
|
},
|
|
1875
1900
|
allowsMultiple: !1,
|
|
1876
|
-
children: /* @__PURE__ */ h(
|
|
1901
|
+
children: /* @__PURE__ */ h(q, { "aria-label": "image", children: /* @__PURE__ */ h(tn, { size: he }) })
|
|
1877
1902
|
}
|
|
1878
1903
|
),
|
|
1879
1904
|
/* @__PURE__ */ h(
|
|
1880
|
-
|
|
1905
|
+
q,
|
|
1881
1906
|
{
|
|
1882
1907
|
"aria-label": "code block",
|
|
1883
1908
|
onPress: () => {
|
|
1884
|
-
|
|
1909
|
+
n.dispatchCommand(gt, void 0);
|
|
1885
1910
|
},
|
|
1886
|
-
children: /* @__PURE__ */ h(
|
|
1911
|
+
children: /* @__PURE__ */ h(nn, { size: he })
|
|
1887
1912
|
}
|
|
1888
1913
|
),
|
|
1889
1914
|
/* @__PURE__ */ h(
|
|
1890
|
-
|
|
1915
|
+
q,
|
|
1891
1916
|
{
|
|
1892
1917
|
"aria-label": "horizontal divider",
|
|
1893
1918
|
onPress: () => {
|
|
1894
|
-
|
|
1895
|
-
|
|
1919
|
+
n.dispatchCommand(
|
|
1920
|
+
ht,
|
|
1896
1921
|
void 0
|
|
1897
1922
|
);
|
|
1898
1923
|
},
|
|
1899
|
-
children: /* @__PURE__ */ h(
|
|
1924
|
+
children: /* @__PURE__ */ h(rn, { size: he })
|
|
1900
1925
|
}
|
|
1901
1926
|
)
|
|
1902
1927
|
] }) });
|
|
1903
1928
|
}
|
|
1904
|
-
function
|
|
1905
|
-
selectionRectCoords:
|
|
1906
|
-
TOOLBAR_OFFSET:
|
|
1929
|
+
function Jn({
|
|
1930
|
+
selectionRectCoords: n,
|
|
1931
|
+
TOOLBAR_OFFSET: s,
|
|
1907
1932
|
toolbarTriggerId: e,
|
|
1908
|
-
toolbarPopoverId:
|
|
1933
|
+
toolbarPopoverId: t
|
|
1909
1934
|
}) {
|
|
1910
|
-
const [
|
|
1935
|
+
const [o, i] = O({
|
|
1911
1936
|
x: B,
|
|
1912
1937
|
y: B
|
|
1913
|
-
}),
|
|
1914
|
-
return
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1938
|
+
}), r = ee(null);
|
|
1939
|
+
return b(() => {
|
|
1940
|
+
i(
|
|
1941
|
+
An(
|
|
1942
|
+
n,
|
|
1943
|
+
r,
|
|
1944
|
+
s
|
|
1920
1945
|
)
|
|
1921
1946
|
);
|
|
1922
|
-
}, [
|
|
1947
|
+
}, [n]), /* @__PURE__ */ D(Wt, { children: [
|
|
1923
1948
|
/* @__PURE__ */ h(
|
|
1924
|
-
|
|
1949
|
+
q,
|
|
1925
1950
|
{
|
|
1926
1951
|
"aria-label": "Block toolbar trigger",
|
|
1927
1952
|
className: "block-toolbar-trigger",
|
|
1928
1953
|
id: e,
|
|
1929
|
-
ref:
|
|
1954
|
+
ref: r,
|
|
1930
1955
|
style: {
|
|
1931
1956
|
position: "absolute",
|
|
1932
|
-
top:
|
|
1933
|
-
left:
|
|
1957
|
+
top: o.y,
|
|
1958
|
+
left: o.x
|
|
1934
1959
|
},
|
|
1935
|
-
children: /* @__PURE__ */ h(
|
|
1960
|
+
children: /* @__PURE__ */ h(en, { size: he })
|
|
1936
1961
|
}
|
|
1937
1962
|
),
|
|
1938
1963
|
/* @__PURE__ */ h(
|
|
1939
|
-
|
|
1964
|
+
ot,
|
|
1940
1965
|
{
|
|
1941
1966
|
className: "block-toolbar-popover",
|
|
1942
|
-
id:
|
|
1967
|
+
id: t,
|
|
1943
1968
|
placement: "end",
|
|
1944
1969
|
shouldFlip: !1,
|
|
1945
|
-
offset:
|
|
1946
|
-
children: /* @__PURE__ */ h(
|
|
1970
|
+
offset: s,
|
|
1971
|
+
children: /* @__PURE__ */ h(Vn, {})
|
|
1947
1972
|
}
|
|
1948
1973
|
)
|
|
1949
1974
|
] });
|
|
1950
1975
|
}
|
|
1951
|
-
const
|
|
1952
|
-
function
|
|
1953
|
-
const [
|
|
1976
|
+
const er = document.body;
|
|
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) => {
|
|
1954
1979
|
setTimeout(() => {
|
|
1955
|
-
const
|
|
1956
|
-
|
|
1980
|
+
const E = document.getElementById(m);
|
|
1981
|
+
E && (E === document.activeElement || E.contains(document.activeElement) || E.contains(T.relatedTarget)) || i(!1);
|
|
1957
1982
|
}, 10);
|
|
1958
1983
|
};
|
|
1959
|
-
return
|
|
1960
|
-
const
|
|
1984
|
+
return b(() => {
|
|
1985
|
+
const T = () => {
|
|
1961
1986
|
const p = !!document.getElementById(A);
|
|
1962
|
-
|
|
1963
|
-
},
|
|
1964
|
-
return
|
|
1987
|
+
a(p);
|
|
1988
|
+
}, E = new MutationObserver(T);
|
|
1989
|
+
return E.observe(document.body, {
|
|
1965
1990
|
childList: !0,
|
|
1966
1991
|
subtree: !0
|
|
1967
|
-
}),
|
|
1968
|
-
}, []),
|
|
1969
|
-
(
|
|
1970
|
-
|
|
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));
|
|
1971
1996
|
}
|
|
1972
|
-
), [
|
|
1973
|
-
|
|
1997
|
+
), [t]), b(() => t.registerEditableListener((T) => {
|
|
1998
|
+
T || e(null);
|
|
1999
|
+
}), [t]), b(() => t.registerCommand(
|
|
2000
|
+
Y,
|
|
1974
2001
|
() => {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
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);
|
|
1979
2008
|
}
|
|
1980
|
-
const p =
|
|
1981
|
-
if (!
|
|
2009
|
+
const p = $();
|
|
2010
|
+
if (!k(p) || !p.isCollapsed())
|
|
1982
2011
|
return e(null), !1;
|
|
1983
|
-
const y =
|
|
1984
|
-
if (
|
|
1985
|
-
const l =
|
|
2012
|
+
const y = Ee(p);
|
|
2013
|
+
if (J(y) && y.getTextContent() === "") {
|
|
2014
|
+
const l = t.getElementByKey(y.getKey()).getBoundingClientRect(), c = l.left, d = l.top + l.height / 2 + window.scrollY;
|
|
1986
2015
|
e({ x: c, y: d });
|
|
1987
2016
|
} else
|
|
1988
2017
|
e(null);
|
|
1989
2018
|
return !1;
|
|
1990
2019
|
},
|
|
1991
|
-
|
|
1992
|
-
), [
|
|
2020
|
+
F
|
|
2021
|
+
), [t]), s && (o || r) && De(
|
|
1993
2022
|
/* @__PURE__ */ h(
|
|
1994
|
-
|
|
2023
|
+
Jn,
|
|
1995
2024
|
{
|
|
1996
|
-
selectionRectCoords:
|
|
1997
|
-
TOOLBAR_OFFSET:
|
|
2025
|
+
selectionRectCoords: s,
|
|
2026
|
+
TOOLBAR_OFFSET: n,
|
|
1998
2027
|
toolbarTriggerId: m,
|
|
1999
2028
|
toolbarPopoverId: A
|
|
2000
2029
|
}
|
|
2001
2030
|
),
|
|
2002
|
-
|
|
2031
|
+
er
|
|
2003
2032
|
);
|
|
2004
2033
|
}
|
|
2005
|
-
const
|
|
2034
|
+
const nr = [
|
|
2006
2035
|
["$", "$"],
|
|
2007
2036
|
["\\(", "\\)"]
|
|
2008
|
-
],
|
|
2037
|
+
], rr = [
|
|
2009
2038
|
["$$", "$$"],
|
|
2010
2039
|
["\\[", "\\]"]
|
|
2011
|
-
],
|
|
2040
|
+
], nt = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), mt = (n, s) => {
|
|
2012
2041
|
let e = null;
|
|
2013
|
-
for (const [
|
|
2014
|
-
const
|
|
2015
|
-
`(.*?)(${
|
|
2042
|
+
for (const [t, o] of s) {
|
|
2043
|
+
const r = new RegExp(
|
|
2044
|
+
`(.*?)(${nt(t)})(.*?)(${nt(o)})`,
|
|
2016
2045
|
"g"
|
|
2017
|
-
).exec(
|
|
2018
|
-
if (
|
|
2019
|
-
const
|
|
2020
|
-
if (
|
|
2021
|
-
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;
|
|
2022
2051
|
(!e || u < e.start) && (e = {
|
|
2023
2052
|
start: u,
|
|
2024
2053
|
end: m,
|
|
2025
|
-
content:
|
|
2054
|
+
content: t + a + o
|
|
2026
2055
|
});
|
|
2027
2056
|
}
|
|
2028
2057
|
}
|
|
2029
2058
|
}
|
|
2030
2059
|
return e;
|
|
2031
|
-
},
|
|
2032
|
-
if (!
|
|
2060
|
+
}, pt = (n, s) => {
|
|
2061
|
+
if (!k(n))
|
|
2033
2062
|
return null;
|
|
2034
|
-
const e =
|
|
2035
|
-
return !
|
|
2036
|
-
},
|
|
2037
|
-
function
|
|
2038
|
-
const [
|
|
2039
|
-
return
|
|
2040
|
-
if (!
|
|
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");
|
|
2066
|
+
function ir() {
|
|
2067
|
+
const [n] = M();
|
|
2068
|
+
return b(() => {
|
|
2069
|
+
if (!n.hasNodes([be, mn]))
|
|
2041
2070
|
throw new Error(
|
|
2042
2071
|
"MathInlinePlugin: MathNode or MathHighlightNodeInline not registered on editor"
|
|
2043
2072
|
);
|
|
2044
|
-
}, [
|
|
2045
|
-
if (!e.isSimpleText() ||
|
|
2073
|
+
}, [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2074
|
+
if (!e.isSimpleText() || X(e) || I(e, W))
|
|
2046
2075
|
return;
|
|
2047
|
-
const
|
|
2048
|
-
if (
|
|
2049
|
-
const { start:
|
|
2076
|
+
const t = e.getTextContent(), o = mt(t, nr);
|
|
2077
|
+
if (o) {
|
|
2078
|
+
const { start: i, end: r, content: a } = o;
|
|
2050
2079
|
let u;
|
|
2051
|
-
const m =
|
|
2052
|
-
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;
|
|
2053
2082
|
}
|
|
2054
|
-
}), [
|
|
2055
|
-
|
|
2083
|
+
}), [n]), b(() => n.registerCommand(
|
|
2084
|
+
Y,
|
|
2056
2085
|
() => {
|
|
2057
|
-
const e =
|
|
2058
|
-
if (
|
|
2059
|
-
const
|
|
2060
|
-
if (
|
|
2061
|
-
const
|
|
2062
|
-
if (
|
|
2063
|
-
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();
|
|
2064
2093
|
u.startsWith("$") && u.endsWith("$") ? u = u.slice(1, -1) : u.startsWith("\\(") && u.endsWith("\\)") && (u = u.slice(2, -2));
|
|
2065
|
-
const m =
|
|
2066
|
-
return
|
|
2094
|
+
const m = Le(u);
|
|
2095
|
+
return a.replace(m), m.select(), !0;
|
|
2067
2096
|
}
|
|
2068
2097
|
}
|
|
2069
|
-
} else
|
|
2070
|
-
return
|
|
2071
|
-
if (
|
|
2072
|
-
let
|
|
2073
|
-
if (!
|
|
2074
|
-
|
|
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();
|
|
2075
2104
|
return;
|
|
2076
2105
|
}
|
|
2077
2106
|
let u = !1;
|
|
2078
|
-
|
|
2079
|
-
const m = u ?
|
|
2080
|
-
|
|
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);
|
|
2081
2110
|
}
|
|
2082
2111
|
}), !1;
|
|
2083
2112
|
},
|
|
2084
|
-
|
|
2085
|
-
), [
|
|
2086
|
-
|
|
2087
|
-
() => (
|
|
2088
|
-
|
|
2089
|
-
if (
|
|
2090
|
-
let
|
|
2091
|
-
if (!
|
|
2092
|
-
|
|
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();
|
|
2120
|
+
if (!o) {
|
|
2121
|
+
t.remove();
|
|
2093
2122
|
return;
|
|
2094
2123
|
}
|
|
2095
|
-
let
|
|
2096
|
-
|
|
2097
|
-
const
|
|
2098
|
-
|
|
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);
|
|
2099
2128
|
}
|
|
2100
2129
|
});
|
|
2101
2130
|
}), !1),
|
|
2102
|
-
|
|
2103
|
-
), [
|
|
2104
|
-
|
|
2105
|
-
(
|
|
2106
|
-
const e =
|
|
2107
|
-
if (!
|
|
2131
|
+
F
|
|
2132
|
+
), [n]), b(() => n.registerCommand(
|
|
2133
|
+
Ft,
|
|
2134
|
+
(s) => {
|
|
2135
|
+
const e = $();
|
|
2136
|
+
if (!k(e) || !e.isCollapsed())
|
|
2108
2137
|
return !1;
|
|
2109
|
-
const
|
|
2110
|
-
if (
|
|
2111
|
-
let
|
|
2112
|
-
|
|
2113
|
-
const
|
|
2114
|
-
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;
|
|
2115
2144
|
}
|
|
2116
2145
|
return !1;
|
|
2117
2146
|
},
|
|
2118
|
-
|
|
2119
|
-
), [
|
|
2120
|
-
|
|
2121
|
-
(
|
|
2122
|
-
const e =
|
|
2123
|
-
if (!
|
|
2147
|
+
F
|
|
2148
|
+
), [n]), b(() => n.registerCommand(
|
|
2149
|
+
Oe,
|
|
2150
|
+
(s) => {
|
|
2151
|
+
const e = $();
|
|
2152
|
+
if (!k(e) || !e.isCollapsed())
|
|
2124
2153
|
return !1;
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2127
|
-
let
|
|
2128
|
-
|
|
2129
|
-
const
|
|
2130
|
-
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;
|
|
2131
2160
|
}
|
|
2132
2161
|
return !1;
|
|
2133
2162
|
},
|
|
2134
|
-
|
|
2135
|
-
), [
|
|
2136
|
-
|
|
2137
|
-
(
|
|
2138
|
-
const e =
|
|
2163
|
+
F
|
|
2164
|
+
), [n]), b(() => n.registerCommand(
|
|
2165
|
+
_e,
|
|
2166
|
+
(s) => {
|
|
2167
|
+
const e = s.clipboardData;
|
|
2139
2168
|
if (!e)
|
|
2140
2169
|
return !1;
|
|
2141
|
-
const
|
|
2142
|
-
if (!
|
|
2143
|
-
|
|
2144
|
-
|
|
2170
|
+
const t = $();
|
|
2171
|
+
if (!pt(
|
|
2172
|
+
t,
|
|
2173
|
+
X
|
|
2145
2174
|
))
|
|
2146
2175
|
return !1;
|
|
2147
|
-
const
|
|
2148
|
-
return
|
|
2176
|
+
const i = bt(e);
|
|
2177
|
+
return i ? (s.preventDefault(), t.insertText(i), !0) : !1;
|
|
2149
2178
|
},
|
|
2150
|
-
|
|
2151
|
-
), [
|
|
2152
|
-
|
|
2179
|
+
F
|
|
2180
|
+
), [n]), b(() => n.registerCommand(
|
|
2181
|
+
Y,
|
|
2153
2182
|
() => {
|
|
2154
|
-
const
|
|
2155
|
-
if (!
|
|
2183
|
+
const s = $();
|
|
2184
|
+
if (!k(s) || !s.isCollapsed())
|
|
2156
2185
|
return !1;
|
|
2157
|
-
const e =
|
|
2158
|
-
return
|
|
2186
|
+
const e = s.anchor.getNode();
|
|
2187
|
+
return X(e) && (e.getNextSibling() || e.insertAfter(kt(" "))), !1;
|
|
2159
2188
|
},
|
|
2160
|
-
|
|
2161
|
-
), [
|
|
2189
|
+
wt
|
|
2190
|
+
), [n]), // Register click event for MathNode
|
|
2162
2191
|
/* @__PURE__ */ h(
|
|
2163
|
-
|
|
2192
|
+
He,
|
|
2164
2193
|
{
|
|
2165
|
-
nodeType:
|
|
2194
|
+
nodeType: be,
|
|
2166
2195
|
eventType: "click",
|
|
2167
|
-
eventListener: (
|
|
2168
|
-
|
|
2169
|
-
|
|
2196
|
+
eventListener: (s, e, t) => {
|
|
2197
|
+
if (!e.isEditable())
|
|
2198
|
+
return;
|
|
2199
|
+
const o = j(t);
|
|
2200
|
+
o && o.isInline() && o.select();
|
|
2170
2201
|
}
|
|
2171
2202
|
}
|
|
2172
2203
|
);
|
|
2173
2204
|
}
|
|
2174
|
-
function
|
|
2175
|
-
const [
|
|
2176
|
-
return
|
|
2177
|
-
if (!
|
|
2205
|
+
function or() {
|
|
2206
|
+
const [n] = M();
|
|
2207
|
+
return b(() => {
|
|
2208
|
+
if (!n.hasNodes([be, pn]))
|
|
2178
2209
|
throw new Error(
|
|
2179
2210
|
"MathBlockPlugin: MathNode or MathHighlightNodeBlock not registered on editor"
|
|
2180
2211
|
);
|
|
2181
|
-
}, [
|
|
2182
|
-
if (!e.isSimpleText() || I(e,
|
|
2212
|
+
}, [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2213
|
+
if (!e.isSimpleText() || I(e, W))
|
|
2183
2214
|
return;
|
|
2184
|
-
const
|
|
2185
|
-
if (
|
|
2186
|
-
const
|
|
2187
|
-
if (
|
|
2188
|
-
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)
|
|
2189
2220
|
return;
|
|
2190
|
-
const m =
|
|
2221
|
+
const m = Se("");
|
|
2191
2222
|
e.replace(m), m.select();
|
|
2192
2223
|
const A = m.getNextSibling();
|
|
2193
|
-
|
|
2224
|
+
ie(A) && A.remove();
|
|
2194
2225
|
return;
|
|
2195
2226
|
}
|
|
2196
2227
|
}
|
|
2197
|
-
const
|
|
2198
|
-
if (
|
|
2199
|
-
const { start:
|
|
2228
|
+
const o = mt(t, rr);
|
|
2229
|
+
if (o) {
|
|
2230
|
+
const { start: i, end: r, content: a } = o;
|
|
2200
2231
|
let u;
|
|
2201
|
-
const m =
|
|
2202
|
-
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;
|
|
2203
2234
|
}
|
|
2204
|
-
}), [
|
|
2205
|
-
|
|
2235
|
+
}), [n]), b(() => n.registerCommand(
|
|
2236
|
+
Y,
|
|
2206
2237
|
() => {
|
|
2207
|
-
const e =
|
|
2208
|
-
if (
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2211
|
-
const
|
|
2212
|
-
if (!
|
|
2213
|
-
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();
|
|
2214
2245
|
(u.startsWith("$$") && u.endsWith("$$") || u.startsWith("\\[") && u.endsWith("\\]")) && (u = u.slice(2, -2));
|
|
2215
|
-
const m =
|
|
2216
|
-
return
|
|
2246
|
+
const m = Se(u);
|
|
2247
|
+
return a.replace(m), m.select(), !0;
|
|
2217
2248
|
}
|
|
2218
2249
|
}
|
|
2219
|
-
} else
|
|
2220
|
-
|
|
2221
|
-
const
|
|
2222
|
-
|
|
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());
|
|
2223
2254
|
});
|
|
2224
|
-
const
|
|
2225
|
-
for (const [,
|
|
2226
|
-
if (
|
|
2227
|
-
const
|
|
2228
|
-
if (!
|
|
2229
|
-
|
|
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();
|
|
2230
2261
|
continue;
|
|
2231
2262
|
}
|
|
2232
|
-
const u =
|
|
2233
|
-
|
|
2263
|
+
const u = U(`$$${a}$$`, !1);
|
|
2264
|
+
r.replace(u);
|
|
2234
2265
|
}
|
|
2235
2266
|
return !1;
|
|
2236
2267
|
},
|
|
2237
|
-
|
|
2238
|
-
), [
|
|
2239
|
-
|
|
2240
|
-
() => (
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2243
|
-
if (
|
|
2244
|
-
const
|
|
2245
|
-
if (!
|
|
2246
|
-
|
|
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();
|
|
2276
|
+
if (!o) {
|
|
2277
|
+
t.remove();
|
|
2247
2278
|
return;
|
|
2248
2279
|
}
|
|
2249
|
-
const
|
|
2250
|
-
|
|
2280
|
+
const i = U(`$$${o}$$`, !1);
|
|
2281
|
+
t.replace(i), Pe(null);
|
|
2251
2282
|
}
|
|
2252
2283
|
});
|
|
2253
2284
|
}), !1),
|
|
2254
|
-
|
|
2255
|
-
), [
|
|
2256
|
-
|
|
2285
|
+
F
|
|
2286
|
+
), [n]), b(() => n.registerCommand(
|
|
2287
|
+
It,
|
|
2257
2288
|
() => {
|
|
2258
|
-
const e =
|
|
2259
|
-
if (!
|
|
2289
|
+
const e = $();
|
|
2290
|
+
if (!k(e))
|
|
2260
2291
|
return !1;
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2263
|
-
|
|
2292
|
+
const t = e.getNodes()[0], o = I(
|
|
2293
|
+
t,
|
|
2294
|
+
W
|
|
2264
2295
|
);
|
|
2265
|
-
if (!
|
|
2296
|
+
if (!o)
|
|
2266
2297
|
return !1;
|
|
2267
|
-
const
|
|
2268
|
-
return e.isCollapsed() && (e.anchor.getNode().getKey() ===
|
|
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);
|
|
2269
2300
|
},
|
|
2270
|
-
|
|
2271
|
-
), [
|
|
2272
|
-
|
|
2273
|
-
(
|
|
2274
|
-
const e =
|
|
2275
|
-
if (!
|
|
2301
|
+
F
|
|
2302
|
+
), [n]), b(() => n.registerCommand(
|
|
2303
|
+
Oe,
|
|
2304
|
+
(s) => {
|
|
2305
|
+
const e = $();
|
|
2306
|
+
if (!k(e) || !e.isCollapsed())
|
|
2276
2307
|
return !1;
|
|
2277
|
-
const
|
|
2278
|
-
if (
|
|
2279
|
-
let
|
|
2280
|
-
(
|
|
2281
|
-
const
|
|
2282
|
-
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;
|
|
2283
2314
|
}
|
|
2284
2315
|
return !1;
|
|
2285
2316
|
},
|
|
2286
|
-
|
|
2287
|
-
), [
|
|
2288
|
-
|
|
2289
|
-
(
|
|
2290
|
-
const e =
|
|
2317
|
+
F
|
|
2318
|
+
), [n]), b(() => n.registerCommand(
|
|
2319
|
+
_e,
|
|
2320
|
+
(s) => {
|
|
2321
|
+
const e = s.clipboardData;
|
|
2291
2322
|
if (!e)
|
|
2292
2323
|
return !1;
|
|
2293
|
-
const
|
|
2294
|
-
if (!
|
|
2295
|
-
|
|
2296
|
-
|
|
2324
|
+
const t = $();
|
|
2325
|
+
if (!pt(
|
|
2326
|
+
t,
|
|
2327
|
+
W
|
|
2297
2328
|
))
|
|
2298
2329
|
return !1;
|
|
2299
|
-
const
|
|
2300
|
-
return
|
|
2330
|
+
const i = bt(e);
|
|
2331
|
+
return i ? (s.preventDefault(), t.insertRawText(i), !0) : !1;
|
|
2301
2332
|
},
|
|
2302
|
-
|
|
2303
|
-
), [
|
|
2304
|
-
|
|
2333
|
+
F
|
|
2334
|
+
), [n]), /* @__PURE__ */ h(
|
|
2335
|
+
He,
|
|
2305
2336
|
{
|
|
2306
|
-
nodeType:
|
|
2337
|
+
nodeType: be,
|
|
2307
2338
|
eventType: "click",
|
|
2308
|
-
eventListener: (
|
|
2309
|
-
|
|
2310
|
-
|
|
2339
|
+
eventListener: (s, e, t) => {
|
|
2340
|
+
if (!e.isEditable())
|
|
2341
|
+
return;
|
|
2342
|
+
const o = j(t);
|
|
2343
|
+
o && !o.isInline() && o.select();
|
|
2311
2344
|
}
|
|
2312
2345
|
}
|
|
2313
2346
|
);
|
|
2314
2347
|
}
|
|
2315
|
-
const
|
|
2316
|
-
function
|
|
2317
|
-
const [
|
|
2318
|
-
return
|
|
2319
|
-
|
|
2348
|
+
const sr = 3;
|
|
2349
|
+
function ar() {
|
|
2350
|
+
const [n] = M();
|
|
2351
|
+
return b(() => n.registerNodeTransform(
|
|
2352
|
+
Ot,
|
|
2320
2353
|
(e) => {
|
|
2321
|
-
const
|
|
2322
|
-
if (
|
|
2323
|
-
const
|
|
2324
|
-
e.replace(
|
|
2354
|
+
const t = e.getParent();
|
|
2355
|
+
if (qe(t)) {
|
|
2356
|
+
const o = Pt();
|
|
2357
|
+
e.replace(o), o.selectEnd();
|
|
2325
2358
|
}
|
|
2326
2359
|
}
|
|
2327
|
-
), [
|
|
2328
|
-
if (!I(e,
|
|
2360
|
+
), [n]), b(() => n.registerNodeTransform(se, (e) => {
|
|
2361
|
+
if (!I(e, J) || I(e, J).getFirstDescendant() !== e)
|
|
2329
2362
|
return;
|
|
2330
|
-
const
|
|
2331
|
-
if (
|
|
2332
|
-
const
|
|
2333
|
-
e.getTextContent() === "1. " &&
|
|
2363
|
+
const o = $();
|
|
2364
|
+
if (k(o) && o.isCollapsed()) {
|
|
2365
|
+
const r = o.anchor.offset;
|
|
2366
|
+
e.getTextContent() === "1. " && r === 3 ? (je("number"), e.setTextContent("")) : e.getTextContent() === "- " && r === 2 && (je("bullet"), e.setTextContent(""));
|
|
2334
2367
|
}
|
|
2335
|
-
}), [
|
|
2336
|
-
|
|
2368
|
+
}), [n]), b(() => n.registerCommand(
|
|
2369
|
+
_t,
|
|
2337
2370
|
(e) => {
|
|
2338
|
-
const
|
|
2339
|
-
if (!
|
|
2371
|
+
const t = $();
|
|
2372
|
+
if (!k(t))
|
|
2340
2373
|
return !1;
|
|
2341
|
-
const
|
|
2342
|
-
if (!
|
|
2374
|
+
const o = Ee(t), i = I(o, qe);
|
|
2375
|
+
if (!i)
|
|
2343
2376
|
return !1;
|
|
2344
|
-
const
|
|
2377
|
+
const r = i.getIndent();
|
|
2345
2378
|
if (e.shiftKey) {
|
|
2346
|
-
if (
|
|
2379
|
+
if (r <= 0)
|
|
2347
2380
|
return !1;
|
|
2348
|
-
|
|
2381
|
+
i.setIndent(r - 1);
|
|
2349
2382
|
} else {
|
|
2350
|
-
if (
|
|
2383
|
+
if (r > sr)
|
|
2351
2384
|
return !1;
|
|
2352
|
-
|
|
2385
|
+
i.setIndent(r + 1);
|
|
2353
2386
|
}
|
|
2354
2387
|
return !0;
|
|
2355
2388
|
},
|
|
2356
|
-
|
|
2357
|
-
), [
|
|
2389
|
+
F
|
|
2390
|
+
), [n]), null;
|
|
2358
2391
|
}
|
|
2359
|
-
function
|
|
2360
|
-
const [
|
|
2392
|
+
function lr() {
|
|
2393
|
+
const [n] = M(), s = (e) => {
|
|
2361
2394
|
e.key === "Tab" && e.preventDefault();
|
|
2362
2395
|
};
|
|
2363
|
-
return
|
|
2364
|
-
(
|
|
2365
|
-
|
|
2396
|
+
return b(() => n.registerRootListener(
|
|
2397
|
+
(t, o) => {
|
|
2398
|
+
t && t.addEventListener("keydown", s), o && o.removeEventListener("keydown", s);
|
|
2366
2399
|
}
|
|
2367
|
-
), [
|
|
2400
|
+
), [n]), null;
|
|
2368
2401
|
}
|
|
2369
|
-
function
|
|
2370
|
-
const [
|
|
2371
|
-
return
|
|
2372
|
-
if (
|
|
2373
|
-
return
|
|
2374
|
-
|
|
2402
|
+
function cr({ editorRef: n }) {
|
|
2403
|
+
const [s] = M();
|
|
2404
|
+
return b(() => {
|
|
2405
|
+
if (n)
|
|
2406
|
+
return n.current = s, () => {
|
|
2407
|
+
n && (n.current = null);
|
|
2375
2408
|
};
|
|
2376
|
-
}, [
|
|
2409
|
+
}, [s, n]), null;
|
|
2377
2410
|
}
|
|
2378
|
-
function
|
|
2379
|
-
initialConfig:
|
|
2380
|
-
onChange:
|
|
2411
|
+
function Or({
|
|
2412
|
+
initialConfig: n,
|
|
2413
|
+
onChange: s,
|
|
2381
2414
|
editorRef: e,
|
|
2382
|
-
blockToolbarGap:
|
|
2383
|
-
spellCheck:
|
|
2384
|
-
isHeadingOneFirst:
|
|
2415
|
+
blockToolbarGap: t,
|
|
2416
|
+
spellCheck: o,
|
|
2417
|
+
isHeadingOneFirst: i,
|
|
2418
|
+
onImageUpload: r
|
|
2385
2419
|
}) {
|
|
2386
|
-
return /* @__PURE__ */ D(
|
|
2420
|
+
return /* @__PURE__ */ D(xt, { initialConfig: n, children: [
|
|
2387
2421
|
/* @__PURE__ */ h(
|
|
2388
|
-
|
|
2422
|
+
Tt,
|
|
2389
2423
|
{
|
|
2390
|
-
contentEditable: /* @__PURE__ */ h(
|
|
2391
|
-
ErrorBoundary:
|
|
2424
|
+
contentEditable: /* @__PURE__ */ h(En, { spellCheck: o, className: "editor-input" }),
|
|
2425
|
+
ErrorBoundary: Lt
|
|
2392
2426
|
}
|
|
2393
2427
|
),
|
|
2394
|
-
/* @__PURE__ */ h(
|
|
2395
|
-
/* @__PURE__ */ h(
|
|
2396
|
-
/* @__PURE__ */ h(
|
|
2397
|
-
/* @__PURE__ */ h(
|
|
2398
|
-
/* @__PURE__ */ h(
|
|
2399
|
-
/* @__PURE__ */ h(
|
|
2400
|
-
/* @__PURE__ */ h(rr, {}),
|
|
2401
|
-
/* @__PURE__ */ h(Un, {}),
|
|
2402
|
-
/* @__PURE__ */ h(jn, {}),
|
|
2403
|
-
/* @__PURE__ */ h(Zn, {}),
|
|
2404
|
-
/* @__PURE__ */ h(pn, {}),
|
|
2428
|
+
/* @__PURE__ */ h(Pn, { isHeadingOneFirst: i }),
|
|
2429
|
+
/* @__PURE__ */ h(Rn, {}),
|
|
2430
|
+
/* @__PURE__ */ h(tr, { toolbarGap: t }),
|
|
2431
|
+
/* @__PURE__ */ h(Nt, {}),
|
|
2432
|
+
/* @__PURE__ */ h(At, {}),
|
|
2433
|
+
/* @__PURE__ */ h(ir, {}),
|
|
2405
2434
|
/* @__PURE__ */ h(or, {}),
|
|
2406
|
-
/* @__PURE__ */ h(
|
|
2407
|
-
/* @__PURE__ */ h(
|
|
2408
|
-
/* @__PURE__ */ h(
|
|
2409
|
-
/* @__PURE__ */ h(Cn, {})
|
|
2435
|
+
/* @__PURE__ */ h(Zn, {}),
|
|
2436
|
+
/* @__PURE__ */ h(Qn, {}),
|
|
2437
|
+
/* @__PURE__ */ h(Xn, { onImageUpload: r }),
|
|
2438
|
+
/* @__PURE__ */ h(Cn, {}),
|
|
2439
|
+
/* @__PURE__ */ h(ar, {}),
|
|
2440
|
+
/* @__PURE__ */ h(lr, {}),
|
|
2441
|
+
/* @__PURE__ */ h(yn, { onChange: s }),
|
|
2442
|
+
/* @__PURE__ */ h(cr, { editorRef: e }),
|
|
2443
|
+
/* @__PURE__ */ h(Nn, {})
|
|
2410
2444
|
] });
|
|
2411
2445
|
}
|
|
2412
2446
|
export {
|
|
2413
|
-
|
|
2447
|
+
Or as default
|
|
2414
2448
|
};
|
|
2415
2449
|
//# sourceMappingURL=index.es.js.map
|