bridgerte 0.9.3 → 0.9.4
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/README.md +899 -866
- package/dist/bridge.cjs.map +1 -1
- package/dist/bridge.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +44 -54
- package/dist/core.js.map +1 -1
- package/dist/dom.cjs +1 -1
- package/dist/dom.js +6 -5
- package/dist/index-5d8qaSP5.cjs +36 -0
- package/dist/index-5d8qaSP5.cjs.map +1 -0
- package/dist/{index-BwZ0II4h.js → index-BzpD9bI2.js} +1126 -1123
- package/dist/index-BzpD9bI2.js.map +1 -0
- package/dist/{index-bN5Hs6-3.js → index-C26bdJ7I.js} +121 -101
- package/dist/index-C26bdJ7I.js.map +1 -0
- package/dist/index-CuNKUHed.js.map +1 -1
- package/dist/index-DF8OhKI4.cjs +2 -0
- package/dist/index-DF8OhKI4.cjs.map +1 -0
- package/dist/index-DKalD8mx.cjs +4 -0
- package/dist/index-DKalD8mx.cjs.map +1 -0
- package/dist/index-GaS65GL0.cjs.map +1 -1
- package/dist/index-sbZNOcCB.js +54 -0
- package/dist/index-sbZNOcCB.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +24 -21
- package/dist/index.js.map +1 -1
- package/dist/native-spec.cjs.map +1 -1
- package/dist/native-spec.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webview.cjs +1 -1
- package/dist/webview.js +1 -1
- package/package.json +1 -1
- package/dist/index-BaOlPu8L.cjs +0 -4
- package/dist/index-BaOlPu8L.cjs.map +0 -1
- package/dist/index-BwZ0II4h.js.map +0 -1
- package/dist/index-bN5Hs6-3.js.map +0 -1
- package/dist/index-hd9Zi2DV.cjs +0 -36
- package/dist/index-hd9Zi2DV.cjs.map +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Re = (e, t, n) =>
|
|
4
|
-
import { BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS as
|
|
5
|
-
import { B as Le, b as
|
|
6
|
-
import { DecoratorNode as
|
|
7
|
-
import { $isHeadingNode as
|
|
8
|
-
import { $isCodeNode as K, $createCodeNode as
|
|
9
|
-
import { $isListNode as
|
|
10
|
-
import { $isTableSelection as
|
|
11
|
-
import { $isLinkNode as xe, $toggleLink as
|
|
12
|
-
import { registerHistory as
|
|
13
|
-
import { $generateNodesFromDOM as
|
|
14
|
-
import { $getSelectionStyleValueForProperty as
|
|
15
|
-
import { $getNearestNodeOfType as
|
|
16
|
-
import { codeBlockLanguagePanel as
|
|
17
|
-
import {
|
|
18
|
-
import { normalizeCodeLanguage as
|
|
19
|
-
import { autoUpdate as
|
|
20
|
-
const
|
|
1
|
+
var jn = Object.defineProperty;
|
|
2
|
+
var qn = (e, t, n) => t in e ? jn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Re = (e, t, n) => qn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS as Kn, isBridgeMessage as Gn, BRIDGE_HEIGHT_CHANGE_THROTTLE_MS as Xn, defaultBridgeEventTiming as Jn } from "./bridge.js";
|
|
5
|
+
import { B as Le, b as en, a as tn } from "./index-CuNKUHed.js";
|
|
6
|
+
import { DecoratorNode as nn, $applyNodeReplacement as Qe, $getRoot as $, $isElementNode as Ve, $createParagraphNode as z, TextNode as ee, $isParagraphNode as Yn, $getSelection as A, $isRangeSelection as D, $insertNodes as V, FORMAT_ELEMENT_COMMAND as Qn, $createTextNode as Se, FORMAT_TEXT_COMMAND as Zn, REDO_COMMAND as er, UNDO_COMMAND as tr, OUTDENT_CONTENT_COMMAND as nr, INDENT_CONTENT_COMMAND as rr, SKIP_SCROLL_INTO_VIEW_TAG as or, $getNodeByKey as me, $setSelection as ar, SELECTION_CHANGE_COMMAND as rn, COMMAND_PRIORITY_LOW as U, KEY_ESCAPE_COMMAND as on, KEY_ARROW_DOWN_COMMAND as sr, KEY_ARROW_UP_COMMAND as ir, KEY_ENTER_COMMAND as lr, KEY_BACKSPACE_COMMAND as cr, COMMAND_PRIORITY_HIGH as Ae, KEY_DELETE_COMMAND as dr, DELETE_CHARACTER_COMMAND as ur, mergeRegister as an, $getNearestNodeFromDOMNode as mr, CAN_UNDO_COMMAND as gr, CAN_REDO_COMMAND as hr, createEditor as pr, CLEAR_HISTORY_COMMAND as fr } from "lexical";
|
|
7
|
+
import { $isHeadingNode as br, $isQuoteNode as yr, $createQuoteNode as vr, $createHeadingNode as wr, registerRichText as Cr, HeadingNode as _r, QuoteNode as kr } from "@lexical/rich-text";
|
|
8
|
+
import { $isCodeNode as K, $createCodeNode as xr, $isCodeHighlightNode as Er, $createCodeHighlightNode as Mr, CodeNode as sn, CodeHighlightNode as Tr } from "@lexical/code";
|
|
9
|
+
import { $isListNode as Lr, ListNode as ln, INSERT_CHECK_LIST_COMMAND as Sr, INSERT_UNORDERED_LIST_COMMAND as Nr, INSERT_ORDERED_LIST_COMMAND as Pr, $isListItemNode as Ir, registerList as Rr, registerCheckList as Ar, ListItemNode as Br } from "@lexical/list";
|
|
10
|
+
import { $isTableSelection as cn, $findTableNode as Dr, $deleteTableColumnAtSelection as Or, $deleteTableRowAtSelection as Hr, $insertTableColumnAtSelection as $r, $insertTableRowAtSelection as Fr, INSERT_TABLE_COMMAND as zr, $findCellNode as Vr, TableNode as We, $isTableRowNode as Wr, $isTableCellNode as Ur, registerTablePlugin as jr, TableRowNode as qr, TableCellNode as Kr, setScrollableTablesActive as Gr } from "@lexical/table";
|
|
11
|
+
import { $isLinkNode as xe, $toggleLink as ut, formatUrl as Xr, $createLinkNode as Jr, registerAutoLink as Yr, createLinkMatcherWithRegExp as mt, LinkNode as Qr, AutoLinkNode as Zr } from "@lexical/link";
|
|
12
|
+
import { registerHistory as eo, createEmptyHistoryState as to } from "@lexical/history";
|
|
13
|
+
import { $generateNodesFromDOM as dn, $generateHtmlFromNodes as no } from "@lexical/html";
|
|
14
|
+
import { $getSelectionStyleValueForProperty as ro, $setBlocksType as Be, $patchStyleText as gt, $trimTextContentFromAnchor as ht } from "@lexical/selection";
|
|
15
|
+
import { $getNearestNodeOfType as oo, $findMatchingParent as ao, $insertNodeToNearestRoot as un } from "@lexical/utils";
|
|
16
|
+
import { codeBlockLanguagePanel as Ue, isCommandStateForCommand as so, resolveToolbarMenu as Ze, defaultMenuSchema as Ne, tableHeaderMenuItems as io } from "./native-spec.js";
|
|
17
|
+
import { r as mn } from "./index-sbZNOcCB.js";
|
|
18
|
+
import { normalizeCodeLanguage as lo, getCodeLanguageOptions as co, ShikiTokenizer as pt, isCodeLanguageLoaded as gn, loadCodeLanguage as uo, loadCodeTheme as mo, registerCodeHighlighting as go } from "@lexical/code-shiki";
|
|
19
|
+
import { autoUpdate as ho, computePosition as po, platform as fo, offset as bo, flip as yo, shift as vo } from "@floating-ui/dom";
|
|
20
|
+
const ft = "bridgerte-media", bt = (e, t) => `${e}:${t}`, ne = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.floor(e) : void 0, yt = (e) => typeof e == "number" && Number.isFinite(e) ? Math.min(Math.max(e, 0), 100) : void 0, wo = (e) => e === 20 || e === 50 || e === 100, vt = (e) => wo(e) ? e : void 0, wt = (e) => e === "center" || e === "right" ? e : void 0, Co = (e) => e.status === "error" ? e.errorMessage ?? "媒体加载失败" : e.status === "uploading" ? `上传中 ${e.progress ?? 0}%` : e.mediaType === "image" ? "图片加载中" : "视频加载中", De = (e, t, n) => {
|
|
21
21
|
n && e.setAttribute(t, n);
|
|
22
|
-
},
|
|
22
|
+
}, Ct = (e, t, n) => {
|
|
23
23
|
n !== void 0 && e.setAttribute(t, String(n));
|
|
24
24
|
};
|
|
25
|
-
class se extends
|
|
25
|
+
class se extends nn {
|
|
26
26
|
constructor(n, r) {
|
|
27
27
|
super(r);
|
|
28
28
|
Re(this, "__payload");
|
|
29
29
|
this.__payload = {
|
|
30
30
|
...n,
|
|
31
|
-
assetId: n.assetId ??
|
|
31
|
+
assetId: n.assetId ?? bt(n.mediaType, n.url),
|
|
32
32
|
width: ne(n.width),
|
|
33
33
|
height: ne(n.height),
|
|
34
34
|
duration: ne(n.duration),
|
|
35
|
-
progress:
|
|
36
|
-
displayWidthPercent:
|
|
37
|
-
align:
|
|
35
|
+
progress: yt(n.progress),
|
|
36
|
+
displayWidthPercent: vt(n.displayWidthPercent),
|
|
37
|
+
align: wt(n.align)
|
|
38
38
|
}, this.__payload.displayWidthPercent === void 0 && delete this.__payload.displayWidthPercent, this.__payload.align === void 0 && delete this.__payload.align;
|
|
39
39
|
}
|
|
40
40
|
static getType() {
|
|
41
|
-
return
|
|
41
|
+
return ft;
|
|
42
42
|
}
|
|
43
43
|
static clone(n) {
|
|
44
44
|
return new se(n.__payload, n.__key);
|
|
@@ -57,11 +57,11 @@ class se extends tn {
|
|
|
57
57
|
static importDOM() {
|
|
58
58
|
return {
|
|
59
59
|
img: () => ({
|
|
60
|
-
conversion:
|
|
60
|
+
conversion: _o,
|
|
61
61
|
priority: 1
|
|
62
62
|
}),
|
|
63
63
|
video: () => ({
|
|
64
|
-
conversion:
|
|
64
|
+
conversion: ko,
|
|
65
65
|
priority: 1
|
|
66
66
|
})
|
|
67
67
|
};
|
|
@@ -73,7 +73,7 @@ class se extends tn {
|
|
|
73
73
|
return {
|
|
74
74
|
...super.exportJSON(),
|
|
75
75
|
...this.__payload,
|
|
76
|
-
type:
|
|
76
|
+
type: ft
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
getTextContent() {
|
|
@@ -84,7 +84,7 @@ class se extends tn {
|
|
|
84
84
|
}
|
|
85
85
|
getAsset() {
|
|
86
86
|
const n = this.__payload, r = {
|
|
87
|
-
id: n.assetId ??
|
|
87
|
+
id: n.assetId ?? bt(n.mediaType, n.url),
|
|
88
88
|
type: n.mediaType,
|
|
89
89
|
url: n.url,
|
|
90
90
|
status: n.status,
|
|
@@ -108,12 +108,12 @@ class se extends tn {
|
|
|
108
108
|
width: ne(n.width ?? r.__payload.width),
|
|
109
109
|
height: ne(n.height ?? r.__payload.height),
|
|
110
110
|
duration: ne(n.duration ?? r.__payload.duration),
|
|
111
|
-
progress:
|
|
111
|
+
progress: yt(n.progress ?? r.__payload.progress),
|
|
112
112
|
displayWidthPercent: Object.prototype.hasOwnProperty.call(
|
|
113
113
|
n,
|
|
114
114
|
"displayWidthPercent"
|
|
115
|
-
) ?
|
|
116
|
-
align: Object.prototype.hasOwnProperty.call(n, "align") ?
|
|
115
|
+
) ? vt(n.displayWidthPercent) : r.__payload.displayWidthPercent,
|
|
116
|
+
align: Object.prototype.hasOwnProperty.call(n, "align") ? wt(n.align) : r.__payload.align
|
|
117
117
|
}, r.__payload.displayWidthPercent === void 0 && delete r.__payload.displayWidthPercent, r.__payload.align === void 0 && delete r.__payload.align;
|
|
118
118
|
}
|
|
119
119
|
createMediaElement(n) {
|
|
@@ -132,9 +132,9 @@ class se extends tn {
|
|
|
132
132
|
{ once: !0 }
|
|
133
133
|
), a.addEventListener("error", () => {
|
|
134
134
|
o.dataset.loadState = "error";
|
|
135
|
-
}, { once: !0 })), r.mediaType === "image" ? (a.setAttribute("src", r.url), a.setAttribute("loading", "lazy"), De(a, "alt", r.alt ?? r.title)) : (a.setAttribute("src", r.url), a.setAttribute("controls", "true"), a.setAttribute("preload", "metadata"), De(a, "poster", r.poster)), De(a, "title", r.title),
|
|
135
|
+
}, { once: !0 })), r.mediaType === "image" ? (a.setAttribute("src", r.url), a.setAttribute("loading", "lazy"), De(a, "alt", r.alt ?? r.title)) : (a.setAttribute("src", r.url), a.setAttribute("controls", "true"), a.setAttribute("preload", "metadata"), De(a, "poster", r.poster)), De(a, "title", r.title), Ct(a, "width", r.width), Ct(a, "height", r.height), n) {
|
|
136
136
|
const l = document.createElement("div"), d = document.createElement("span"), i = document.createElement("span");
|
|
137
|
-
l.className = "bridgerte__media-placeholder", l.setAttribute("aria-hidden", "true"), d.className = "bridgerte__media-placeholder-icon", d.textContent = r.mediaType === "image" ? "IMG" : "VIDEO", i.className = "bridgerte__media-placeholder-text", i.textContent =
|
|
137
|
+
l.className = "bridgerte__media-placeholder", l.setAttribute("aria-hidden", "true"), d.className = "bridgerte__media-placeholder-icon", d.textContent = r.mediaType === "image" ? "IMG" : "VIDEO", i.className = "bridgerte__media-placeholder-text", i.textContent = Co(r), l.append(d, i), o.append(l);
|
|
138
138
|
}
|
|
139
139
|
if (o.append(a), r.status === "uploading" || r.status === "error") {
|
|
140
140
|
const l = document.createElement("figcaption");
|
|
@@ -143,7 +143,7 @@ class se extends tn {
|
|
|
143
143
|
return o;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
const
|
|
146
|
+
const _o = (e) => {
|
|
147
147
|
const t = e instanceof HTMLImageElement ? e : null;
|
|
148
148
|
return {
|
|
149
149
|
/*
|
|
@@ -160,7 +160,7 @@ const Co = (e) => {
|
|
|
160
160
|
status: "success"
|
|
161
161
|
}) : null
|
|
162
162
|
};
|
|
163
|
-
},
|
|
163
|
+
}, ko = (e) => {
|
|
164
164
|
const t = e instanceof HTMLVideoElement ? e : null;
|
|
165
165
|
return {
|
|
166
166
|
/*
|
|
@@ -176,7 +176,7 @@ const Co = (e) => {
|
|
|
176
176
|
status: "success"
|
|
177
177
|
}) : null
|
|
178
178
|
};
|
|
179
|
-
}, ie = (e) =>
|
|
179
|
+
}, ie = (e) => Qe(new se(e)), xo = (e) => ie({
|
|
180
180
|
mediaType: "image",
|
|
181
181
|
url: e.url,
|
|
182
182
|
alt: e.alt,
|
|
@@ -187,7 +187,7 @@ const Co = (e) => {
|
|
|
187
187
|
align: e.align,
|
|
188
188
|
assetId: e.assetId,
|
|
189
189
|
status: "success"
|
|
190
|
-
}),
|
|
190
|
+
}), Eo = (e) => ie({
|
|
191
191
|
mediaType: "video",
|
|
192
192
|
url: e.url,
|
|
193
193
|
poster: e.poster,
|
|
@@ -198,10 +198,10 @@ const Co = (e) => {
|
|
|
198
198
|
align: e.align,
|
|
199
199
|
assetId: e.assetId,
|
|
200
200
|
status: "success"
|
|
201
|
-
}),
|
|
201
|
+
}), hn = (e) => e instanceof se, ue = (e) => {
|
|
202
202
|
const t = (n) => {
|
|
203
|
-
if (
|
|
204
|
-
if (!
|
|
203
|
+
if (hn(n) && n.getAsset().id === e) return n;
|
|
204
|
+
if (!Ve(n)) return null;
|
|
205
205
|
for (const r of n.getChildren()) {
|
|
206
206
|
const o = t(r);
|
|
207
207
|
if (o) return o;
|
|
@@ -209,51 +209,51 @@ const Co = (e) => {
|
|
|
209
209
|
return null;
|
|
210
210
|
};
|
|
211
211
|
return t($());
|
|
212
|
-
},
|
|
212
|
+
}, pn = {
|
|
213
213
|
root: {
|
|
214
214
|
type: "root",
|
|
215
215
|
version: 1,
|
|
216
216
|
children: []
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
|
-
function
|
|
219
|
+
function je(e = {}) {
|
|
220
220
|
return {
|
|
221
221
|
html: e.html ?? "",
|
|
222
|
-
json: e.json ??
|
|
222
|
+
json: e.json ?? pn,
|
|
223
223
|
plainText: e.plainText ?? "",
|
|
224
224
|
assets: e.assets ?? [],
|
|
225
225
|
version: e.version ?? Le
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
const
|
|
228
|
+
const Mo = (e) => e.toJSON(), To = (e) => {
|
|
229
229
|
var t;
|
|
230
230
|
return ((t = e.root.children) == null ? void 0 : t.length) === 0;
|
|
231
|
-
},
|
|
231
|
+
}, Lo = (e) => e.read(() => {
|
|
232
232
|
const t = /* @__PURE__ */ new Map(), n = (r) => {
|
|
233
|
-
|
|
234
|
-
if (
|
|
233
|
+
Ve(r) && r.getChildren().forEach((o) => {
|
|
234
|
+
if (hn(o)) {
|
|
235
235
|
const a = o.getAsset();
|
|
236
236
|
t.set(a.id, a);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
Ve(o) && n(o);
|
|
240
240
|
});
|
|
241
241
|
};
|
|
242
242
|
return n($()), [...t.values()];
|
|
243
|
-
}),
|
|
244
|
-
const n = t.read(() =>
|
|
243
|
+
}), fn = (e, t) => {
|
|
244
|
+
const n = t.read(() => no(t)), r = e.read(() => $().getTextContent()), o = Lo(e);
|
|
245
245
|
return {
|
|
246
246
|
html: n,
|
|
247
|
-
json:
|
|
247
|
+
json: Mo(e),
|
|
248
248
|
plainText: r,
|
|
249
249
|
assets: o,
|
|
250
250
|
version: Le
|
|
251
251
|
};
|
|
252
|
-
},
|
|
253
|
-
const n =
|
|
254
|
-
return
|
|
255
|
-
},
|
|
256
|
-
if (t.json !==
|
|
252
|
+
}, So = (e, t) => {
|
|
253
|
+
const n = je(t);
|
|
254
|
+
return bn(e, n), fn(e.getEditorState(), e);
|
|
255
|
+
}, bn = (e, t) => {
|
|
256
|
+
if (t.json !== pn && !To(t.json)) {
|
|
257
257
|
const o = t.json;
|
|
258
258
|
e.setEditorState(e.parseEditorState(o));
|
|
259
259
|
return;
|
|
@@ -271,13 +271,13 @@ const Eo = (e) => e.toJSON(), Mo = (e) => {
|
|
|
271
271
|
const r = new DOMParser().parseFromString(t.html, "text/html");
|
|
272
272
|
e.update(
|
|
273
273
|
() => {
|
|
274
|
-
const o = $(), a =
|
|
274
|
+
const o = $(), a = dn(e, r);
|
|
275
275
|
o.clear(), o.append(...a);
|
|
276
276
|
},
|
|
277
277
|
{ discrete: !0 }
|
|
278
278
|
);
|
|
279
279
|
};
|
|
280
|
-
class ge extends
|
|
280
|
+
class ge extends nn {
|
|
281
281
|
static getType() {
|
|
282
282
|
return "bridgerte-divider";
|
|
283
283
|
}
|
|
@@ -301,13 +301,13 @@ class ge extends tn {
|
|
|
301
301
|
static importDOM() {
|
|
302
302
|
return {
|
|
303
303
|
hr: () => ({
|
|
304
|
-
conversion:
|
|
304
|
+
conversion: No,
|
|
305
305
|
priority: 0
|
|
306
306
|
})
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
static importJSON(t) {
|
|
310
|
-
return
|
|
310
|
+
return et().updateFromJSON(t);
|
|
311
311
|
}
|
|
312
312
|
exportJSON() {
|
|
313
313
|
return {
|
|
@@ -323,50 +323,50 @@ class ge extends tn {
|
|
|
323
323
|
return !1;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
const
|
|
327
|
-
node:
|
|
328
|
-
}),
|
|
326
|
+
const No = (e) => ({
|
|
327
|
+
node: et()
|
|
328
|
+
}), et = () => Qe(new ge()), _t = "bridgerte-mention", tt = "mention", yn = (e) => e.label.startsWith("@") ? e.label : `@${e.label}`, Po = (e) => {
|
|
329
329
|
const t = document.createElement("span");
|
|
330
|
-
return t.className = "bridgerte__mention", t.dataset.type =
|
|
330
|
+
return t.className = "bridgerte__mention", t.dataset.type = tt, t.dataset.id = e.id, t.dataset.value = e.value, t.contentEditable = "false", t.textContent = yn(e), e.description && (t.dataset.description = e.description), t;
|
|
331
331
|
};
|
|
332
332
|
class pe extends ee {
|
|
333
|
-
constructor(n, r =
|
|
333
|
+
constructor(n, r = yn(n), o) {
|
|
334
334
|
super(r, o);
|
|
335
335
|
Re(this, "__item");
|
|
336
336
|
this.__item = n;
|
|
337
337
|
}
|
|
338
338
|
static getType() {
|
|
339
|
-
return
|
|
339
|
+
return _t;
|
|
340
340
|
}
|
|
341
341
|
static clone(n) {
|
|
342
342
|
return new pe(n.__item, n.__text, n.__key);
|
|
343
343
|
}
|
|
344
344
|
createDOM(n) {
|
|
345
345
|
const r = super.createDOM(n);
|
|
346
|
-
return r.className = "bridgerte__mention", r.dataset.type =
|
|
346
|
+
return r.className = "bridgerte__mention", r.dataset.type = tt, r.dataset.id = this.__item.id, r.dataset.value = this.__item.value, r.contentEditable = "false", this.__item.description && (r.dataset.description = this.__item.description), r;
|
|
347
347
|
}
|
|
348
348
|
updateDOM(n, r, o) {
|
|
349
349
|
return super.updateDOM(n, r, o) ? !0 : (r.dataset.id = this.__item.id, r.dataset.value = this.__item.value, this.__item.description ? r.dataset.description = this.__item.description : delete r.dataset.description, !1);
|
|
350
350
|
}
|
|
351
351
|
exportDOM(n) {
|
|
352
|
-
return { element:
|
|
352
|
+
return { element: Po(this.__item) };
|
|
353
353
|
}
|
|
354
354
|
static importDOM() {
|
|
355
355
|
return {
|
|
356
356
|
span: () => ({
|
|
357
|
-
conversion:
|
|
357
|
+
conversion: Io,
|
|
358
358
|
priority: 2
|
|
359
359
|
})
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
static importJSON(n) {
|
|
363
|
-
return
|
|
363
|
+
return nt(n).updateFromJSON(n);
|
|
364
364
|
}
|
|
365
365
|
exportJSON() {
|
|
366
366
|
return {
|
|
367
367
|
...super.exportJSON(),
|
|
368
368
|
...this.__item,
|
|
369
|
-
type:
|
|
369
|
+
type: _t
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
372
|
isTextEntity() {
|
|
@@ -379,33 +379,33 @@ class pe extends ee {
|
|
|
379
379
|
return this.__item;
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
const
|
|
382
|
+
const Io = (e) => {
|
|
383
383
|
var a;
|
|
384
384
|
const t = e instanceof HTMLElement ? e : null;
|
|
385
|
-
if (!t || t.dataset.type !==
|
|
385
|
+
if (!t || t.dataset.type !== tt)
|
|
386
386
|
return { node: null };
|
|
387
387
|
const n = ((a = t.textContent) == null ? void 0 : a.replace(/^@/, "")) || t.dataset.value || "", r = t.dataset.id || t.dataset.value || n, o = t.dataset.value || r;
|
|
388
388
|
return !n || !r || !o ? { node: null } : {
|
|
389
|
-
node:
|
|
389
|
+
node: nt({
|
|
390
390
|
id: r,
|
|
391
391
|
label: n,
|
|
392
392
|
value: o,
|
|
393
393
|
description: t.dataset.description
|
|
394
394
|
})
|
|
395
395
|
};
|
|
396
|
-
},
|
|
396
|
+
}, nt = (e) => Qe(new pe(e).setMode("token")), kt = (e) => e instanceof pe, Ro = "请输入内容", Ao = () => {
|
|
397
397
|
const t = $().getChildren();
|
|
398
398
|
if (t.length === 0) return !0;
|
|
399
399
|
if (t.length > 1) return !1;
|
|
400
400
|
const n = t[0];
|
|
401
|
-
return
|
|
402
|
-
},
|
|
401
|
+
return Yn(n) && n.getChildrenSize() === 0;
|
|
402
|
+
}, Bo = ({
|
|
403
403
|
editor: e,
|
|
404
404
|
contentElement: t
|
|
405
405
|
}) => {
|
|
406
|
-
const n = e.getEditorState().read(
|
|
406
|
+
const n = e.getEditorState().read(Ao);
|
|
407
407
|
t.dataset.empty = String(n);
|
|
408
|
-
},
|
|
408
|
+
}, Do = ({
|
|
409
409
|
editor: e,
|
|
410
410
|
contentElement: t,
|
|
411
411
|
isReadonly: n
|
|
@@ -420,7 +420,7 @@ const Po = (e) => {
|
|
|
420
420
|
return t.addEventListener("pointerdown", r), () => {
|
|
421
421
|
t.removeEventListener("pointerdown", r);
|
|
422
422
|
};
|
|
423
|
-
},
|
|
423
|
+
}, Oo = [
|
|
424
424
|
{ command: "format.bold", format: "bold" },
|
|
425
425
|
{ command: "format.italic", format: "italic" },
|
|
426
426
|
{ command: "format.underline", format: "underline" },
|
|
@@ -428,35 +428,35 @@ const Po = (e) => {
|
|
|
428
428
|
{ command: "format.inlineCode", format: "code" },
|
|
429
429
|
{ command: "format.superscript", format: "superscript" },
|
|
430
430
|
{ command: "format.subscript", format: "subscript" }
|
|
431
|
-
],
|
|
431
|
+
], Ho = [
|
|
432
432
|
{ command: "format.color", property: "color" },
|
|
433
433
|
{ command: "format.backgroundColor", property: "background-color" },
|
|
434
434
|
{ command: "format.fontSize", property: "font-size" },
|
|
435
435
|
{ command: "format.fontFamily", property: "font-family" },
|
|
436
436
|
{ command: "format.lineHeight", property: "line-height" }
|
|
437
|
-
],
|
|
437
|
+
], $o = [
|
|
438
438
|
{ command: "list.ordered", listType: "ordered" },
|
|
439
439
|
{ command: "list.unordered", listType: "unordered" },
|
|
440
440
|
{ command: "list.todo", listType: "todo" }
|
|
441
|
-
],
|
|
441
|
+
], Fo = [
|
|
442
442
|
"media.pickImage",
|
|
443
443
|
"media.pickVideo"
|
|
444
|
-
],
|
|
444
|
+
], vn = () => {
|
|
445
445
|
const e = A();
|
|
446
446
|
if (!D(e)) return null;
|
|
447
447
|
const t = e.anchor.getNode();
|
|
448
448
|
return t.getKey() === "root" ? t : t.getTopLevelElementOrThrow();
|
|
449
|
-
},
|
|
450
|
-
const e =
|
|
449
|
+
}, zo = () => {
|
|
450
|
+
const e = vn();
|
|
451
451
|
if (!e) return null;
|
|
452
|
-
if (
|
|
452
|
+
if (br(e)) {
|
|
453
453
|
const t = Number(e.getTag().replace("h", ""));
|
|
454
454
|
return {
|
|
455
455
|
command: "block.heading",
|
|
456
456
|
value: Number.isNaN(t) ? void 0 : t
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
if (
|
|
459
|
+
if (yr(e))
|
|
460
460
|
return {
|
|
461
461
|
command: "block.quote"
|
|
462
462
|
};
|
|
@@ -470,44 +470,44 @@ const Po = (e) => {
|
|
|
470
470
|
return {
|
|
471
471
|
command: "block.paragraph"
|
|
472
472
|
};
|
|
473
|
-
},
|
|
474
|
-
const e =
|
|
473
|
+
}, Vo = () => {
|
|
474
|
+
const e = vn();
|
|
475
475
|
if (!e || !("getFormatType" in e)) return;
|
|
476
476
|
const t = e.getFormatType();
|
|
477
477
|
return t === "" ? void 0 : t;
|
|
478
478
|
}, Wo = () => {
|
|
479
479
|
const e = A();
|
|
480
480
|
if (!D(e)) return null;
|
|
481
|
-
const t = e.anchor.getNode(), n =
|
|
481
|
+
const t = e.anchor.getNode(), n = Lr(t) ? t : oo(t, ln);
|
|
482
482
|
return n ? n.getListType() === "check" ? "todo" : n.getTag() === "ol" ? "ordered" : "unordered" : null;
|
|
483
|
-
},
|
|
483
|
+
}, Uo = (e) => {
|
|
484
484
|
const t = A();
|
|
485
485
|
if (!D(t)) return;
|
|
486
|
-
const n =
|
|
486
|
+
const n = ro(t, e);
|
|
487
487
|
return n === "" ? void 0 : n;
|
|
488
|
-
},
|
|
488
|
+
}, jo = () => {
|
|
489
489
|
const e = A();
|
|
490
490
|
if (!D(e)) return !1;
|
|
491
491
|
const t = e.anchor.getNode(), n = t.getParent();
|
|
492
492
|
return xe(t) || xe(n);
|
|
493
|
-
},
|
|
494
|
-
const t = A(), n = D(t), r =
|
|
493
|
+
}, qo = (e) => {
|
|
494
|
+
const t = A(), n = D(t), r = zo(), o = Wo(), a = Vo(), s = jo(), l = e.readonly || !n, d = Oo.map((C) => ({
|
|
495
495
|
command: C.command,
|
|
496
496
|
active: n && t.hasFormat(C.format),
|
|
497
497
|
disabled: l
|
|
498
|
-
})), i =
|
|
499
|
-
const
|
|
498
|
+
})), i = Ho.map((C) => {
|
|
499
|
+
const T = Uo(C.property);
|
|
500
500
|
return {
|
|
501
501
|
command: C.command,
|
|
502
|
-
active:
|
|
502
|
+
active: T !== void 0,
|
|
503
503
|
disabled: l,
|
|
504
|
-
value:
|
|
504
|
+
value: T
|
|
505
505
|
};
|
|
506
|
-
}),
|
|
506
|
+
}), h = $o.map((C) => ({
|
|
507
507
|
command: C.command,
|
|
508
508
|
active: o === C.listType,
|
|
509
509
|
disabled: l
|
|
510
|
-
})), w =
|
|
510
|
+
})), w = Fo.map((C) => ({
|
|
511
511
|
command: C,
|
|
512
512
|
active: !1,
|
|
513
513
|
disabled: e.readonly || !e.canUploadMedia
|
|
@@ -547,7 +547,7 @@ const Po = (e) => {
|
|
|
547
547
|
disabled: e.readonly,
|
|
548
548
|
value: (r == null ? void 0 : r.command) === "block.code" ? r.value : void 0
|
|
549
549
|
},
|
|
550
|
-
...
|
|
550
|
+
...h,
|
|
551
551
|
{
|
|
552
552
|
command: "align",
|
|
553
553
|
active: a !== void 0,
|
|
@@ -606,7 +606,7 @@ const Po = (e) => {
|
|
|
606
606
|
disabled: !1
|
|
607
607
|
}
|
|
608
608
|
];
|
|
609
|
-
},
|
|
609
|
+
}, Ko = (e, t) => e.length === t.length && e.every((n, r) => {
|
|
610
610
|
const o = t[r];
|
|
611
611
|
return o !== void 0 && n.command === o.command && n.active === o.active && n.disabled === o.disabled && n.value === o.value;
|
|
612
612
|
}), j = (e, t, n, r) => {
|
|
@@ -616,14 +616,14 @@ const Po = (e) => {
|
|
|
616
616
|
} catch (a) {
|
|
617
617
|
console.error("[BridgeRTE] onError callback failed.", a);
|
|
618
618
|
}
|
|
619
|
-
},
|
|
619
|
+
}, Go = (e, t) => {
|
|
620
620
|
var n;
|
|
621
621
|
try {
|
|
622
622
|
(n = e.onChange) == null || n.call(e, t);
|
|
623
623
|
} catch (r) {
|
|
624
624
|
j(e, "callback.onChange", "onChange callback failed.", r);
|
|
625
625
|
}
|
|
626
|
-
},
|
|
626
|
+
}, Xo = (e, t) => {
|
|
627
627
|
var n;
|
|
628
628
|
try {
|
|
629
629
|
(n = e.onContentChange) == null || n.call(e, t);
|
|
@@ -635,7 +635,7 @@ const Po = (e) => {
|
|
|
635
635
|
r
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
|
-
},
|
|
638
|
+
}, Jo = (e, t) => {
|
|
639
639
|
var n;
|
|
640
640
|
try {
|
|
641
641
|
(n = e.onCommandStateChange) == null || n.call(e, [...t]);
|
|
@@ -647,28 +647,28 @@ const Po = (e) => {
|
|
|
647
647
|
r
|
|
648
648
|
);
|
|
649
649
|
}
|
|
650
|
-
},
|
|
650
|
+
}, Yo = (e) => {
|
|
651
651
|
var t;
|
|
652
652
|
try {
|
|
653
653
|
(t = e.onFocus) == null || t.call(e);
|
|
654
654
|
} catch (n) {
|
|
655
655
|
j(e, "callback.onFocus", "onFocus callback failed.", n);
|
|
656
656
|
}
|
|
657
|
-
},
|
|
657
|
+
}, Qo = (e) => {
|
|
658
658
|
var t;
|
|
659
659
|
try {
|
|
660
660
|
(t = e.onBlur) == null || t.call(e);
|
|
661
661
|
} catch (n) {
|
|
662
662
|
j(e, "callback.onBlur", "onBlur callback failed.", n);
|
|
663
663
|
}
|
|
664
|
-
},
|
|
664
|
+
}, Zo = (e, t) => {
|
|
665
665
|
var n;
|
|
666
666
|
try {
|
|
667
667
|
(n = e.onReady) == null || n.call(e, t);
|
|
668
668
|
} catch (r) {
|
|
669
669
|
j(e, "callback.onReady", "onReady callback failed.", r);
|
|
670
670
|
}
|
|
671
|
-
},
|
|
671
|
+
}, ea = ({
|
|
672
672
|
lexicalEditor: e,
|
|
673
673
|
options: t,
|
|
674
674
|
isDestroyed: n,
|
|
@@ -681,31 +681,31 @@ const Po = (e) => {
|
|
|
681
681
|
d.forEach((C) => {
|
|
682
682
|
try {
|
|
683
683
|
C(w);
|
|
684
|
-
} catch (
|
|
684
|
+
} catch (T) {
|
|
685
685
|
j(
|
|
686
686
|
t,
|
|
687
687
|
"callback.commandStateSubscriber",
|
|
688
688
|
"Command state subscriber failed.",
|
|
689
|
-
|
|
689
|
+
T
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
692
|
});
|
|
693
|
-
},
|
|
693
|
+
}, h = (w = !0) => {
|
|
694
694
|
if (n()) return;
|
|
695
695
|
const C = l;
|
|
696
696
|
e.getEditorState().read(() => {
|
|
697
|
-
l =
|
|
697
|
+
l = qo({
|
|
698
698
|
canUndo: a,
|
|
699
699
|
canRedo: s,
|
|
700
700
|
readonly: o(),
|
|
701
701
|
canUploadMedia: r()
|
|
702
702
|
});
|
|
703
|
-
}), w && !
|
|
703
|
+
}), w && !Ko(C, l) && (Jo(t, l), i());
|
|
704
704
|
};
|
|
705
705
|
return {
|
|
706
|
-
refreshCommandStates:
|
|
706
|
+
refreshCommandStates: h,
|
|
707
707
|
getCommandStates() {
|
|
708
|
-
return
|
|
708
|
+
return h(!1), [...l];
|
|
709
709
|
},
|
|
710
710
|
subscribeCommandStateChange(w) {
|
|
711
711
|
return n() ? () => {
|
|
@@ -714,26 +714,26 @@ const Po = (e) => {
|
|
|
714
714
|
});
|
|
715
715
|
},
|
|
716
716
|
setCanUndo(w) {
|
|
717
|
-
a = w,
|
|
717
|
+
a = w, h();
|
|
718
718
|
},
|
|
719
719
|
setCanRedo(w) {
|
|
720
|
-
s = w,
|
|
720
|
+
s = w, h();
|
|
721
721
|
},
|
|
722
722
|
setHistoryAvailability(w, C) {
|
|
723
|
-
a = w, s = C,
|
|
723
|
+
a = w, s = C, h();
|
|
724
724
|
},
|
|
725
725
|
destroy() {
|
|
726
726
|
d.clear();
|
|
727
727
|
}
|
|
728
728
|
};
|
|
729
|
-
},
|
|
729
|
+
}, ta = (e) => `upload:${e}:${Date.now()}:${Math.random().toString(36).slice(2)}`, na = (e) => typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : e.name, fe = (e) => {
|
|
730
730
|
typeof URL.revokeObjectURL == "function" && e.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
731
|
-
},
|
|
731
|
+
}, xt = (e) => ({
|
|
732
732
|
name: e.name,
|
|
733
733
|
mimeType: e.type || void 0,
|
|
734
734
|
size: e.size,
|
|
735
735
|
data: e
|
|
736
|
-
}),
|
|
736
|
+
}), ra = (e) => typeof DOMException < "u" && e instanceof DOMException && e.name === "AbortError", oa = ({
|
|
737
737
|
container: e,
|
|
738
738
|
lexicalEditor: t,
|
|
739
739
|
options: n,
|
|
@@ -741,96 +741,96 @@ const Po = (e) => {
|
|
|
741
741
|
}) => {
|
|
742
742
|
const o = /* @__PURE__ */ new Map();
|
|
743
743
|
let a = 0;
|
|
744
|
-
const s = (
|
|
744
|
+
const s = (m, f) => {
|
|
745
745
|
t.update(() => {
|
|
746
|
-
var
|
|
747
|
-
(
|
|
746
|
+
var E;
|
|
747
|
+
(E = ue(m)) == null || E.updatePayload(f);
|
|
748
748
|
});
|
|
749
|
-
}, l = (
|
|
750
|
-
let
|
|
749
|
+
}, l = (m) => {
|
|
750
|
+
let f = null;
|
|
751
751
|
return t.update(() => {
|
|
752
|
-
const
|
|
753
|
-
if (!
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
mediaType:
|
|
757
|
-
url:
|
|
758
|
-
assetId:
|
|
759
|
-
status:
|
|
760
|
-
progress:
|
|
761
|
-
poster:
|
|
762
|
-
width:
|
|
763
|
-
height:
|
|
764
|
-
duration:
|
|
765
|
-
mimeType:
|
|
766
|
-
size:
|
|
767
|
-
displayWidthPercent:
|
|
768
|
-
align:
|
|
769
|
-
errorMessage:
|
|
770
|
-
},
|
|
771
|
-
}),
|
|
772
|
-
}, d = (
|
|
773
|
-
const
|
|
774
|
-
return (
|
|
775
|
-
}, i = (
|
|
776
|
-
var
|
|
777
|
-
(
|
|
778
|
-
},
|
|
779
|
-
const
|
|
780
|
-
return
|
|
781
|
-
}, w = (
|
|
752
|
+
const E = ue(m);
|
|
753
|
+
if (!E) return;
|
|
754
|
+
const k = E.getAsset();
|
|
755
|
+
f = {
|
|
756
|
+
mediaType: k.type,
|
|
757
|
+
url: k.url,
|
|
758
|
+
assetId: k.id,
|
|
759
|
+
status: k.status,
|
|
760
|
+
progress: k.progress,
|
|
761
|
+
poster: k.poster,
|
|
762
|
+
width: k.width,
|
|
763
|
+
height: k.height,
|
|
764
|
+
duration: k.duration,
|
|
765
|
+
mimeType: k.mimeType,
|
|
766
|
+
size: k.size,
|
|
767
|
+
displayWidthPercent: k.displayWidthPercent,
|
|
768
|
+
align: k.align,
|
|
769
|
+
errorMessage: k.errorMessage
|
|
770
|
+
}, E.remove();
|
|
771
|
+
}), f;
|
|
772
|
+
}, d = (m, f) => {
|
|
773
|
+
const E = o.get(m);
|
|
774
|
+
return (E == null ? void 0 : E.runId) === f;
|
|
775
|
+
}, i = (m) => {
|
|
776
|
+
var f;
|
|
777
|
+
(f = m.abortController) == null || f.abort();
|
|
778
|
+
}, h = (m, f) => {
|
|
779
|
+
const E = o.get(m);
|
|
780
|
+
return E ? (i(E), fe(E.previewUrl), o.delete(m), !0) : !1;
|
|
781
|
+
}, w = (m, f, E, k) => {
|
|
782
782
|
t.update(
|
|
783
783
|
() => {
|
|
784
784
|
const I = ie({
|
|
785
|
-
mediaType:
|
|
786
|
-
url:
|
|
787
|
-
assetId:
|
|
785
|
+
mediaType: m,
|
|
786
|
+
url: k,
|
|
787
|
+
assetId: E,
|
|
788
788
|
status: "uploading",
|
|
789
789
|
progress: 0,
|
|
790
|
-
title:
|
|
791
|
-
mimeType:
|
|
792
|
-
size:
|
|
790
|
+
title: f.name,
|
|
791
|
+
mimeType: f.type || void 0,
|
|
792
|
+
size: f.size
|
|
793
793
|
}), R = z();
|
|
794
|
-
A() || $().selectEnd(),
|
|
794
|
+
A() || $().selectEnd(), V([I, R]), R.selectStart();
|
|
795
795
|
},
|
|
796
796
|
{ discrete: !0 }
|
|
797
797
|
);
|
|
798
|
-
}, C = (
|
|
799
|
-
s(
|
|
800
|
-
mediaType:
|
|
801
|
-
url:
|
|
802
|
-
poster:
|
|
803
|
-
width:
|
|
804
|
-
height:
|
|
805
|
-
duration:
|
|
806
|
-
mimeType:
|
|
807
|
-
size:
|
|
798
|
+
}, C = (m, f, E, k) => {
|
|
799
|
+
s(f, {
|
|
800
|
+
mediaType: m,
|
|
801
|
+
url: k.url,
|
|
802
|
+
poster: k.poster,
|
|
803
|
+
width: k.width,
|
|
804
|
+
height: k.height,
|
|
805
|
+
duration: k.duration,
|
|
806
|
+
mimeType: k.mimeType,
|
|
807
|
+
size: k.size,
|
|
808
808
|
status: "success",
|
|
809
809
|
progress: 100,
|
|
810
810
|
errorMessage: void 0
|
|
811
|
-
}), fe(
|
|
812
|
-
},
|
|
813
|
-
var
|
|
814
|
-
|
|
815
|
-
mediaType:
|
|
811
|
+
}), fe(E);
|
|
812
|
+
}, T = (m, f, E) => {
|
|
813
|
+
var k;
|
|
814
|
+
ra(E) || (s(f, {
|
|
815
|
+
mediaType: m,
|
|
816
816
|
status: "error",
|
|
817
817
|
errorMessage: "上传失败"
|
|
818
|
-
}), (
|
|
819
|
-
assetId:
|
|
820
|
-
type:
|
|
821
|
-
cause:
|
|
818
|
+
}), (k = n.onUploadError) == null || k.call(n, {
|
|
819
|
+
assetId: f,
|
|
820
|
+
type: m,
|
|
821
|
+
cause: E
|
|
822
822
|
}));
|
|
823
|
-
},
|
|
824
|
-
const
|
|
825
|
-
if (!
|
|
826
|
-
const
|
|
827
|
-
a =
|
|
823
|
+
}, b = (m) => {
|
|
824
|
+
const f = n.uploadAdapter;
|
|
825
|
+
if (!f) return;
|
|
826
|
+
const E = typeof AbortController == "function" ? new AbortController() : null, k = a + 1;
|
|
827
|
+
a = k, m.runId = k, m.abortController = E, o.set(m.assetId, m);
|
|
828
828
|
const I = {
|
|
829
|
-
assetId:
|
|
830
|
-
signal:
|
|
829
|
+
assetId: m.assetId,
|
|
830
|
+
signal: E == null ? void 0 : E.signal,
|
|
831
831
|
onProgress: (L) => {
|
|
832
|
-
!d(
|
|
833
|
-
mediaType:
|
|
832
|
+
!d(m.assetId, k) || r() || s(m.assetId, {
|
|
833
|
+
mediaType: m.type,
|
|
834
834
|
status: "uploading",
|
|
835
835
|
progress: L
|
|
836
836
|
});
|
|
@@ -838,67 +838,67 @@ const Po = (e) => {
|
|
|
838
838
|
};
|
|
839
839
|
let R;
|
|
840
840
|
try {
|
|
841
|
-
R =
|
|
841
|
+
R = m.type === "image" ? f.uploadImage(xt(m.file), I) : f.uploadVideo(xt(m.file), I);
|
|
842
842
|
} catch (L) {
|
|
843
|
-
d(
|
|
843
|
+
d(m.assetId, k) && T(m.type, m.assetId, L);
|
|
844
844
|
return;
|
|
845
845
|
}
|
|
846
846
|
R.then((L) => {
|
|
847
|
-
r() || !d(
|
|
847
|
+
r() || !d(m.assetId, k) || (C(m.type, m.assetId, m.previewUrl, L), o.delete(m.assetId));
|
|
848
848
|
}).catch((L) => {
|
|
849
|
-
r() || !d(
|
|
849
|
+
r() || !d(m.assetId, k) || T(m.type, m.assetId, L);
|
|
850
850
|
});
|
|
851
|
-
},
|
|
851
|
+
}, y = (m, f) => {
|
|
852
852
|
if (!n.uploadAdapter) return;
|
|
853
|
-
const
|
|
854
|
-
assetId:
|
|
855
|
-
type:
|
|
856
|
-
file:
|
|
857
|
-
previewUrl:
|
|
853
|
+
const E = ta(m), k = na(f), I = {
|
|
854
|
+
assetId: E,
|
|
855
|
+
type: m,
|
|
856
|
+
file: f,
|
|
857
|
+
previewUrl: k,
|
|
858
858
|
runId: 0,
|
|
859
859
|
abortController: null
|
|
860
860
|
};
|
|
861
|
-
w(
|
|
861
|
+
w(m, f, E, k), b(I);
|
|
862
862
|
};
|
|
863
863
|
return {
|
|
864
|
-
pickMediaFile: (
|
|
864
|
+
pickMediaFile: (m) => {
|
|
865
865
|
if (!n.uploadAdapter) return;
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
var
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
}, { once: !0 }), e.append(
|
|
866
|
+
const f = e.ownerDocument.createElement("input");
|
|
867
|
+
f.type = "file", f.accept = m === "image" ? "image/*" : "video/*", f.style.display = "none", f.addEventListener("change", () => {
|
|
868
|
+
var k;
|
|
869
|
+
const E = (k = f.files) == null ? void 0 : k[0];
|
|
870
|
+
f.remove(), E && y(m, E);
|
|
871
|
+
}, { once: !0 }), e.append(f), f.click();
|
|
872
872
|
},
|
|
873
|
-
uploadMediaFile:
|
|
874
|
-
removeMedia(
|
|
875
|
-
const
|
|
876
|
-
!m
|
|
873
|
+
uploadMediaFile: y,
|
|
874
|
+
removeMedia(m) {
|
|
875
|
+
const f = l(m);
|
|
876
|
+
!h(m) && (f != null && f.url.startsWith("blob:")) && fe(f.url);
|
|
877
877
|
},
|
|
878
|
-
retryMedia(
|
|
879
|
-
const
|
|
880
|
-
!
|
|
881
|
-
mediaType:
|
|
882
|
-
url:
|
|
878
|
+
retryMedia(m) {
|
|
879
|
+
const f = o.get(m);
|
|
880
|
+
!f || !n.uploadAdapter || (i(f), s(m, {
|
|
881
|
+
mediaType: f.type,
|
|
882
|
+
url: f.previewUrl,
|
|
883
883
|
status: "uploading",
|
|
884
884
|
progress: 0,
|
|
885
885
|
errorMessage: void 0
|
|
886
|
-
}),
|
|
886
|
+
}), b(f));
|
|
887
887
|
},
|
|
888
888
|
destroy() {
|
|
889
|
-
o.forEach((
|
|
890
|
-
i(
|
|
889
|
+
o.forEach((m) => {
|
|
890
|
+
i(m), fe(m.previewUrl);
|
|
891
891
|
}), o.clear();
|
|
892
892
|
}
|
|
893
893
|
};
|
|
894
|
-
},
|
|
894
|
+
}, wn = (e) => xr(e), aa = {
|
|
895
895
|
1: "h1",
|
|
896
896
|
2: "h2",
|
|
897
897
|
3: "h3",
|
|
898
898
|
4: "h4",
|
|
899
899
|
5: "h5",
|
|
900
900
|
6: "h6"
|
|
901
|
-
},
|
|
901
|
+
}, sa = {
|
|
902
902
|
code: "bridgerte__code-block",
|
|
903
903
|
codeHighlight: {
|
|
904
904
|
attr: "bridgerte__code-token bridgerte__code-token--attr",
|
|
@@ -959,11 +959,11 @@ const Po = (e) => {
|
|
|
959
959
|
tableCellHeader: "bridgerte__table-cell bridgerte__table-cell--header",
|
|
960
960
|
tableRow: "bridgerte__table-row",
|
|
961
961
|
tableScrollableWrapper: "bridgerte__table-wrapper"
|
|
962
|
-
},
|
|
962
|
+
}, ia = (e) => ({
|
|
963
963
|
setBlockHeading: (i) => {
|
|
964
964
|
e.update(() => {
|
|
965
|
-
const
|
|
966
|
-
D(
|
|
965
|
+
const h = A();
|
|
966
|
+
D(h) && Be(h, () => wr(aa[i]));
|
|
967
967
|
});
|
|
968
968
|
},
|
|
969
969
|
setParagraphBlock: () => {
|
|
@@ -975,26 +975,26 @@ const Po = (e) => {
|
|
|
975
975
|
setQuoteBlock: () => {
|
|
976
976
|
e.update(() => {
|
|
977
977
|
const i = A();
|
|
978
|
-
D(i) && Be(i, () =>
|
|
978
|
+
D(i) && Be(i, () => vr());
|
|
979
979
|
});
|
|
980
980
|
},
|
|
981
981
|
insertDividerBlock: () => {
|
|
982
982
|
e.update(() => {
|
|
983
983
|
const i = z();
|
|
984
|
-
|
|
984
|
+
V([et(), i]), i.selectStart();
|
|
985
985
|
});
|
|
986
986
|
},
|
|
987
987
|
insertCodeBlock: (i) => {
|
|
988
988
|
e.update(() => {
|
|
989
|
-
const
|
|
990
|
-
|
|
989
|
+
const h = wn(i), w = z();
|
|
990
|
+
V([h, w]), h.selectEnd();
|
|
991
991
|
});
|
|
992
992
|
},
|
|
993
993
|
setSelectedCodeBlockLanguage: (i) => {
|
|
994
994
|
e.update(() => {
|
|
995
|
-
const
|
|
996
|
-
if (!D(
|
|
997
|
-
const w =
|
|
995
|
+
const h = A();
|
|
996
|
+
if (!D(h)) return;
|
|
997
|
+
const w = h.anchor.getNode(), C = w.getKey() === "root" ? w : w.getTopLevelElementOrThrow();
|
|
998
998
|
K(C) && C.setLanguage(i);
|
|
999
999
|
});
|
|
1000
1000
|
},
|
|
@@ -1005,22 +1005,22 @@ const Po = (e) => {
|
|
|
1005
1005
|
});
|
|
1006
1006
|
},
|
|
1007
1007
|
formatAlign: (i) => {
|
|
1008
|
-
e.dispatchCommand(
|
|
1008
|
+
e.dispatchCommand(Qn, i);
|
|
1009
1009
|
}
|
|
1010
|
-
}),
|
|
1010
|
+
}), la = (e) => ({
|
|
1011
1011
|
setLink: (o, a) => {
|
|
1012
1012
|
e.update(() => {
|
|
1013
|
-
const s = A(), l =
|
|
1013
|
+
const s = A(), l = Xr(o), d = (a == null ? void 0 : a.trim()) || o.trim();
|
|
1014
1014
|
if (!(!D(s) || !o.trim())) {
|
|
1015
1015
|
if (s.isCollapsed()) {
|
|
1016
|
-
const i =
|
|
1016
|
+
const i = Jr(l, {
|
|
1017
1017
|
rel: "noreferrer noopener",
|
|
1018
1018
|
target: "_blank"
|
|
1019
1019
|
});
|
|
1020
|
-
i.append(Se(d)),
|
|
1020
|
+
i.append(Se(d)), V([i]);
|
|
1021
1021
|
return;
|
|
1022
1022
|
}
|
|
1023
|
-
|
|
1023
|
+
ut(l, {
|
|
1024
1024
|
rel: "noreferrer noopener",
|
|
1025
1025
|
target: "_blank"
|
|
1026
1026
|
});
|
|
@@ -1029,7 +1029,7 @@ const Po = (e) => {
|
|
|
1029
1029
|
},
|
|
1030
1030
|
unsetLink: () => {
|
|
1031
1031
|
e.update(() => {
|
|
1032
|
-
|
|
1032
|
+
ut(null);
|
|
1033
1033
|
});
|
|
1034
1034
|
},
|
|
1035
1035
|
openSelectedLink: () => {
|
|
@@ -1037,7 +1037,7 @@ const Po = (e) => {
|
|
|
1037
1037
|
const o = e.getEditorState().read(() => {
|
|
1038
1038
|
const a = A();
|
|
1039
1039
|
if (!D(a)) return null;
|
|
1040
|
-
const s = a.anchor.getNode(), l = xe(s) ? s :
|
|
1040
|
+
const s = a.anchor.getNode(), l = xe(s) ? s : ao(s, xe);
|
|
1041
1041
|
return l ? {
|
|
1042
1042
|
target: l.getTarget() ?? "_blank",
|
|
1043
1043
|
url: l.sanitizeUrl(l.getURL())
|
|
@@ -1045,17 +1045,17 @@ const Po = (e) => {
|
|
|
1045
1045
|
});
|
|
1046
1046
|
o && window.open(o.url, o.target, "noopener,noreferrer");
|
|
1047
1047
|
}
|
|
1048
|
-
}),
|
|
1048
|
+
}), ca = (e) => ({
|
|
1049
1049
|
insertImage: (s) => {
|
|
1050
1050
|
s.url.trim() && e.update(() => {
|
|
1051
1051
|
const l = z();
|
|
1052
|
-
|
|
1052
|
+
V([xo(s), l]), l.selectStart();
|
|
1053
1053
|
});
|
|
1054
1054
|
},
|
|
1055
1055
|
insertVideo: (s) => {
|
|
1056
1056
|
s.url.trim() && e.update(() => {
|
|
1057
1057
|
const l = z();
|
|
1058
|
-
|
|
1058
|
+
V([Eo(s), l]), l.selectStart();
|
|
1059
1059
|
});
|
|
1060
1060
|
},
|
|
1061
1061
|
resizeMedia: (s) => {
|
|
@@ -1082,21 +1082,21 @@ const Po = (e) => {
|
|
|
1082
1082
|
});
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
|
-
}),
|
|
1085
|
+
}), da = (e) => ({
|
|
1086
1086
|
insertMention: (n) => {
|
|
1087
1087
|
e.update(() => {
|
|
1088
1088
|
const r = A();
|
|
1089
|
-
D(r) &&
|
|
1090
|
-
|
|
1089
|
+
D(r) && V([
|
|
1090
|
+
nt(n),
|
|
1091
1091
|
Se(" ")
|
|
1092
1092
|
]);
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
|
-
}),
|
|
1095
|
+
}), ua = (e) => ({
|
|
1096
1096
|
clearSelectionFormat: () => {
|
|
1097
1097
|
e.update(() => {
|
|
1098
1098
|
const r = A();
|
|
1099
|
-
D(r) && (r.setFormat(0),
|
|
1099
|
+
D(r) && (r.setFormat(0), gt(r, {
|
|
1100
1100
|
color: null,
|
|
1101
1101
|
"background-color": null,
|
|
1102
1102
|
"font-size": null,
|
|
@@ -1108,20 +1108,20 @@ const Po = (e) => {
|
|
|
1108
1108
|
setSelectionStyle: (r, o) => {
|
|
1109
1109
|
e.update(() => {
|
|
1110
1110
|
const a = A();
|
|
1111
|
-
D(a) &&
|
|
1111
|
+
D(a) && gt(a, {
|
|
1112
1112
|
[r]: o === "" ? null : o
|
|
1113
1113
|
});
|
|
1114
1114
|
});
|
|
1115
1115
|
}
|
|
1116
|
-
}),
|
|
1116
|
+
}), ma = 20, Et = (e, t) => Number.isFinite(e) && e > 0 ? Math.min(Math.floor(e), t) : 1, be = (e) => Number.isFinite(e) && (e ?? 0) > 0 ? Math.min(Math.floor(e ?? 1), ma) : 1, ye = () => {
|
|
1117
1117
|
const e = A();
|
|
1118
|
-
return !D(e) && !
|
|
1119
|
-
},
|
|
1118
|
+
return !D(e) && !cn(e) ? !1 : Vr(e.anchor.getNode()) !== null;
|
|
1119
|
+
}, ga = (e) => ({
|
|
1120
1120
|
insertTable: (l, d) => {
|
|
1121
|
-
const i =
|
|
1122
|
-
e.dispatchCommand(
|
|
1121
|
+
const i = Et(l, en), h = Et(d, tn);
|
|
1122
|
+
e.dispatchCommand(zr, {
|
|
1123
1123
|
rows: String(i),
|
|
1124
|
-
columns: String(
|
|
1124
|
+
columns: String(h),
|
|
1125
1125
|
/*
|
|
1126
1126
|
* BridgeRTE 默认表格更贴近文档编辑场景:首行作为表头,首列保持普通单元格。
|
|
1127
1127
|
* 后续表格菜单补齐后,再把首行/首列表头切换做成显式行为。
|
|
@@ -1137,7 +1137,7 @@ const Po = (e) => {
|
|
|
1137
1137
|
if (!ye()) return;
|
|
1138
1138
|
const d = be(l.count);
|
|
1139
1139
|
for (let i = 0; i < d; i += 1)
|
|
1140
|
-
|
|
1140
|
+
Fr(l.direction !== "before");
|
|
1141
1141
|
});
|
|
1142
1142
|
},
|
|
1143
1143
|
insertTableColumn: (l) => {
|
|
@@ -1145,7 +1145,7 @@ const Po = (e) => {
|
|
|
1145
1145
|
if (!ye()) return;
|
|
1146
1146
|
const d = be(l.count);
|
|
1147
1147
|
for (let i = 0; i < d; i += 1)
|
|
1148
|
-
|
|
1148
|
+
$r(l.direction !== "before");
|
|
1149
1149
|
});
|
|
1150
1150
|
},
|
|
1151
1151
|
deleteTableRow: (l) => {
|
|
@@ -1153,7 +1153,7 @@ const Po = (e) => {
|
|
|
1153
1153
|
const d = be(l.count);
|
|
1154
1154
|
for (let i = 0; i < d; i += 1) {
|
|
1155
1155
|
if (!ye()) return;
|
|
1156
|
-
|
|
1156
|
+
Hr();
|
|
1157
1157
|
}
|
|
1158
1158
|
});
|
|
1159
1159
|
},
|
|
@@ -1162,22 +1162,22 @@ const Po = (e) => {
|
|
|
1162
1162
|
const d = be(l.count);
|
|
1163
1163
|
for (let i = 0; i < d; i += 1) {
|
|
1164
1164
|
if (!ye()) return;
|
|
1165
|
-
|
|
1165
|
+
Or();
|
|
1166
1166
|
}
|
|
1167
1167
|
});
|
|
1168
1168
|
},
|
|
1169
1169
|
deleteTable: () => {
|
|
1170
1170
|
e.update(() => {
|
|
1171
1171
|
const l = A();
|
|
1172
|
-
if (!D(l) && !
|
|
1173
|
-
const d =
|
|
1172
|
+
if (!D(l) && !cn(l)) return;
|
|
1173
|
+
const d = Dr(l.anchor.getNode());
|
|
1174
1174
|
if (!d) return;
|
|
1175
1175
|
const i = z();
|
|
1176
1176
|
d.insertAfter(i), d.remove(), i.selectStart();
|
|
1177
1177
|
});
|
|
1178
1178
|
}
|
|
1179
|
-
}),
|
|
1180
|
-
const t =
|
|
1179
|
+
}), ha = (e) => {
|
|
1180
|
+
const t = ga(e);
|
|
1181
1181
|
return {
|
|
1182
1182
|
insertTable: (n) => {
|
|
1183
1183
|
t.insertTable(n.rows, n.cols);
|
|
@@ -1198,7 +1198,7 @@ const Po = (e) => {
|
|
|
1198
1198
|
t.deleteTable();
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
|
-
},
|
|
1201
|
+
}, pa = {
|
|
1202
1202
|
"format.bold": "bold",
|
|
1203
1203
|
"format.italic": "italic",
|
|
1204
1204
|
"format.underline": "underline",
|
|
@@ -1206,22 +1206,22 @@ const Po = (e) => {
|
|
|
1206
1206
|
"format.inlineCode": "code",
|
|
1207
1207
|
"format.superscript": "superscript",
|
|
1208
1208
|
"format.subscript": "subscript"
|
|
1209
|
-
}, pa = {
|
|
1210
|
-
"list.ordered": Nr,
|
|
1211
|
-
"list.unordered": Sr,
|
|
1212
|
-
"list.todo": Lr
|
|
1213
1209
|
}, fa = {
|
|
1214
|
-
"
|
|
1215
|
-
"
|
|
1216
|
-
"
|
|
1217
|
-
"history.redo": Zn
|
|
1210
|
+
"list.ordered": Pr,
|
|
1211
|
+
"list.unordered": Nr,
|
|
1212
|
+
"list.todo": Sr
|
|
1218
1213
|
}, ba = {
|
|
1214
|
+
"indent.increase": rr,
|
|
1215
|
+
"indent.decrease": nr,
|
|
1216
|
+
"history.undo": tr,
|
|
1217
|
+
"history.redo": er
|
|
1218
|
+
}, ya = {
|
|
1219
1219
|
"format.color": "color",
|
|
1220
1220
|
"format.backgroundColor": "background-color",
|
|
1221
1221
|
"format.fontSize": "font-size",
|
|
1222
1222
|
"format.fontFamily": "font-family",
|
|
1223
1223
|
"format.lineHeight": "line-height"
|
|
1224
|
-
},
|
|
1224
|
+
}, va = ({
|
|
1225
1225
|
container: e,
|
|
1226
1226
|
lexicalEditor: t,
|
|
1227
1227
|
options: n,
|
|
@@ -1229,50 +1229,50 @@ const Po = (e) => {
|
|
|
1229
1229
|
isReadonly: o,
|
|
1230
1230
|
reportError: a
|
|
1231
1231
|
}) => {
|
|
1232
|
-
const s =
|
|
1232
|
+
const s = oa({
|
|
1233
1233
|
container: e,
|
|
1234
1234
|
lexicalEditor: t,
|
|
1235
1235
|
options: n,
|
|
1236
1236
|
isDestroyed: r
|
|
1237
|
-
}), l =
|
|
1238
|
-
var M,
|
|
1237
|
+
}), l = ia(t), d = la(t), i = ca(t), h = da(t), w = ua(t), C = ha(t), T = () => {
|
|
1238
|
+
var M, m;
|
|
1239
1239
|
if (document.fullscreenElement) {
|
|
1240
|
-
(M = document.exitFullscreen) == null || M.call(document).catch((
|
|
1241
|
-
a(n, "fullscreen.exit", "Exit fullscreen failed.",
|
|
1240
|
+
(M = document.exitFullscreen) == null || M.call(document).catch((f) => {
|
|
1241
|
+
a(n, "fullscreen.exit", "Exit fullscreen failed.", f);
|
|
1242
1242
|
});
|
|
1243
1243
|
return;
|
|
1244
1244
|
}
|
|
1245
|
-
(
|
|
1246
|
-
a(n, "fullscreen.enter", "Enter fullscreen failed.",
|
|
1245
|
+
(m = e.requestFullscreen) == null || m.call(e).catch((f) => {
|
|
1246
|
+
a(n, "fullscreen.enter", "Enter fullscreen failed.", f);
|
|
1247
1247
|
});
|
|
1248
|
-
},
|
|
1248
|
+
}, b = ((y) => {
|
|
1249
1249
|
if (r() || o()) return;
|
|
1250
|
-
const M =
|
|
1250
|
+
const M = pa[y.type];
|
|
1251
1251
|
if (M) {
|
|
1252
|
-
t.dispatchCommand(
|
|
1252
|
+
t.dispatchCommand(Zn, M);
|
|
1253
1253
|
return;
|
|
1254
1254
|
}
|
|
1255
|
-
const
|
|
1256
|
-
if (
|
|
1257
|
-
t.dispatchCommand(
|
|
1255
|
+
const m = fa[y.type];
|
|
1256
|
+
if (m) {
|
|
1257
|
+
t.dispatchCommand(m, void 0);
|
|
1258
1258
|
return;
|
|
1259
1259
|
}
|
|
1260
|
-
const
|
|
1261
|
-
if (
|
|
1262
|
-
t.dispatchCommand(
|
|
1260
|
+
const f = ba[y.type];
|
|
1261
|
+
if (f) {
|
|
1262
|
+
t.dispatchCommand(f, void 0);
|
|
1263
1263
|
return;
|
|
1264
1264
|
}
|
|
1265
|
-
const
|
|
1266
|
-
if (
|
|
1267
|
-
w.setSelectionStyle(
|
|
1265
|
+
const E = ya[y.type];
|
|
1266
|
+
if (E && "value" in y) {
|
|
1267
|
+
w.setSelectionStyle(E, y.value);
|
|
1268
1268
|
return;
|
|
1269
1269
|
}
|
|
1270
|
-
switch (
|
|
1270
|
+
switch (y.type) {
|
|
1271
1271
|
case "format.clear":
|
|
1272
1272
|
w.clearSelectionFormat();
|
|
1273
1273
|
return;
|
|
1274
1274
|
case "block.heading":
|
|
1275
|
-
l.setBlockHeading(
|
|
1275
|
+
l.setBlockHeading(y.level);
|
|
1276
1276
|
return;
|
|
1277
1277
|
case "block.paragraph":
|
|
1278
1278
|
l.setParagraphBlock();
|
|
@@ -1284,16 +1284,16 @@ const Po = (e) => {
|
|
|
1284
1284
|
l.insertDividerBlock();
|
|
1285
1285
|
return;
|
|
1286
1286
|
case "block.code":
|
|
1287
|
-
l.insertCodeBlock(
|
|
1287
|
+
l.insertCodeBlock(y.language);
|
|
1288
1288
|
return;
|
|
1289
1289
|
case "block.setCodeLanguage":
|
|
1290
|
-
l.setSelectedCodeBlockLanguage(
|
|
1290
|
+
l.setSelectedCodeBlockLanguage(y.language);
|
|
1291
1291
|
return;
|
|
1292
1292
|
case "align":
|
|
1293
|
-
l.formatAlign(
|
|
1293
|
+
l.formatAlign(y.value);
|
|
1294
1294
|
return;
|
|
1295
1295
|
case "link.set":
|
|
1296
|
-
d.setLink(
|
|
1296
|
+
d.setLink(y.href, y.text);
|
|
1297
1297
|
return;
|
|
1298
1298
|
case "link.unset":
|
|
1299
1299
|
d.unsetLink();
|
|
@@ -1302,34 +1302,34 @@ const Po = (e) => {
|
|
|
1302
1302
|
d.openSelectedLink();
|
|
1303
1303
|
return;
|
|
1304
1304
|
case "mention.insert":
|
|
1305
|
-
|
|
1305
|
+
h.insertMention(y.item);
|
|
1306
1306
|
return;
|
|
1307
1307
|
case "content.clear":
|
|
1308
1308
|
l.clearContent();
|
|
1309
1309
|
return;
|
|
1310
1310
|
case "table.insert":
|
|
1311
|
-
C.insertTable(
|
|
1311
|
+
C.insertTable(y);
|
|
1312
1312
|
return;
|
|
1313
1313
|
case "table.insertRow":
|
|
1314
|
-
C.insertTableRow(
|
|
1314
|
+
C.insertTableRow(y);
|
|
1315
1315
|
return;
|
|
1316
1316
|
case "table.insertColumn":
|
|
1317
|
-
C.insertTableColumn(
|
|
1317
|
+
C.insertTableColumn(y);
|
|
1318
1318
|
return;
|
|
1319
1319
|
case "table.deleteRow":
|
|
1320
|
-
C.deleteTableRow(
|
|
1320
|
+
C.deleteTableRow(y);
|
|
1321
1321
|
return;
|
|
1322
1322
|
case "table.deleteColumn":
|
|
1323
|
-
C.deleteTableColumn(
|
|
1323
|
+
C.deleteTableColumn(y);
|
|
1324
1324
|
return;
|
|
1325
1325
|
case "table.delete":
|
|
1326
1326
|
C.deleteTable();
|
|
1327
1327
|
return;
|
|
1328
1328
|
case "media.insertImage":
|
|
1329
|
-
i.insertImage(
|
|
1329
|
+
i.insertImage(y);
|
|
1330
1330
|
return;
|
|
1331
1331
|
case "media.insertVideo":
|
|
1332
|
-
i.insertVideo(
|
|
1332
|
+
i.insertVideo(y);
|
|
1333
1333
|
return;
|
|
1334
1334
|
case "media.pickImage":
|
|
1335
1335
|
s.pickMediaFile("image");
|
|
@@ -1338,40 +1338,40 @@ const Po = (e) => {
|
|
|
1338
1338
|
s.pickMediaFile("video");
|
|
1339
1339
|
return;
|
|
1340
1340
|
case "media.retry":
|
|
1341
|
-
s.retryMedia(
|
|
1341
|
+
s.retryMedia(y.assetId);
|
|
1342
1342
|
return;
|
|
1343
1343
|
case "media.remove":
|
|
1344
|
-
s.removeMedia(
|
|
1344
|
+
s.removeMedia(y.assetId);
|
|
1345
1345
|
return;
|
|
1346
1346
|
case "media.resize":
|
|
1347
|
-
i.resizeMedia(
|
|
1347
|
+
i.resizeMedia(y);
|
|
1348
1348
|
return;
|
|
1349
1349
|
case "media.align":
|
|
1350
|
-
i.alignMedia(
|
|
1350
|
+
i.alignMedia(y);
|
|
1351
1351
|
return;
|
|
1352
1352
|
case "media.resetSize":
|
|
1353
|
-
i.resetMediaSize(
|
|
1353
|
+
i.resetMediaSize(y.assetId);
|
|
1354
1354
|
return;
|
|
1355
1355
|
case "fullscreen.toggle":
|
|
1356
|
-
|
|
1356
|
+
T();
|
|
1357
1357
|
return;
|
|
1358
1358
|
}
|
|
1359
1359
|
});
|
|
1360
|
-
return
|
|
1360
|
+
return b.uploadMediaFile = s.uploadMediaFile, b.destroy = () => {
|
|
1361
1361
|
s.destroy();
|
|
1362
|
-
},
|
|
1363
|
-
},
|
|
1362
|
+
}, b;
|
|
1363
|
+
}, wa = 300, Ca = "BridgeRTE", Mt = ({
|
|
1364
1364
|
editor: e,
|
|
1365
1365
|
overflowLength: t
|
|
1366
1366
|
}) => {
|
|
1367
1367
|
if (t <= 0) return !1;
|
|
1368
1368
|
const n = A();
|
|
1369
1369
|
if (D(n))
|
|
1370
|
-
return
|
|
1370
|
+
return ht(e, n.anchor, t), !0;
|
|
1371
1371
|
$().selectEnd();
|
|
1372
1372
|
const r = A();
|
|
1373
|
-
return D(r) ? (
|
|
1374
|
-
},
|
|
1373
|
+
return D(r) ? (ht(e, r.anchor, t), !0) : !1;
|
|
1374
|
+
}, _a = ({
|
|
1375
1375
|
lexicalEditor: e,
|
|
1376
1376
|
options: t,
|
|
1377
1377
|
isDestroyed: n,
|
|
@@ -1381,40 +1381,40 @@ const Po = (e) => {
|
|
|
1381
1381
|
let a = 0, s = null;
|
|
1382
1382
|
const l = () => {
|
|
1383
1383
|
s && (clearTimeout(s), s = null);
|
|
1384
|
-
}, d = (
|
|
1384
|
+
}, d = (m) => {
|
|
1385
1385
|
if (n()) return;
|
|
1386
|
-
const
|
|
1387
|
-
r(
|
|
1388
|
-
}, i = (
|
|
1389
|
-
const
|
|
1386
|
+
const f = fn(e.getEditorState(), e);
|
|
1387
|
+
r(f), m && Go(t, f);
|
|
1388
|
+
}, i = (m) => {
|
|
1389
|
+
const f = t.maxLength !== void 0 && t.maxLength >= 0 ? t.maxLength : void 0;
|
|
1390
1390
|
return {
|
|
1391
1391
|
dirty: !0,
|
|
1392
|
-
plainTextLength:
|
|
1392
|
+
plainTextLength: m,
|
|
1393
1393
|
version: Le,
|
|
1394
|
-
maxLength:
|
|
1395
|
-
isOverMaxLength:
|
|
1394
|
+
maxLength: f,
|
|
1395
|
+
isOverMaxLength: f === void 0 ? !1 : m > f
|
|
1396
1396
|
};
|
|
1397
|
-
},
|
|
1398
|
-
|
|
1397
|
+
}, h = (m) => {
|
|
1398
|
+
Xo(t, i(m));
|
|
1399
1399
|
}, w = () => {
|
|
1400
1400
|
t.onChange && (l(), s = setTimeout(() => {
|
|
1401
1401
|
d(!0);
|
|
1402
|
-
},
|
|
1403
|
-
}, C = (
|
|
1402
|
+
}, Kn));
|
|
1403
|
+
}, C = (m) => {
|
|
1404
1404
|
if (a > 0) {
|
|
1405
1405
|
a -= 1;
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
|
-
m
|
|
1409
|
-
},
|
|
1410
|
-
|
|
1408
|
+
h(m), w();
|
|
1409
|
+
}, T = () => e.getEditorState().read(() => $().getTextContent().length), b = (m) => t.maxLength === void 0 || t.maxLength < 0 ? 0 : m - t.maxLength, y = (m) => m <= 0 ? !1 : (e.update(() => {
|
|
1410
|
+
Mt({ editor: e, overflowLength: m });
|
|
1411
1411
|
}, { discrete: !0 }), !0);
|
|
1412
1412
|
return {
|
|
1413
1413
|
clearContentChangeTimer: l,
|
|
1414
1414
|
enforceCurrentMaxLength: () => {
|
|
1415
1415
|
t.maxLength === void 0 || t.maxLength < 0 || e.update(() => {
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1416
|
+
const m = $().getTextContent().length - (t.maxLength ?? 0);
|
|
1417
|
+
Mt({ editor: e, overflowLength: m });
|
|
1418
1418
|
}, { discrete: !0 });
|
|
1419
1419
|
},
|
|
1420
1420
|
syncContent: d,
|
|
@@ -1422,22 +1422,22 @@ const Po = (e) => {
|
|
|
1422
1422
|
a += 1;
|
|
1423
1423
|
},
|
|
1424
1424
|
syncAfterEditorUpdate() {
|
|
1425
|
-
const
|
|
1426
|
-
if (b(
|
|
1425
|
+
const m = T();
|
|
1426
|
+
if (y(b(m))) {
|
|
1427
1427
|
o();
|
|
1428
1428
|
return;
|
|
1429
1429
|
}
|
|
1430
|
-
o(), C(
|
|
1430
|
+
o(), C(m);
|
|
1431
1431
|
}
|
|
1432
1432
|
};
|
|
1433
|
-
}, Pe = "data-language",
|
|
1433
|
+
}, Pe = "data-language", Cn = "纯文本", ka = "language", xa = /* @__PURE__ */ new Set(["plain", "plaintext", "text", "txt"]), Ea = new Set(co().map(([e]) => e)), Ma = [
|
|
1434
1434
|
Pe,
|
|
1435
1435
|
"data-lang",
|
|
1436
1436
|
"data-code-language",
|
|
1437
1437
|
"data-highlight-language",
|
|
1438
1438
|
"lang",
|
|
1439
1439
|
"language"
|
|
1440
|
-
],
|
|
1440
|
+
], Ta = /^[a-z][a-z0-9_+#.-]{0,31}$/i, La = /^(?:language|lang)-([a-z][a-z0-9_+#.-]{0,31})$/i, Sa = /^brush:\s*([a-z][a-z0-9_+#.-]{0,31})$/i, Na = /* @__PURE__ */ new Map([
|
|
1441
1441
|
["dockerfile", "docker"],
|
|
1442
1442
|
["shell", "shellscript"],
|
|
1443
1443
|
["sh", "shellscript"],
|
|
@@ -1450,46 +1450,46 @@ const Po = (e) => {
|
|
|
1450
1450
|
["ts", "typescript"],
|
|
1451
1451
|
["tsx", "tsx"],
|
|
1452
1452
|
["yml", "yaml"]
|
|
1453
|
-
]),
|
|
1453
|
+
]), Pa = (e) => e.type === "select", Tt = (e) => e.find((t) => t.name === ka && Pa(t)), Z = (e) => {
|
|
1454
1454
|
const t = e == null ? void 0 : e.trim().toLowerCase();
|
|
1455
|
-
if (!t || !
|
|
1456
|
-
if (
|
|
1457
|
-
const n =
|
|
1458
|
-
return
|
|
1459
|
-
},
|
|
1460
|
-
for (const t of
|
|
1455
|
+
if (!t || !Ta.test(t)) return null;
|
|
1456
|
+
if (xa.has(t)) return "";
|
|
1457
|
+
const n = Na.get(t) ?? lo(t);
|
|
1458
|
+
return Ea.has(n) ? n : null;
|
|
1459
|
+
}, Ia = (e) => {
|
|
1460
|
+
for (const t of Ma) {
|
|
1461
1461
|
const n = Z(e.getAttribute(t));
|
|
1462
1462
|
if (n) return n;
|
|
1463
1463
|
}
|
|
1464
1464
|
return null;
|
|
1465
|
-
},
|
|
1466
|
-
const [, t] = e.match(
|
|
1465
|
+
}, Ra = (e) => {
|
|
1466
|
+
const [, t] = e.match(Sa) ?? [], n = Z(t);
|
|
1467
1467
|
if (n) return n;
|
|
1468
1468
|
for (const r of e.split(/\s+/)) {
|
|
1469
|
-
const [, o] = r.match(
|
|
1469
|
+
const [, o] = r.match(La) ?? [], a = Z(o);
|
|
1470
1470
|
if (a) return a;
|
|
1471
1471
|
}
|
|
1472
1472
|
return null;
|
|
1473
|
-
},
|
|
1473
|
+
}, _n = (e = Ue) => {
|
|
1474
1474
|
var t, n;
|
|
1475
|
-
return ((t =
|
|
1476
|
-
},
|
|
1475
|
+
return ((t = Tt(e.fields)) == null ? void 0 : t.options) ?? ((n = Tt(Ue.fields)) == null ? void 0 : n.options) ?? [{ label: Cn, value: "" }];
|
|
1476
|
+
}, kn = (e, t) => {
|
|
1477
1477
|
var n, r, o;
|
|
1478
|
-
return ((n = e.find((a) => a.value === t)) == null ? void 0 : n.label) ?? ((r = e.find((a) => Z(a.value) === Z(t))) == null ? void 0 : r.label) ?? ((o = e[0]) == null ? void 0 : o.label) ??
|
|
1478
|
+
return ((n = e.find((a) => a.value === t)) == null ? void 0 : n.label) ?? ((r = e.find((a) => Z(a.value) === Z(t))) == null ? void 0 : r.label) ?? ((o = e[0]) == null ? void 0 : o.label) ?? Cn;
|
|
1479
1479
|
};
|
|
1480
|
-
|
|
1481
|
-
const
|
|
1480
|
+
_n();
|
|
1481
|
+
const Aa = (e) => {
|
|
1482
1482
|
[...e.querySelectorAll("pre,code")].forEach((t) => {
|
|
1483
|
-
const n =
|
|
1483
|
+
const n = Ia(t) ?? Ra(t.className), r = t.tagName === "PRE" ? t : t.closest("pre");
|
|
1484
1484
|
r && n && r.setAttribute(Pe, n);
|
|
1485
1485
|
});
|
|
1486
|
-
},
|
|
1486
|
+
}, Ba = (e) => {
|
|
1487
1487
|
e.querySelectorAll("pre").forEach((t) => {
|
|
1488
1488
|
[...t.children].forEach((r) => {
|
|
1489
1489
|
r.tagName === "CODE" && r.replaceWith(...r.childNodes);
|
|
1490
1490
|
});
|
|
1491
1491
|
});
|
|
1492
|
-
},
|
|
1492
|
+
}, Da = (e, t) => {
|
|
1493
1493
|
const n = [...t.querySelectorAll("pre[data-language]")];
|
|
1494
1494
|
let r = 0;
|
|
1495
1495
|
e.forEach((o) => {
|
|
@@ -1499,7 +1499,7 @@ const Ra = (e) => {
|
|
|
1499
1499
|
const s = a.getAttribute(Pe);
|
|
1500
1500
|
s && !o.getLanguage() && o.setLanguage(s);
|
|
1501
1501
|
});
|
|
1502
|
-
},
|
|
1502
|
+
}, xn = "one-light", X = {
|
|
1503
1503
|
keyword: "#a626a4",
|
|
1504
1504
|
function: "#4078f2",
|
|
1505
1505
|
operator: "#0184bc",
|
|
@@ -1507,7 +1507,7 @@ const Ra = (e) => {
|
|
|
1507
1507
|
property: "#e45649",
|
|
1508
1508
|
string: "#50a14f",
|
|
1509
1509
|
attrName: "#986801"
|
|
1510
|
-
},
|
|
1510
|
+
}, Oa = {
|
|
1511
1511
|
[X.keyword]: "keyword",
|
|
1512
1512
|
[X.function]: "function",
|
|
1513
1513
|
[X.operator]: "operator",
|
|
@@ -1515,25 +1515,25 @@ const Ra = (e) => {
|
|
|
1515
1515
|
[X.property]: "property",
|
|
1516
1516
|
[X.string]: "string",
|
|
1517
1517
|
[X.attrName]: "attr-name"
|
|
1518
|
-
},
|
|
1518
|
+
}, Ha = (e) => {
|
|
1519
1519
|
const [, t] = e.match(/(?:^|;)color:\s*(#[0-9a-f]{3,8})/i) ?? [];
|
|
1520
|
-
return t ?
|
|
1521
|
-
},
|
|
1522
|
-
...
|
|
1520
|
+
return t ? Oa[t.toLowerCase()] : void 0;
|
|
1521
|
+
}, $a = {
|
|
1522
|
+
...pt,
|
|
1523
1523
|
defaultLanguage: null,
|
|
1524
|
-
defaultTheme:
|
|
1524
|
+
defaultTheme: xn,
|
|
1525
1525
|
$tokenize(e, t) {
|
|
1526
|
-
const n =
|
|
1527
|
-
return e.getStyle() && e.setStyle(""), n.map((r) =>
|
|
1526
|
+
const n = pt.$tokenize.call(this, e, t);
|
|
1527
|
+
return e.getStyle() && e.setStyle(""), n.map((r) => Er(r) ? Mr(
|
|
1528
1528
|
r.getTextContent(),
|
|
1529
|
-
|
|
1529
|
+
Ha(r.getStyle())
|
|
1530
1530
|
) : r);
|
|
1531
1531
|
}
|
|
1532
|
-
},
|
|
1533
|
-
let J = 0, re = null, ve = !1, we = null,
|
|
1534
|
-
const
|
|
1532
|
+
}, Fa = 1200, he = /* @__PURE__ */ new Set(), Ee = /* @__PURE__ */ new Set(), qe = /* @__PURE__ */ new Set(), Me = [];
|
|
1533
|
+
let J = 0, re = null, ve = !1, we = null, Lt = !1;
|
|
1534
|
+
const za = (e) => "requestIdleCallback" in window ? {
|
|
1535
1535
|
id: window.requestIdleCallback(e, {
|
|
1536
|
-
timeout:
|
|
1536
|
+
timeout: Fa
|
|
1537
1537
|
}),
|
|
1538
1538
|
kind: "idle"
|
|
1539
1539
|
} : {
|
|
@@ -1544,37 +1544,37 @@ const Fa = (e) => "requestIdleCallback" in window ? {
|
|
|
1544
1544
|
});
|
|
1545
1545
|
}, 0),
|
|
1546
1546
|
kind: "timeout"
|
|
1547
|
-
},
|
|
1547
|
+
}, Va = (e) => {
|
|
1548
1548
|
if (e.kind === "idle") {
|
|
1549
1549
|
window.cancelIdleCallback(e.id);
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
globalThis.clearTimeout(e.id);
|
|
1553
|
-
}, Wa = (e) => e.map((t) => t.value).filter((t) => t !== ""),
|
|
1553
|
+
}, Wa = (e) => e.map((t) => t.value).filter((t) => t !== ""), Ua = (e) => {
|
|
1554
1554
|
Wa(e).forEach((t) => {
|
|
1555
|
-
if (he.has(t) || Ee.has(t) ||
|
|
1555
|
+
if (he.has(t) || Ee.has(t) || qe.has(t) || gn(t)) {
|
|
1556
1556
|
he.add(t);
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
|
|
1559
|
+
qe.add(t), Me.push(t);
|
|
1560
1560
|
});
|
|
1561
|
-
},
|
|
1561
|
+
}, ja = () => {
|
|
1562
1562
|
for (; Me.length > 0; ) {
|
|
1563
1563
|
const e = Me.shift();
|
|
1564
|
-
if (e && (
|
|
1565
|
-
if (
|
|
1564
|
+
if (e && (qe.delete(e), !(he.has(e) || Ee.has(e)))) {
|
|
1565
|
+
if (gn(e)) {
|
|
1566
1566
|
he.add(e);
|
|
1567
1567
|
continue;
|
|
1568
1568
|
}
|
|
1569
1569
|
return e;
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
},
|
|
1573
|
-
if (!
|
|
1572
|
+
}, qa = async () => {
|
|
1573
|
+
if (!Lt) {
|
|
1574
1574
|
if (!we) {
|
|
1575
|
-
const e =
|
|
1575
|
+
const e = mo(xn);
|
|
1576
1576
|
we = Promise.resolve(e ?? void 0).then(() => {
|
|
1577
|
-
|
|
1577
|
+
Lt = !0;
|
|
1578
1578
|
}).catch(() => {
|
|
1579
1579
|
}).finally(() => {
|
|
1580
1580
|
we = null;
|
|
@@ -1582,16 +1582,16 @@ const Fa = (e) => "requestIdleCallback" in window ? {
|
|
|
1582
1582
|
}
|
|
1583
1583
|
await we;
|
|
1584
1584
|
}
|
|
1585
|
-
},
|
|
1586
|
-
J += 1,
|
|
1585
|
+
}, Ka = (e) => {
|
|
1586
|
+
J += 1, Ua(e);
|
|
1587
1587
|
const t = async () => {
|
|
1588
1588
|
if (!(J <= 0 || ve)) {
|
|
1589
1589
|
ve = !0;
|
|
1590
1590
|
try {
|
|
1591
|
-
if (await
|
|
1592
|
-
const r =
|
|
1591
|
+
if (await qa(), J <= 0) return;
|
|
1592
|
+
const r = ja();
|
|
1593
1593
|
if (!r) return;
|
|
1594
|
-
Ee.add(r), await Promise.resolve(
|
|
1594
|
+
Ee.add(r), await Promise.resolve(uo(r) ?? void 0).then(() => {
|
|
1595
1595
|
he.add(r);
|
|
1596
1596
|
}).catch(() => {
|
|
1597
1597
|
}).finally(() => {
|
|
@@ -1602,14 +1602,14 @@ const Fa = (e) => "requestIdleCallback" in window ? {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
1604
|
}, n = () => {
|
|
1605
|
-
J <= 0 || re !== null || ve || Me.length === 0 || (re =
|
|
1605
|
+
J <= 0 || re !== null || ve || Me.length === 0 || (re = za(() => {
|
|
1606
1606
|
re = null, t();
|
|
1607
1607
|
}));
|
|
1608
1608
|
};
|
|
1609
1609
|
return n(), () => {
|
|
1610
|
-
J = Math.max(0, J - 1), J === 0 && re !== null && (
|
|
1610
|
+
J = Math.max(0, J - 1), J === 0 && re !== null && (Va(re), re = null);
|
|
1611
1611
|
};
|
|
1612
|
-
}, oe = 12,
|
|
1612
|
+
}, oe = 12, St = 6, Nt = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), Ga = () => {
|
|
1613
1613
|
const e = window.visualViewport;
|
|
1614
1614
|
return {
|
|
1615
1615
|
left: (e == null ? void 0 : e.offsetLeft) ?? 0,
|
|
@@ -1617,53 +1617,53 @@ const Fa = (e) => "requestIdleCallback" in window ? {
|
|
|
1617
1617
|
width: (e == null ? void 0 : e.width) ?? window.innerWidth,
|
|
1618
1618
|
height: (e == null ? void 0 : e.height) ?? window.innerHeight
|
|
1619
1619
|
};
|
|
1620
|
-
},
|
|
1620
|
+
}, Xa = (e) => {
|
|
1621
1621
|
const t = e.style.visibility, n = e.style.pointerEvents, r = e.style.display;
|
|
1622
1622
|
e.style.visibility = "hidden", e.style.pointerEvents = "none", e.style.display = "grid";
|
|
1623
1623
|
const o = e.getBoundingClientRect();
|
|
1624
1624
|
return e.style.visibility = t, e.style.pointerEvents = n, e.style.display = r, o;
|
|
1625
|
-
},
|
|
1626
|
-
const r =
|
|
1625
|
+
}, Ja = (e, t, n) => {
|
|
1626
|
+
const r = Xa(e), o = Ga(), a = t.getBoundingClientRect(), s = a.left + oe, l = a.top + oe, d = n ? n.x : s, i = n ? n.y + n.height + St : l, h = n ? n.y - r.height - St : i, w = o.left + oe, C = o.top + oe, T = o.left + o.width - r.width - oe, b = o.top + o.height - r.height - oe, y = i > b ? h : i;
|
|
1627
1627
|
return {
|
|
1628
|
-
left:
|
|
1629
|
-
top:
|
|
1628
|
+
left: Nt(d, w, T),
|
|
1629
|
+
top: Nt(y, C, b),
|
|
1630
1630
|
viewportHeight: o.height
|
|
1631
1631
|
};
|
|
1632
|
-
},
|
|
1632
|
+
}, En = (e) => {
|
|
1633
1633
|
var d, i;
|
|
1634
1634
|
const t = document.createElement("div"), n = document.createElement("div"), r = document.createElement("div");
|
|
1635
1635
|
let o;
|
|
1636
1636
|
const a = () => {
|
|
1637
1637
|
t.dataset.visible = "false", n.dataset.visible = "false", o = void 0;
|
|
1638
1638
|
}, s = () => {
|
|
1639
|
-
const
|
|
1640
|
-
n.style.left = `${
|
|
1639
|
+
const h = Ja(n, e.root, o);
|
|
1640
|
+
n.style.left = `${h.left}px`, n.style.top = `${h.top}px`, n.style.setProperty(
|
|
1641
1641
|
"--bridgerte-dialog-visible-height",
|
|
1642
|
-
`${
|
|
1642
|
+
`${h.viewportHeight}px`
|
|
1643
1643
|
);
|
|
1644
|
-
}, l = (
|
|
1645
|
-
o =
|
|
1644
|
+
}, l = (h) => {
|
|
1645
|
+
o = h, h ? n.style.setProperty("--bridgerte-dialog-anchor-width", `${h.width}px`) : n.style.removeProperty("--bridgerte-dialog-anchor-width"), s(), t.dataset.visible = "true", n.dataset.visible = "true";
|
|
1646
1646
|
};
|
|
1647
1647
|
return t.className = "bridgerte__dialog-backdrop", t.dataset.visible = "false", n.className = `bridgerte__dialog ${e.className}`, n.dataset.visible = "false", r.className = "bridgerte__dialog-content", n.append(r), e.root.append(t, n), t.addEventListener("click", () => {
|
|
1648
|
-
var
|
|
1649
|
-
(
|
|
1648
|
+
var h;
|
|
1649
|
+
(h = e.onBackdropClick) == null || h.call(e), a();
|
|
1650
1650
|
}), (d = window.visualViewport) == null || d.addEventListener("resize", s), (i = window.visualViewport) == null || i.addEventListener("scroll", s), window.addEventListener("resize", s), {
|
|
1651
1651
|
element: n,
|
|
1652
1652
|
content: r,
|
|
1653
1653
|
open: l,
|
|
1654
1654
|
close: a,
|
|
1655
1655
|
destroy() {
|
|
1656
|
-
var
|
|
1657
|
-
a(), (
|
|
1656
|
+
var h, w;
|
|
1657
|
+
a(), (h = window.visualViewport) == null || h.removeEventListener("resize", s), (w = window.visualViewport) == null || w.removeEventListener("scroll", s), window.removeEventListener("resize", s), t.remove(), n.remove();
|
|
1658
1658
|
}
|
|
1659
1659
|
};
|
|
1660
|
-
}, Te = (e) => typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : window.setTimeout(e, 0),
|
|
1660
|
+
}, Te = (e) => typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : window.setTimeout(e, 0), rt = (e) => {
|
|
1661
1661
|
if (typeof cancelAnimationFrame == "function") {
|
|
1662
1662
|
cancelAnimationFrame(e);
|
|
1663
1663
|
return;
|
|
1664
1664
|
}
|
|
1665
1665
|
window.clearTimeout(e);
|
|
1666
|
-
},
|
|
1666
|
+
}, W = (e, t = {}) => {
|
|
1667
1667
|
let n = null;
|
|
1668
1668
|
const r = (s) => {
|
|
1669
1669
|
const l = n ?? e;
|
|
@@ -1684,48 +1684,48 @@ const Fa = (e) => "requestIdleCallback" in window ? {
|
|
|
1684
1684
|
return e.addEventListener("pointerdown", o), e.addEventListener("pointerup", a), e.addEventListener("pointercancel", a), e.addEventListener("lostpointercapture", a), () => {
|
|
1685
1685
|
a(), e.removeEventListener("pointerdown", o), e.removeEventListener("pointerup", a), e.removeEventListener("pointercancel", a), e.removeEventListener("lostpointercapture", a);
|
|
1686
1686
|
};
|
|
1687
|
-
},
|
|
1687
|
+
}, Ya = (e, t, n) => {
|
|
1688
1688
|
e.update(
|
|
1689
1689
|
t,
|
|
1690
1690
|
{
|
|
1691
|
-
tag:
|
|
1691
|
+
tag: or,
|
|
1692
1692
|
onUpdate: n
|
|
1693
1693
|
}
|
|
1694
1694
|
);
|
|
1695
|
-
},
|
|
1696
|
-
let
|
|
1697
|
-
const
|
|
1695
|
+
}, Pt = "language", Qa = "bridgerte-code-block-language", It = 8;
|
|
1696
|
+
let Rt = 0;
|
|
1697
|
+
const Za = () => (Rt += 1, `${Qa}-${Rt}`), es = (e, t, n) => {
|
|
1698
1698
|
const r = e.querySelector(".bridgerte__code-block-control-label");
|
|
1699
|
-
e.dataset.language = n ?? "", r && (r.textContent =
|
|
1700
|
-
},
|
|
1699
|
+
e.dataset.language = n ?? "", r && (r.textContent = kn(t, n));
|
|
1700
|
+
}, ts = (e, t) => {
|
|
1701
1701
|
const n = document.createElement("button"), r = document.createElement("span"), o = document.createElement("span");
|
|
1702
|
-
return n.type = "button", n.className = "bridgerte__code-block-control", n.contentEditable = "false", n.dataset.language = t ?? "", n.setAttribute("aria-label", "选择代码块语言"), r.className = "bridgerte__code-block-control-label", r.textContent =
|
|
1703
|
-
},
|
|
1704
|
-
const t = document.createElement("div"), n = e.root.querySelector(".bridgerte__content") ?? e.root, r =
|
|
1705
|
-
e.languagePanel ??
|
|
1702
|
+
return n.type = "button", n.className = "bridgerte__code-block-control", n.contentEditable = "false", n.dataset.language = t ?? "", n.setAttribute("aria-label", "选择代码块语言"), r.className = "bridgerte__code-block-control-label", r.textContent = kn(e, t), o.className = "bridgerte__code-block-control-arrow", n.append(r, o), n;
|
|
1703
|
+
}, ns = (e) => {
|
|
1704
|
+
const t = document.createElement("div"), n = e.root.querySelector(".bridgerte__content") ?? e.root, r = mn(
|
|
1705
|
+
e.languagePanel ?? Ue,
|
|
1706
1706
|
e.payloadPanelConfig
|
|
1707
|
-
), o =
|
|
1707
|
+
), o = _n(r);
|
|
1708
1708
|
let a = null, s = null, l = null;
|
|
1709
|
-
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(),
|
|
1710
|
-
l ?? (l =
|
|
1709
|
+
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), h = () => {
|
|
1710
|
+
l ?? (l = Ka(o));
|
|
1711
1711
|
}, w = () => {
|
|
1712
1712
|
a == null || a.close();
|
|
1713
1713
|
}, C = (u, c) => {
|
|
1714
|
-
e.isReadonly() ||
|
|
1715
|
-
const
|
|
1716
|
-
K(
|
|
1714
|
+
e.isReadonly() || Ya(e.editor, () => {
|
|
1715
|
+
const p = me(u);
|
|
1716
|
+
K(p) && p.setLanguage(c);
|
|
1717
1717
|
});
|
|
1718
|
-
},
|
|
1718
|
+
}, T = (u, c) => {
|
|
1719
1719
|
Te(() => {
|
|
1720
1720
|
C(u, c);
|
|
1721
1721
|
});
|
|
1722
|
-
},
|
|
1722
|
+
}, b = (u, c, p) => {
|
|
1723
1723
|
var g;
|
|
1724
1724
|
return ((g = e.onRequest) == null ? void 0 : g.call(e, {
|
|
1725
|
-
id:
|
|
1725
|
+
id: Za(),
|
|
1726
1726
|
readonly: e.isReadonly(),
|
|
1727
1727
|
menuId: "code-block-language",
|
|
1728
|
-
command: { type: "block.setCodeLanguage", language:
|
|
1728
|
+
command: { type: "block.setCodeLanguage", language: p },
|
|
1729
1729
|
panel: r,
|
|
1730
1730
|
anchorRect: {
|
|
1731
1731
|
x: c.left,
|
|
@@ -1734,16 +1734,16 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1734
1734
|
height: c.height
|
|
1735
1735
|
},
|
|
1736
1736
|
currentValues: {
|
|
1737
|
-
[
|
|
1737
|
+
[Pt]: p
|
|
1738
1738
|
},
|
|
1739
|
-
submit: (
|
|
1740
|
-
w(),
|
|
1739
|
+
submit: (v) => {
|
|
1740
|
+
w(), T(u, v[Pt] ?? "");
|
|
1741
1741
|
},
|
|
1742
1742
|
cancel: w
|
|
1743
1743
|
})) === !0;
|
|
1744
|
-
},
|
|
1745
|
-
const
|
|
1746
|
-
u.hidden =
|
|
1744
|
+
}, y = (u, c) => {
|
|
1745
|
+
const p = e.root.getBoundingClientRect(), g = c.getBoundingClientRect(), v = g.bottom < p.top || g.top > p.bottom;
|
|
1746
|
+
u.hidden = v, u.style.transform = `translate(${g.left - p.left + It}px, ${g.top - p.top + It}px)`;
|
|
1747
1747
|
}, M = (u) => {
|
|
1748
1748
|
var N;
|
|
1749
1749
|
const c = e.editor.getElementByKey(u);
|
|
@@ -1751,71 +1751,71 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1751
1751
|
(N = d.get(u)) == null || N.remove(), d.delete(u);
|
|
1752
1752
|
return;
|
|
1753
1753
|
}
|
|
1754
|
-
|
|
1755
|
-
const
|
|
1754
|
+
h(), c.dataset.lexicalKey = u;
|
|
1755
|
+
const p = c.getAttribute("data-language"), g = d.get(u);
|
|
1756
1756
|
if (g) {
|
|
1757
|
-
|
|
1757
|
+
es(g, o, p), y(g, c);
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
},
|
|
1760
|
+
const v = ts(o, p), S = W(v);
|
|
1761
|
+
v.dataset.lexicalKey = u, d.set(u, v), i.set(v, S), t.append(v), y(v, c);
|
|
1762
|
+
}, m = () => {
|
|
1763
1763
|
s = null, d.forEach((u, c) => {
|
|
1764
1764
|
M(c);
|
|
1765
1765
|
});
|
|
1766
|
-
},
|
|
1767
|
-
s === null && (s = Te(
|
|
1768
|
-
},
|
|
1769
|
-
const
|
|
1770
|
-
if (
|
|
1766
|
+
}, f = () => {
|
|
1767
|
+
s === null && (s = Te(m));
|
|
1768
|
+
}, E = (u, c) => {
|
|
1769
|
+
const p = u.getBoundingClientRect(), g = u.dataset.language ?? "";
|
|
1770
|
+
if (b(c, p, g)) return;
|
|
1771
1771
|
if (e.isReadonly()) {
|
|
1772
1772
|
w();
|
|
1773
1773
|
return;
|
|
1774
1774
|
}
|
|
1775
|
-
a || (a =
|
|
1775
|
+
a || (a = En({
|
|
1776
1776
|
root: e.root,
|
|
1777
1777
|
className: "bridgerte__code-block-menu",
|
|
1778
1778
|
onBackdropClick: w
|
|
1779
1779
|
}));
|
|
1780
|
-
const
|
|
1781
|
-
a.content.replaceChildren(), a.element.style.minWidth = "180px",
|
|
1780
|
+
const v = document.createElement("div");
|
|
1781
|
+
a.content.replaceChildren(), a.element.style.minWidth = "180px", v.className = "bridgerte__code-block-menu-list", o.forEach((S) => {
|
|
1782
1782
|
const N = document.createElement("button");
|
|
1783
|
-
N.type = "button", N.className = "bridgerte__menu-item bridgerte__code-block-menu-item", N.textContent = S.label,
|
|
1783
|
+
N.type = "button", N.className = "bridgerte__menu-item bridgerte__code-block-menu-item", N.textContent = S.label, W(N), N.addEventListener("pointerdown", (O) => {
|
|
1784
1784
|
O.preventDefault();
|
|
1785
1785
|
}), N.addEventListener("click", () => {
|
|
1786
|
-
w(),
|
|
1787
|
-
}),
|
|
1788
|
-
}), a.content.append(
|
|
1789
|
-
x:
|
|
1790
|
-
y:
|
|
1786
|
+
w(), T(c, S.value);
|
|
1787
|
+
}), v.append(N);
|
|
1788
|
+
}), a.content.append(v), a.open({
|
|
1789
|
+
x: p.left,
|
|
1790
|
+
y: p.top,
|
|
1791
1791
|
width: 180,
|
|
1792
|
-
height:
|
|
1792
|
+
height: p.height
|
|
1793
1793
|
});
|
|
1794
1794
|
};
|
|
1795
1795
|
t.className = "bridgerte__code-block-controls-layer", e.root.append(t);
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1796
|
+
const k = e.editor.registerMutationListener(
|
|
1797
|
+
sn,
|
|
1798
1798
|
(u) => {
|
|
1799
|
-
u.forEach((c,
|
|
1799
|
+
u.forEach((c, p) => {
|
|
1800
1800
|
if (c === "destroyed") {
|
|
1801
|
-
const g = d.get(
|
|
1801
|
+
const g = d.get(p);
|
|
1802
1802
|
if (g) {
|
|
1803
|
-
const
|
|
1804
|
-
|
|
1803
|
+
const v = i.get(g);
|
|
1804
|
+
v == null || v(), i.delete(g), g.remove();
|
|
1805
1805
|
}
|
|
1806
|
-
d.delete(
|
|
1806
|
+
d.delete(p);
|
|
1807
1807
|
return;
|
|
1808
1808
|
}
|
|
1809
|
-
M(
|
|
1809
|
+
M(p);
|
|
1810
1810
|
});
|
|
1811
1811
|
}
|
|
1812
|
-
), I = e.editor.registerUpdateListener(
|
|
1812
|
+
), I = e.editor.registerUpdateListener(f), R = (u) => {
|
|
1813
1813
|
const c = u.target;
|
|
1814
1814
|
if (!(c instanceof HTMLElement)) return;
|
|
1815
|
-
const
|
|
1816
|
-
if (!(
|
|
1817
|
-
const g =
|
|
1818
|
-
g && (u.preventDefault(), u.stopPropagation(),
|
|
1815
|
+
const p = c.closest(".bridgerte__code-block-control");
|
|
1816
|
+
if (!(p instanceof HTMLElement)) return;
|
|
1817
|
+
const g = p.dataset.lexicalKey;
|
|
1818
|
+
g && (u.preventDefault(), u.stopPropagation(), E(p, g));
|
|
1819
1819
|
}, L = (u) => {
|
|
1820
1820
|
const c = u.target;
|
|
1821
1821
|
c instanceof HTMLElement && c.closest(".bridgerte__code-block-control") && u.preventDefault();
|
|
@@ -1826,56 +1826,56 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1826
1826
|
w();
|
|
1827
1827
|
return;
|
|
1828
1828
|
}
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1831
|
-
const g =
|
|
1829
|
+
const p = c.closest(".bridgerte__code-block");
|
|
1830
|
+
if (!p || p.textContent) return;
|
|
1831
|
+
const g = p.dataset.lexicalKey;
|
|
1832
1832
|
g && (e.editor.update(() => {
|
|
1833
|
-
const
|
|
1834
|
-
K(
|
|
1833
|
+
const v = me(g);
|
|
1834
|
+
K(v) && v.selectEnd();
|
|
1835
1835
|
}), e.editor.focus());
|
|
1836
1836
|
};
|
|
1837
|
-
return t.addEventListener("pointerdown", L), t.addEventListener("click", R), n.addEventListener("pointerdown", _), n.addEventListener("scroll",
|
|
1837
|
+
return t.addEventListener("pointerdown", L), t.addEventListener("click", R), n.addEventListener("pointerdown", _), n.addEventListener("scroll", f, { passive: !0 }), window.addEventListener("resize", f), {
|
|
1838
1838
|
destroy() {
|
|
1839
|
-
|
|
1839
|
+
k(), I(), l == null || l(), l = null, s !== null && (rt(s), s = null), t.removeEventListener("pointerdown", L), t.removeEventListener("click", R), n.removeEventListener("pointerdown", _), n.removeEventListener("scroll", f), window.removeEventListener("resize", f), d.forEach((u) => {
|
|
1840
1840
|
var c;
|
|
1841
1841
|
(c = i.get(u)) == null || c(), u.remove();
|
|
1842
1842
|
}), d.clear(), i.clear(), t.remove(), a == null || a.destroy(), a = null;
|
|
1843
1843
|
}
|
|
1844
1844
|
};
|
|
1845
|
-
},
|
|
1845
|
+
}, ot = (e, t = {}) => e.map((n) => {
|
|
1846
1846
|
var a;
|
|
1847
|
-
const r = (a = t.menuLabels) == null ? void 0 : a[n.id], o = n.payloadPanel ?
|
|
1847
|
+
const r = (a = t.menuLabels) == null ? void 0 : a[n.id], o = n.payloadPanel ? mn(n.payloadPanel, t.payloadPanelConfig) : void 0;
|
|
1848
1848
|
return {
|
|
1849
1849
|
...n,
|
|
1850
1850
|
...r === void 0 ? {} : { label: r },
|
|
1851
1851
|
...o === void 0 ? {} : { payloadPanel: o }
|
|
1852
1852
|
};
|
|
1853
|
-
}),
|
|
1853
|
+
}), rs = (e, t) => {
|
|
1854
1854
|
const n = t.find((r) => r.command === e.command.type);
|
|
1855
1855
|
return (n == null ? void 0 : n.value) === void 0 ? void 0 : { value: String(n.value) };
|
|
1856
|
-
},
|
|
1857
|
-
const n = t.find((o) =>
|
|
1856
|
+
}, os = (e, t) => {
|
|
1857
|
+
const n = t.find((o) => so(e.command, o)), r = t.find((o) => o.command === e.command.type);
|
|
1858
1858
|
return {
|
|
1859
1859
|
active: (n == null ? void 0 : n.active) === !0,
|
|
1860
1860
|
disabled: e.payloadPanel ? (r == null ? void 0 : r.disabled) === !0 : (n == null ? void 0 : n.disabled) === !0 || (r == null ? void 0 : r.disabled) === !0
|
|
1861
1861
|
};
|
|
1862
|
-
},
|
|
1862
|
+
}, at = [
|
|
1863
1863
|
"media-resize-20",
|
|
1864
1864
|
"media-resize-50",
|
|
1865
1865
|
"media-resize-100"
|
|
1866
|
-
],
|
|
1866
|
+
], as = [
|
|
1867
1867
|
"media-align-left",
|
|
1868
1868
|
"media-align-center",
|
|
1869
1869
|
"media-align-right",
|
|
1870
1870
|
"|",
|
|
1871
|
-
...
|
|
1871
|
+
...at,
|
|
1872
1872
|
"|",
|
|
1873
1873
|
"media-remove"
|
|
1874
|
-
],
|
|
1874
|
+
], ss = [
|
|
1875
1875
|
"media-retry",
|
|
1876
1876
|
"|",
|
|
1877
1877
|
"media-remove"
|
|
1878
|
-
],
|
|
1878
|
+
], is = [
|
|
1879
1879
|
{
|
|
1880
1880
|
id: "media-align-left",
|
|
1881
1881
|
command: { type: "media.align", assetId: "", value: "left" },
|
|
@@ -1932,22 +1932,22 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1932
1932
|
icon: "trash-2",
|
|
1933
1933
|
group: "media"
|
|
1934
1934
|
}
|
|
1935
|
-
],
|
|
1936
|
-
const t =
|
|
1935
|
+
], ls = (e) => at.includes(e), cs = (e) => typeof e == "object" && Array.isArray(e.menuKeys), ds = (e) => new Set(e.flatMap((t) => t === "|" ? [] : typeof t == "string" ? [t] : cs(t) ? [t.key, ...t.menuKeys] : [])), us = (e) => {
|
|
1936
|
+
const t = ds(e), n = at.filter((r) => !t.has(r));
|
|
1937
1937
|
return n.length === 0 ? e : [
|
|
1938
1938
|
...e,
|
|
1939
1939
|
"|",
|
|
1940
1940
|
...n
|
|
1941
1941
|
];
|
|
1942
|
-
},
|
|
1942
|
+
}, ms = (e) => {
|
|
1943
1943
|
var r;
|
|
1944
|
-
const t = (e == null ? void 0 : e.toolbarKeys) ??
|
|
1944
|
+
const t = (e == null ? void 0 : e.toolbarKeys) ?? as;
|
|
1945
1945
|
return {
|
|
1946
1946
|
...e,
|
|
1947
|
-
toolbarKeys:
|
|
1948
|
-
excludeKeys: (r = e == null ? void 0 : e.excludeKeys) == null ? void 0 : r.filter((o) => !
|
|
1947
|
+
toolbarKeys: us(t),
|
|
1948
|
+
excludeKeys: (r = e == null ? void 0 : e.excludeKeys) == null ? void 0 : r.filter((o) => !ls(o))
|
|
1949
1949
|
};
|
|
1950
|
-
},
|
|
1950
|
+
}, gs = (e, t) => {
|
|
1951
1951
|
switch (e.command.type) {
|
|
1952
1952
|
case "media.retry":
|
|
1953
1953
|
return { ...e.command, assetId: t };
|
|
@@ -1960,122 +1960,122 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1960
1960
|
default:
|
|
1961
1961
|
return null;
|
|
1962
1962
|
}
|
|
1963
|
-
},
|
|
1964
|
-
const n =
|
|
1963
|
+
}, hs = (e, t, n) => e.command.type === "media.resize" ? e.command.widthPercent === t : e.command.type === "media.align" && e.command.value === n, Mn = (e, t = {}) => {
|
|
1964
|
+
const n = ot(is, {
|
|
1965
1965
|
menuLabels: t.menuLabels
|
|
1966
|
-
}), r = e === "error" ? { toolbarKeys:
|
|
1967
|
-
return
|
|
1968
|
-
}, ae = 8, le = "bridgerte__media-controls-button",
|
|
1966
|
+
}), r = e === "error" ? { toolbarKeys: ss } : ms(t.config);
|
|
1967
|
+
return Ze(r, n);
|
|
1968
|
+
}, ae = 8, le = "bridgerte__media-controls-button", ps = (e) => e.querySelector(".bridgerte__content") ?? e, At = (e) => e instanceof Element ? e.closest(".bridgerte__media") : null, fs = (e, t = !1) => {
|
|
1969
1969
|
const n = document.createElement("button");
|
|
1970
1970
|
return n.type = "button", n.className = le, n.textContent = e.label, n.dataset.menuItemId = e.id, n.dataset.action = e.id.replace(/^media-/, ""), t && (n.dataset.active = "true"), n.setAttribute("aria-label", e.label), n;
|
|
1971
|
-
},
|
|
1971
|
+
}, Tn = (e) => e.flatMap((t) => t.type === "button" ? [t.item] : t.type === "group" ? t.items : []), bs = (e, t, n, r) => {
|
|
1972
1972
|
if (t.type === "separator") {
|
|
1973
1973
|
const a = document.createElement("span");
|
|
1974
1974
|
a.className = "bridgerte__media-controls-separator", a.dataset.separatorId = t.key, a.setAttribute("aria-hidden", "true"), e.append(a);
|
|
1975
1975
|
return;
|
|
1976
1976
|
}
|
|
1977
1977
|
(t.type === "button" ? [t.item] : t.items).forEach((a) => {
|
|
1978
|
-
e.append(
|
|
1978
|
+
e.append(fs(
|
|
1979
1979
|
a,
|
|
1980
|
-
|
|
1980
|
+
hs(a, n, r)
|
|
1981
1981
|
));
|
|
1982
1982
|
});
|
|
1983
|
-
},
|
|
1983
|
+
}, ys = (e, t, n) => {
|
|
1984
1984
|
const r = document.createElement("div"), o = e.dataset.status, a = Number(
|
|
1985
1985
|
e.dataset.displayWidthPercent ?? t
|
|
1986
|
-
), s = e.dataset.align ?? "left", l =
|
|
1986
|
+
), s = e.dataset.align ?? "left", l = Mn(o, {
|
|
1987
1987
|
config: n.mediaControlsConfig,
|
|
1988
1988
|
menuLabels: n.menuLabels
|
|
1989
1989
|
});
|
|
1990
|
-
return r.className = "bridgerte__media-controls", r.contentEditable = "false", r.setAttribute("aria-label", "媒体操作"), r.dataset.status = o ?? "success", r.dataset.displayWidthPercent = e.dataset.displayWidthPercent ?? "", r.dataset.align = e.dataset.align ?? "", r.dataset.menuItemIds =
|
|
1991
|
-
|
|
1990
|
+
return r.className = "bridgerte__media-controls", r.contentEditable = "false", r.setAttribute("aria-label", "媒体操作"), r.dataset.status = o ?? "success", r.dataset.displayWidthPercent = e.dataset.displayWidthPercent ?? "", r.dataset.align = e.dataset.align ?? "", r.dataset.menuItemIds = Tn(l).map((d) => d.id).join("|"), l.forEach((d) => {
|
|
1991
|
+
bs(r, d, a, s);
|
|
1992
1992
|
}), r;
|
|
1993
|
-
},
|
|
1994
|
-
const t = document.createElement("div"), n =
|
|
1993
|
+
}, vs = (e) => {
|
|
1994
|
+
const t = document.createElement("div"), n = ps(e.root), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
1995
1995
|
let s = null, l = null, d = !1, i = null;
|
|
1996
|
-
const
|
|
1996
|
+
const h = (c) => {
|
|
1997
1997
|
var g;
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2000
|
-
}, w = (c,
|
|
2001
|
-
const g = e.root.getBoundingClientRect(),
|
|
1998
|
+
const p = r.get(c);
|
|
1999
|
+
p && ((g = o.get(p)) == null || g(), o.delete(p), p.remove(), r.delete(c), i === c && (i = null));
|
|
2000
|
+
}, w = (c, p) => p.dataset.status === "error" || i === c, C = (c, p) => {
|
|
2001
|
+
const g = e.root.getBoundingClientRect(), v = p.getBoundingClientRect(), S = v.bottom < g.top || v.top > g.bottom, N = Math.max(
|
|
2002
2002
|
ae,
|
|
2003
2003
|
g.width - c.offsetWidth - ae
|
|
2004
2004
|
), O = Math.min(
|
|
2005
|
-
Math.max(
|
|
2005
|
+
Math.max(v.left - g.left + ae, ae),
|
|
2006
2006
|
N
|
|
2007
2007
|
), H = Math.max(
|
|
2008
2008
|
ae,
|
|
2009
|
-
|
|
2009
|
+
v.top - g.top - c.offsetHeight - ae
|
|
2010
2010
|
);
|
|
2011
2011
|
c.hidden = S, c.style.transform = `translate(${O}px, ${H}px)`;
|
|
2012
|
-
},
|
|
2013
|
-
const
|
|
2014
|
-
if (!
|
|
2015
|
-
|
|
2012
|
+
}, T = (c) => {
|
|
2013
|
+
const p = e.editor.getElementByKey(c);
|
|
2014
|
+
if (!p) {
|
|
2015
|
+
h(c);
|
|
2016
2016
|
return;
|
|
2017
2017
|
}
|
|
2018
|
-
|
|
2018
|
+
p.dataset.lexicalKey = c, a.set(p, c);
|
|
2019
2019
|
const g = r.get(c);
|
|
2020
|
-
if (!w(c,
|
|
2021
|
-
|
|
2020
|
+
if (!w(c, p)) {
|
|
2021
|
+
h(c);
|
|
2022
2022
|
return;
|
|
2023
2023
|
}
|
|
2024
2024
|
if (g) {
|
|
2025
|
-
const N =
|
|
2025
|
+
const N = p.dataset.status === "error", O = g.querySelector('[data-action="retry"]') !== null, H = p.dataset.displayWidthPercent ?? "", P = p.dataset.align ?? "";
|
|
2026
2026
|
if (N === O && g.dataset.displayWidthPercent === H && g.dataset.align === P) {
|
|
2027
|
-
C(g,
|
|
2027
|
+
C(g, p);
|
|
2028
2028
|
return;
|
|
2029
2029
|
}
|
|
2030
|
-
|
|
2030
|
+
h(c);
|
|
2031
2031
|
}
|
|
2032
|
-
const
|
|
2032
|
+
const v = ys(p, e.defaultWidthPercent, e), S = W(v, {
|
|
2033
2033
|
targetSelector: `.${le}`
|
|
2034
2034
|
});
|
|
2035
|
-
|
|
2036
|
-
}, p = () => {
|
|
2037
|
-
s = null, a.forEach((c, f) => {
|
|
2038
|
-
e.root.contains(f) || (a.delete(f), m(c));
|
|
2039
|
-
}), e.root.querySelectorAll(".bridgerte__media").forEach((c) => {
|
|
2040
|
-
const f = c.dataset.lexicalKey;
|
|
2041
|
-
f && (a.set(c, f), x(f));
|
|
2042
|
-
}), r.forEach((c, f) => {
|
|
2043
|
-
x(f);
|
|
2044
|
-
}), i !== null && x(i);
|
|
2035
|
+
v.dataset.lexicalKey = c, v.dataset.assetId = p.dataset.assetId, r.set(c, v), o.set(v, S), t.append(v), C(v, p);
|
|
2045
2036
|
}, b = () => {
|
|
2046
|
-
s
|
|
2047
|
-
|
|
2048
|
-
|
|
2037
|
+
s = null, a.forEach((c, p) => {
|
|
2038
|
+
e.root.contains(p) || (a.delete(p), h(c));
|
|
2039
|
+
}), e.root.querySelectorAll(".bridgerte__media").forEach((c) => {
|
|
2040
|
+
const p = c.dataset.lexicalKey;
|
|
2041
|
+
p && (a.set(c, p), T(p));
|
|
2042
|
+
}), r.forEach((c, p) => {
|
|
2043
|
+
T(p);
|
|
2044
|
+
}), i !== null && T(i);
|
|
2045
|
+
}, y = () => {
|
|
2046
|
+
s === null && (s = Te(b));
|
|
2047
|
+
}, M = (c, p) => {
|
|
2048
|
+
const g = p.dataset.assetId, v = Tn(Mn(p.dataset.status, {
|
|
2049
2049
|
config: e.mediaControlsConfig,
|
|
2050
2050
|
menuLabels: e.menuLabels
|
|
2051
2051
|
})).find((N) => N.id === c.dataset.menuItemId);
|
|
2052
|
-
if (!g || !
|
|
2053
|
-
const S =
|
|
2052
|
+
if (!g || !v) return;
|
|
2053
|
+
const S = gs(v, g);
|
|
2054
2054
|
S && e.executeCommand(S);
|
|
2055
|
-
},
|
|
2055
|
+
}, m = (c) => {
|
|
2056
2056
|
if (!c) {
|
|
2057
|
-
const
|
|
2058
|
-
i = null,
|
|
2057
|
+
const v = i;
|
|
2058
|
+
i = null, v !== null && T(v);
|
|
2059
2059
|
return;
|
|
2060
2060
|
}
|
|
2061
|
-
const
|
|
2062
|
-
if (!
|
|
2061
|
+
const p = c.dataset.lexicalKey ? c.dataset.lexicalKey : a.get(c) ?? null;
|
|
2062
|
+
if (!p || i === p) return;
|
|
2063
2063
|
const g = i;
|
|
2064
|
-
i =
|
|
2065
|
-
},
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
}, T = (c) => {
|
|
2069
|
-
h(Rt(c.target));
|
|
2064
|
+
i = p, g !== null && T(g), T(p);
|
|
2065
|
+
}, f = (c) => {
|
|
2066
|
+
const p = At(c.target);
|
|
2067
|
+
m(p);
|
|
2070
2068
|
}, E = (c) => {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
const
|
|
2069
|
+
m(At(c.target));
|
|
2070
|
+
}, k = (c) => {
|
|
2071
|
+
const p = c.target;
|
|
2072
|
+
if (!(p instanceof HTMLElement)) return;
|
|
2073
|
+
const g = p.closest(`.${le}`);
|
|
2074
2074
|
g && (c.preventDefault(), l = c.pointerType === "mouse" ? null : g);
|
|
2075
2075
|
}, I = (c) => {
|
|
2076
2076
|
if (c.pointerType === "mouse" || !l) return;
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2077
|
+
const p = c.target, g = p instanceof HTMLElement ? p.closest(".bridgerte__media-controls") : null, v = p instanceof HTMLElement ? p.closest(`.${le}`) : null;
|
|
2078
|
+
v === l && g && (c.preventDefault(), c.stopPropagation(), M(v, g), d = !0), l = null;
|
|
2079
2079
|
}, R = () => {
|
|
2080
2080
|
l = null;
|
|
2081
2081
|
}, L = (c) => {
|
|
@@ -2083,41 +2083,41 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2083
2083
|
d = !1, c.preventDefault(), c.stopPropagation();
|
|
2084
2084
|
return;
|
|
2085
2085
|
}
|
|
2086
|
-
const
|
|
2087
|
-
if (!(
|
|
2088
|
-
const g =
|
|
2089
|
-
!g || !
|
|
2086
|
+
const p = c.target;
|
|
2087
|
+
if (!(p instanceof HTMLElement)) return;
|
|
2088
|
+
const g = p.closest(`.${le}`), v = p.closest(".bridgerte__media-controls");
|
|
2089
|
+
!g || !v || (c.preventDefault(), c.stopPropagation(), M(g, v));
|
|
2090
2090
|
}, _ = e.editor.registerMutationListener(
|
|
2091
2091
|
se,
|
|
2092
2092
|
(c) => {
|
|
2093
|
-
c.forEach((
|
|
2094
|
-
if (
|
|
2095
|
-
|
|
2093
|
+
c.forEach((p, g) => {
|
|
2094
|
+
if (p === "destroyed") {
|
|
2095
|
+
h(g);
|
|
2096
2096
|
return;
|
|
2097
2097
|
}
|
|
2098
|
-
|
|
2098
|
+
T(g);
|
|
2099
2099
|
});
|
|
2100
2100
|
}
|
|
2101
|
-
), u = e.editor.registerUpdateListener(
|
|
2102
|
-
return t.className = "bridgerte__media-controls-layer", e.root.append(t), t.addEventListener("pointerdown",
|
|
2101
|
+
), u = e.editor.registerUpdateListener(y);
|
|
2102
|
+
return t.className = "bridgerte__media-controls-layer", e.root.append(t), t.addEventListener("pointerdown", k), t.addEventListener("pointerup", I), t.addEventListener("pointercancel", R), t.addEventListener("click", L), n.addEventListener("pointerdown", f), n.addEventListener("focusin", E), n.addEventListener("scroll", y, { passive: !0 }), window.addEventListener("resize", y), {
|
|
2103
2103
|
destroy() {
|
|
2104
|
-
_(), u(), s !== null && (
|
|
2105
|
-
var
|
|
2106
|
-
(
|
|
2104
|
+
_(), u(), s !== null && (rt(s), s = null), t.removeEventListener("pointerdown", k), t.removeEventListener("pointerup", I), t.removeEventListener("pointercancel", R), t.removeEventListener("click", L), n.removeEventListener("pointerdown", f), n.removeEventListener("focusin", E), n.removeEventListener("scroll", y), window.removeEventListener("resize", y), r.forEach((c) => {
|
|
2105
|
+
var p;
|
|
2106
|
+
(p = o.get(c)) == null || p(), c.remove();
|
|
2107
2107
|
}), r.clear(), o.clear(), a.clear(), t.remove();
|
|
2108
2108
|
}
|
|
2109
2109
|
};
|
|
2110
|
-
},
|
|
2110
|
+
}, ws = ["width", "height"], q = (e, t) => {
|
|
2111
2111
|
var r;
|
|
2112
2112
|
const n = (r = e[t]) == null ? void 0 : r.trim();
|
|
2113
2113
|
return n || void 0;
|
|
2114
|
-
},
|
|
2114
|
+
}, Ke = (e, t) => {
|
|
2115
2115
|
const n = Number.parseInt(e[t] ?? "", 10);
|
|
2116
2116
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2117
|
-
},
|
|
2118
|
-
const o =
|
|
2117
|
+
}, Bt = (e, t) => ws.reduce((n, r) => {
|
|
2118
|
+
const o = Ke(t, r);
|
|
2119
2119
|
return o === void 0 ? n : { ...n, [r]: o };
|
|
2120
|
-
}, e),
|
|
2120
|
+
}, e), Cs = (e, t) => {
|
|
2121
2121
|
if (e.type === "format.color" || e.type === "format.backgroundColor" || e.type === "format.fontSize" || e.type === "format.fontFamily" || e.type === "format.lineHeight")
|
|
2122
2122
|
return t.value !== void 0 ? { ...e, value: t.value } : e;
|
|
2123
2123
|
if (e.type === "link.set") {
|
|
@@ -2129,12 +2129,12 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2129
2129
|
if (e.type === "block.setCodeLanguage")
|
|
2130
2130
|
return t.language !== void 0 ? { ...e, language: t.language } : e;
|
|
2131
2131
|
if (e.type === "table.insert") {
|
|
2132
|
-
const n =
|
|
2132
|
+
const n = Ke(t, "rows"), r = Ke(t, "cols");
|
|
2133
2133
|
return n && r ? { type: "table.insert", rows: n, cols: r } : null;
|
|
2134
2134
|
}
|
|
2135
2135
|
if (e.type === "media.insertImage") {
|
|
2136
2136
|
const n = q(t, "url");
|
|
2137
|
-
return n ?
|
|
2137
|
+
return n ? Bt({
|
|
2138
2138
|
...e,
|
|
2139
2139
|
url: n,
|
|
2140
2140
|
alt: q(t, "alt"),
|
|
@@ -2143,7 +2143,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
if (e.type === "media.insertVideo") {
|
|
2145
2145
|
const n = q(t, "url");
|
|
2146
|
-
return n ?
|
|
2146
|
+
return n ? Bt({
|
|
2147
2147
|
...e,
|
|
2148
2148
|
url: n,
|
|
2149
2149
|
poster: q(t, "poster"),
|
|
@@ -2151,7 +2151,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2151
2151
|
}, t) : null;
|
|
2152
2152
|
}
|
|
2153
2153
|
return e;
|
|
2154
|
-
}, Y = (e) => Math.min(Math.max(Math.round(e), 0), 255),
|
|
2154
|
+
}, Y = (e) => Math.min(Math.max(Math.round(e), 0), 255), Ge = ({ r: e, g: t, b: n }) => `#${[e, t, n].map((r) => Y(r).toString(16).padStart(2, "0")).join("")}`, Ln = (e) => {
|
|
2155
2155
|
const n = e.trim().match(/^#([0-9a-f]{6})$/i);
|
|
2156
2156
|
if (!n) return null;
|
|
2157
2157
|
const r = n[1] ?? "";
|
|
@@ -2160,17 +2160,17 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2160
2160
|
g: Number.parseInt(r.slice(2, 4), 16),
|
|
2161
2161
|
b: Number.parseInt(r.slice(4, 6), 16)
|
|
2162
2162
|
};
|
|
2163
|
-
},
|
|
2163
|
+
}, _s = (e) => {
|
|
2164
2164
|
const t = e.trim().match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);
|
|
2165
2165
|
return t ? {
|
|
2166
2166
|
r: Y(Number(t[1])),
|
|
2167
2167
|
g: Y(Number(t[2])),
|
|
2168
2168
|
b: Y(Number(t[3]))
|
|
2169
2169
|
} : null;
|
|
2170
|
-
},
|
|
2171
|
-
const t =
|
|
2172
|
-
return t ?
|
|
2173
|
-
},
|
|
2170
|
+
}, Oe = (e) => {
|
|
2171
|
+
const t = Ln(e) ?? _s(e);
|
|
2172
|
+
return t ? Ge(t) : null;
|
|
2173
|
+
}, Sn = (e) => Math.min(Math.max(e, 0), 1), ks = ({ r: e, g: t, b: n }) => {
|
|
2174
2174
|
const r = Y(e) / 255, o = Y(t) / 255, a = Y(n) / 255, s = Math.max(r, o, a), l = Math.min(r, o, a), d = s - l;
|
|
2175
2175
|
let i = 0;
|
|
2176
2176
|
return d !== 0 && (s === r ? i = 60 * ((o - a) / d % 6) : s === o ? i = 60 * ((a - r) / d + 2) : i = 60 * ((r - o) / d + 4)), {
|
|
@@ -2178,7 +2178,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2178
2178
|
s: s === 0 ? 0 : d / s,
|
|
2179
2179
|
v: s
|
|
2180
2180
|
};
|
|
2181
|
-
},
|
|
2181
|
+
}, Dt = ({
|
|
2182
2182
|
h: e,
|
|
2183
2183
|
s: t,
|
|
2184
2184
|
v: n
|
|
@@ -2191,16 +2191,16 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2191
2191
|
b: (d + a) * 255
|
|
2192
2192
|
};
|
|
2193
2193
|
}, xs = ({ h: e, s: t }) => {
|
|
2194
|
-
const n = e * Math.PI / 180, r =
|
|
2194
|
+
const n = e * Math.PI / 180, r = Sn(t) * 50;
|
|
2195
2195
|
return {
|
|
2196
2196
|
x: 50 + Math.cos(n) * r,
|
|
2197
2197
|
y: 50 + Math.sin(n) * r
|
|
2198
2198
|
};
|
|
2199
|
-
},
|
|
2199
|
+
}, Ot = (e, t) => {
|
|
2200
2200
|
const n = t.getBoundingClientRect(), r = n.left + n.width / 2, o = n.top + n.height / 2, a = e.clientX - r, s = e.clientY - o, l = Math.min(Math.sqrt(a * a + s * s), n.width / 2), d = Math.atan2(s, a) * 180 / Math.PI;
|
|
2201
2201
|
return {
|
|
2202
2202
|
h: d < 0 ? d + 360 : d,
|
|
2203
|
-
s:
|
|
2203
|
+
s: Sn(l / (n.width / 2)),
|
|
2204
2204
|
v: 1
|
|
2205
2205
|
};
|
|
2206
2206
|
}, Es = [
|
|
@@ -2209,14 +2209,14 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2209
2209
|
], Ms = (e) => {
|
|
2210
2210
|
var t;
|
|
2211
2211
|
return (t = e.options) != null && t.length ? e.options : Es.map((n) => ({ label: n, value: n }));
|
|
2212
|
-
},
|
|
2212
|
+
}, Nn = () => {
|
|
2213
2213
|
const e = document.createElement("section");
|
|
2214
2214
|
return e.className = "bridgerte__payload-panel-field", e;
|
|
2215
2215
|
}, Ts = (e, t, n) => {
|
|
2216
|
-
const r =
|
|
2216
|
+
const r = Nn(), o = document.createElement("div");
|
|
2217
2217
|
return o.className = "bridgerte__payload-panel-option-list", e.options.forEach((a) => {
|
|
2218
2218
|
const s = document.createElement("button");
|
|
2219
|
-
s.type = "button", s.className = "bridgerte__payload-panel-option", s.textContent = a.label, s.dataset.bridgertePayloadOption = a.value, s.dataset.active = t[e.name] === a.value ? "true" : "false",
|
|
2219
|
+
s.type = "button", s.className = "bridgerte__payload-panel-option", s.textContent = a.label, s.dataset.bridgertePayloadOption = a.value, s.dataset.active = t[e.name] === a.value ? "true" : "false", W(s), s.addEventListener("pointerdown", (l) => {
|
|
2220
2220
|
l.preventDefault();
|
|
2221
2221
|
}), s.addEventListener("click", () => {
|
|
2222
2222
|
n({
|
|
@@ -2226,39 +2226,42 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2226
2226
|
}), o.append(s);
|
|
2227
2227
|
}), r.append(o), r;
|
|
2228
2228
|
}, Ls = (e, t, n) => {
|
|
2229
|
-
const r =
|
|
2230
|
-
let
|
|
2231
|
-
const
|
|
2232
|
-
const
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
const
|
|
2239
|
-
|
|
2229
|
+
const r = Nn(), o = document.createElement("div"), a = document.createElement("div"), s = document.createElement("span"), l = document.createElement("div"), d = document.createElement("div"), i = Ms(e), h = i.length === 2;
|
|
2230
|
+
let w = { h: 0, s: 0, v: 1 }, C = null;
|
|
2231
|
+
const T = (m) => {
|
|
2232
|
+
const f = Oe(m);
|
|
2233
|
+
return !!(f && i.some((E) => Oe(E.value) === f));
|
|
2234
|
+
}, b = (m, f = !0) => {
|
|
2235
|
+
const E = Oe(m);
|
|
2236
|
+
if (!E) return;
|
|
2237
|
+
t[e.name] = E, d.style.background = E, w = ks(Ln(E) ?? { r: 255, g: 255, b: 255 });
|
|
2238
|
+
const k = xs(w);
|
|
2239
|
+
a.dataset.active = f ? "true" : "false", d.dataset.empty = "false", f && (s.style.left = `${k.x}%`, s.style.top = `${k.y}%`);
|
|
2240
|
+
}, y = () => {
|
|
2241
|
+
const m = t[e.name];
|
|
2242
|
+
m && n({
|
|
2240
2243
|
...t,
|
|
2241
|
-
[e.name]:
|
|
2244
|
+
[e.name]: m
|
|
2242
2245
|
});
|
|
2243
2246
|
};
|
|
2244
|
-
r.className = "bridgerte__payload-panel-field", o.className = "bridgerte__payload-panel-color-wheel",
|
|
2245
|
-
const
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
}),
|
|
2249
|
-
|
|
2250
|
-
}),
|
|
2251
|
-
}),
|
|
2252
|
-
|
|
2253
|
-
}),
|
|
2254
|
-
|
|
2255
|
-
}),
|
|
2256
|
-
|
|
2257
|
-
}),
|
|
2258
|
-
|
|
2247
|
+
r.className = "bridgerte__payload-panel-field", o.className = "bridgerte__payload-panel-color-picker", a.className = "bridgerte__payload-panel-color-wheel", a.setAttribute("aria-label", `${e.label}选择区域`), s.className = "bridgerte__payload-panel-color-wheel-handle", l.className = "bridgerte__payload-panel-color-actions", l.dataset.layout = h ? "sides" : "grid", d.className = "bridgerte__payload-panel-color-preview", d.dataset.empty = "true", a.append(s), i.forEach((m) => {
|
|
2248
|
+
const f = document.createElement("button"), E = m.value;
|
|
2249
|
+
f.type = "button", f.className = "bridgerte__payload-panel-color-swatch", f.dataset.value = E, f.style.background = E, f.setAttribute("aria-label", `选择颜色 ${m.label}`), W(f), f.addEventListener("pointerdown", (k) => {
|
|
2250
|
+
k.preventDefault();
|
|
2251
|
+
}), f.addEventListener("click", () => {
|
|
2252
|
+
b(E, !1), y();
|
|
2253
|
+
}), l.append(f);
|
|
2254
|
+
}), a.addEventListener("pointerdown", (m) => {
|
|
2255
|
+
C = m.pointerId, a.setPointerCapture(m.pointerId), w = Ot(m, a), b(Ge(Dt(w))), m.preventDefault();
|
|
2256
|
+
}), a.addEventListener("pointermove", (m) => {
|
|
2257
|
+
C === m.pointerId && (w = Ot(m, a), b(Ge(Dt(w))));
|
|
2258
|
+
}), a.addEventListener("pointerup", (m) => {
|
|
2259
|
+
C === m.pointerId && (C = null, a.releasePointerCapture(m.pointerId), y());
|
|
2260
|
+
}), a.addEventListener("pointercancel", (m) => {
|
|
2261
|
+
C === m.pointerId && (C = null, a.releasePointerCapture(m.pointerId));
|
|
2259
2262
|
});
|
|
2260
|
-
const
|
|
2261
|
-
return
|
|
2263
|
+
const M = t[e.name];
|
|
2264
|
+
return M && b(M, !(h && T(M))), o.append(a, l), r.append(o, d), r;
|
|
2262
2265
|
}, Ss = (e, t, n) => {
|
|
2263
2266
|
const r = document.createElement("label"), o = document.createElement("input");
|
|
2264
2267
|
return r.className = "bridgerte__payload-panel-text-field", r.textContent = e.label, o.type = e.name === "href" || e.name === "url" ? "url" : "text", o.className = "bridgerte__payload-panel-text-input", o.value = t[e.name] ?? "", o.placeholder = e.placeholder ?? "", o.spellcheck = !1, o.addEventListener("input", () => {
|
|
@@ -2280,7 +2283,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2280
2283
|
}) => e.type === "color" ? Ls(e, t, n) : e.type === "text" ? Ss(e, t, n) : e.type === "number" ? Ns(e, t, n) : Ts(e, t, n), Is = (e) => {
|
|
2281
2284
|
var t, n, r;
|
|
2282
2285
|
return e.defaultValue ?? (e.type === "select" ? (t = e.options[0]) == null ? void 0 : t.value : void 0) ?? (e.type === "color" ? (r = (n = e.options) == null ? void 0 : n[0]) == null ? void 0 : r.value : void 0) ?? "";
|
|
2283
|
-
}, Rs = (e, t) => (t == null ? void 0 : t[e.name]) ?? (e.type === "color" ? "" : Is(e)),
|
|
2286
|
+
}, Rs = (e, t) => (t == null ? void 0 : t[e.name]) ?? (e.type === "color" ? "" : Is(e)), Ht = (e) => e.some((t) => t.type === "text" || t.type === "number"), As = (e) => {
|
|
2284
2287
|
const t = e.querySelector(
|
|
2285
2288
|
".bridgerte__payload-panel-text-input"
|
|
2286
2289
|
);
|
|
@@ -2291,7 +2294,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2291
2294
|
const r = document.createElement("div"), o = document.createElement("span"), a = (n == null ? void 0 : n(e)) ?? null;
|
|
2292
2295
|
if (r.className = "bridgerte__payload-panel-title", o.textContent = e.panel.title, r.append(o), a) {
|
|
2293
2296
|
const s = document.createElement("button");
|
|
2294
|
-
s.type = "button", s.className = "bridgerte__payload-panel-clear", s.textContent = "清除", s.setAttribute("aria-label", `清除${e.panel.title}`),
|
|
2297
|
+
s.type = "button", s.className = "bridgerte__payload-panel-clear", s.textContent = "清除", s.setAttribute("aria-label", `清除${e.panel.title}`), W(s), s.addEventListener("pointerdown", (l) => {
|
|
2295
2298
|
l.preventDefault();
|
|
2296
2299
|
}), s.addEventListener("click", () => {
|
|
2297
2300
|
t(a);
|
|
@@ -2304,14 +2307,14 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2304
2307
|
* 输入型面板保留默认宽度;table-insert 会按 schema 网格列数单独计算。
|
|
2305
2308
|
*/
|
|
2306
2309
|
e === "font-size" || e === "font-family" || e === "line-height" ? "180px" : "220px"
|
|
2307
|
-
), Os = 3, Hs = 3, $s = 10,
|
|
2310
|
+
), Os = 3, Hs = 3, $s = 10, Pn = 10, Fs = 16, zs = 2, Vs = 24, Ws = () => {
|
|
2308
2311
|
var e;
|
|
2309
2312
|
return typeof window < "u" && ((e = window.matchMedia) == null ? void 0 : e.call(window, "(hover: hover) and (pointer: fine)").matches) === !0;
|
|
2310
2313
|
}, ce = (e, t) => {
|
|
2311
2314
|
const n = Number.parseInt(e ?? "", 10);
|
|
2312
2315
|
return Number.isFinite(n) ? Math.min(Math.max(n, t.min), t.max) : t.defaultValue;
|
|
2313
|
-
}, Us = (e, t) => e.type === "number" && e.name === t,
|
|
2314
|
-
const o = e.find((
|
|
2316
|
+
}, Us = (e, t) => e.type === "number" && e.name === t, $t = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.floor(e) : t, Ft = (e, t, n, r) => {
|
|
2317
|
+
const o = e.find((h) => Us(h, t)), a = $t(o == null ? void 0 : o.min, 1), s = $t(o == null ? void 0 : o.max, n), l = Math.max(a, s), d = Math.min(Math.max(r, a), l), i = ce(o == null ? void 0 : o.defaultValue, {
|
|
2315
2318
|
min: a,
|
|
2316
2319
|
max: l,
|
|
2317
2320
|
defaultValue: d
|
|
@@ -2321,52 +2324,52 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2321
2324
|
max: l,
|
|
2322
2325
|
defaultValue: i
|
|
2323
2326
|
};
|
|
2324
|
-
},
|
|
2325
|
-
rows:
|
|
2327
|
+
}, In = (e) => ({
|
|
2328
|
+
rows: Ft(
|
|
2326
2329
|
e,
|
|
2327
2330
|
"rows",
|
|
2328
|
-
|
|
2331
|
+
en,
|
|
2329
2332
|
Os
|
|
2330
2333
|
),
|
|
2331
|
-
cols:
|
|
2334
|
+
cols: Ft(
|
|
2332
2335
|
e,
|
|
2333
2336
|
"cols",
|
|
2334
|
-
|
|
2337
|
+
tn,
|
|
2335
2338
|
Hs
|
|
2336
2339
|
)
|
|
2337
2340
|
}), js = (e) => {
|
|
2338
|
-
const t = Math.min(e.cols.max,
|
|
2339
|
-
return `${t * Fs + Math.max(t - 1, 0) * zs +
|
|
2341
|
+
const t = Math.min(e.cols.max, Pn);
|
|
2342
|
+
return `${t * Fs + Math.max(t - 1, 0) * zs + Vs}px`;
|
|
2340
2343
|
}, qs = ({
|
|
2341
2344
|
fields: e,
|
|
2342
2345
|
values: t,
|
|
2343
2346
|
onSubmit: n
|
|
2344
2347
|
}) => {
|
|
2345
|
-
const r =
|
|
2348
|
+
const r = In(e), o = document.createElement("section"), a = document.createElement("div"), s = document.createElement("div"), l = [], d = Ws(), i = Math.min(r.rows.max, $s), h = Math.min(r.cols.max, Pn), w = {
|
|
2346
2349
|
...r.rows,
|
|
2347
2350
|
max: i,
|
|
2348
2351
|
defaultValue: Math.min(r.rows.defaultValue, i)
|
|
2349
2352
|
}, C = {
|
|
2350
2353
|
...r.cols,
|
|
2351
|
-
max:
|
|
2352
|
-
defaultValue: Math.min(r.cols.defaultValue,
|
|
2354
|
+
max: h,
|
|
2355
|
+
defaultValue: Math.min(r.cols.defaultValue, h)
|
|
2353
2356
|
};
|
|
2354
|
-
let
|
|
2357
|
+
let T = ce(
|
|
2355
2358
|
t.rows,
|
|
2356
2359
|
w
|
|
2357
|
-
),
|
|
2360
|
+
), b = ce(
|
|
2358
2361
|
t.cols,
|
|
2359
2362
|
C
|
|
2360
|
-
),
|
|
2363
|
+
), y = null;
|
|
2361
2364
|
const M = (L, _) => {
|
|
2362
|
-
|
|
2363
|
-
const c = Number.parseInt(u.dataset.rows ?? "0", 10),
|
|
2364
|
-
u.dataset.active = String(c <= L &&
|
|
2365
|
+
T = L, b = _, t.rows = String(L), t.cols = String(_), s.textContent = `${L} x ${_}`, l.forEach((u) => {
|
|
2366
|
+
const c = Number.parseInt(u.dataset.rows ?? "0", 10), p = Number.parseInt(u.dataset.cols ?? "0", 10);
|
|
2367
|
+
u.dataset.active = String(c <= L && p <= _);
|
|
2365
2368
|
});
|
|
2366
|
-
},
|
|
2369
|
+
}, m = (L) => {
|
|
2367
2370
|
var _;
|
|
2368
2371
|
return ((_ = document.elementFromPoint(L.clientX, L.clientY)) == null ? void 0 : _.closest(".bridgerte__payload-panel-table-cell")) ?? null;
|
|
2369
|
-
},
|
|
2372
|
+
}, f = (L) => {
|
|
2370
2373
|
if (!L) return;
|
|
2371
2374
|
const _ = ce(
|
|
2372
2375
|
L.dataset.rows,
|
|
@@ -2376,52 +2379,52 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2376
2379
|
C
|
|
2377
2380
|
);
|
|
2378
2381
|
M(_, u);
|
|
2379
|
-
},
|
|
2382
|
+
}, E = () => {
|
|
2380
2383
|
n({
|
|
2381
2384
|
...t,
|
|
2382
|
-
rows: String(
|
|
2383
|
-
cols: String(
|
|
2385
|
+
rows: String(T),
|
|
2386
|
+
cols: String(b)
|
|
2384
2387
|
});
|
|
2385
|
-
},
|
|
2386
|
-
|
|
2388
|
+
}, k = () => {
|
|
2389
|
+
y = null;
|
|
2387
2390
|
}, I = () => {
|
|
2388
|
-
window.setTimeout(
|
|
2391
|
+
window.setTimeout(k, 0);
|
|
2389
2392
|
}, R = (L, _) => {
|
|
2390
|
-
if (L.detail > 0 &&
|
|
2393
|
+
if (L.detail > 0 && y !== _) {
|
|
2391
2394
|
L.preventDefault(), L.stopPropagation();
|
|
2392
2395
|
return;
|
|
2393
2396
|
}
|
|
2394
|
-
|
|
2397
|
+
k(), f(_), E();
|
|
2395
2398
|
};
|
|
2396
2399
|
for (let L = 1; L <= i; L += 1)
|
|
2397
|
-
for (let _ = 1; _ <=
|
|
2400
|
+
for (let _ = 1; _ <= h; _ += 1) {
|
|
2398
2401
|
const u = document.createElement("button");
|
|
2399
|
-
u.type = "button", u.className = "bridgerte__payload-panel-table-cell", u.dataset.rows = String(L), u.dataset.cols = String(_), u.setAttribute("aria-label", `插入 ${L} 行 ${_} 列表格`),
|
|
2400
|
-
|
|
2401
|
-
}), u.addEventListener("pointerup", I), u.addEventListener("pointercancel",
|
|
2402
|
+
u.type = "button", u.className = "bridgerte__payload-panel-table-cell", u.dataset.rows = String(L), u.dataset.cols = String(_), u.setAttribute("aria-label", `插入 ${L} 行 ${_} 列表格`), W(u), u.addEventListener("pointerdown", (c) => {
|
|
2403
|
+
y = u, f(u), c.preventDefault();
|
|
2404
|
+
}), u.addEventListener("pointerup", I), u.addEventListener("pointercancel", k), u.addEventListener("click", (c) => {
|
|
2402
2405
|
R(c, u);
|
|
2403
2406
|
}), d && u.addEventListener("pointerenter", () => {
|
|
2404
|
-
|
|
2407
|
+
f(u);
|
|
2405
2408
|
}), l.push(u), a.append(u);
|
|
2406
2409
|
}
|
|
2407
2410
|
return o.className = "bridgerte__payload-panel-field", a.className = "bridgerte__payload-panel-table-grid", a.setAttribute("aria-label", "选择表格行列"), a.style.setProperty(
|
|
2408
2411
|
"--bridgerte-payload-panel-table-cols",
|
|
2409
|
-
String(
|
|
2412
|
+
String(h)
|
|
2410
2413
|
), s.className = "bridgerte__payload-panel-table-status", s.setAttribute("aria-live", "polite"), a.addEventListener("pointermove", (L) => {
|
|
2411
|
-
d ||
|
|
2412
|
-
}), M(
|
|
2414
|
+
d || f(m(L));
|
|
2415
|
+
}), M(T, b), o.append(a, s), o;
|
|
2413
2416
|
}, Ks = "bridgerte-payload-panel";
|
|
2414
|
-
let
|
|
2415
|
-
const Gs = () => (
|
|
2417
|
+
let zt = 0;
|
|
2418
|
+
const Gs = () => (zt += 1, `${Ks}-${zt}`), Ce = (e) => e.panel.id === "table-insert", Xs = (e, t) => {
|
|
2416
2419
|
const n = document.createElement("button");
|
|
2417
|
-
return n.type = "button", n.className = "bridgerte__payload-panel-submit", n.textContent = "应用",
|
|
2420
|
+
return n.type = "button", n.className = "bridgerte__payload-panel-submit", n.textContent = "应用", W(n), n.addEventListener("pointerdown", (r) => {
|
|
2418
2421
|
r.preventDefault();
|
|
2419
2422
|
}), n.addEventListener("click", () => {
|
|
2420
2423
|
t(e);
|
|
2421
2424
|
}), n;
|
|
2422
2425
|
}, Js = (e) => {
|
|
2423
2426
|
let t = null, n = {};
|
|
2424
|
-
const r =
|
|
2427
|
+
const r = En({
|
|
2425
2428
|
root: e.editorRoot,
|
|
2426
2429
|
className: "bridgerte__payload-panel",
|
|
2427
2430
|
onBackdropClick: () => {
|
|
@@ -2434,19 +2437,19 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2434
2437
|
const a = (i) => {
|
|
2435
2438
|
var w;
|
|
2436
2439
|
if (!t || t.readonly || e.isReadonly()) return;
|
|
2437
|
-
const
|
|
2438
|
-
|
|
2439
|
-
o(), e.isReadonly() || e.executeCommand(
|
|
2440
|
+
const h = Cs(t.command, i);
|
|
2441
|
+
h && ((w = e.restoreEditorFocus) == null || w.call(e, () => {
|
|
2442
|
+
o(), e.isReadonly() || e.executeCommand(h);
|
|
2440
2443
|
}));
|
|
2441
2444
|
}, s = (i) => {
|
|
2442
|
-
var
|
|
2443
|
-
!t || t.readonly || e.isReadonly() || (
|
|
2445
|
+
var h;
|
|
2446
|
+
!t || t.readonly || e.isReadonly() || (h = e.restoreEditorFocus) == null || h.call(e, () => {
|
|
2444
2447
|
o(), e.isReadonly() || e.executeCommand(i);
|
|
2445
2448
|
});
|
|
2446
2449
|
}, l = (i) => {
|
|
2447
2450
|
n = i.panel.fields.reduce((w, C) => (w[C.name] = Rs(C, i.currentValues), w), {});
|
|
2448
|
-
const
|
|
2449
|
-
r.element.style.width = `min(${
|
|
2451
|
+
const h = Ce(i) ? js(In(i.panel.fields)) : Ds(i.panel.id);
|
|
2452
|
+
r.element.style.width = `min(${h}, calc(100vw - 24px))`, r.content.append(Bs(i, s, e.getClearCommand)), Ce(i) ? r.content.append(qs({
|
|
2450
2453
|
fields: i.panel.fields,
|
|
2451
2454
|
values: n,
|
|
2452
2455
|
onSubmit: a
|
|
@@ -2456,21 +2459,21 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2456
2459
|
values: n,
|
|
2457
2460
|
onSubmit: a
|
|
2458
2461
|
}));
|
|
2459
|
-
}), !Ce(i) &&
|
|
2462
|
+
}), !Ce(i) && Ht(i.panel.fields) && r.content.append(Xs(n, a)), r.open(i.anchorRect), !Ce(i) && Ht(i.panel.fields) && As(r.content);
|
|
2460
2463
|
};
|
|
2461
2464
|
return {
|
|
2462
2465
|
open: (i) => {
|
|
2463
2466
|
var C;
|
|
2464
2467
|
o();
|
|
2465
|
-
const
|
|
2468
|
+
const h = {
|
|
2466
2469
|
...i,
|
|
2467
2470
|
id: Gs(),
|
|
2468
2471
|
readonly: e.isReadonly(),
|
|
2469
2472
|
submit: a,
|
|
2470
2473
|
cancel: o
|
|
2471
2474
|
};
|
|
2472
|
-
if (t =
|
|
2473
|
-
if (
|
|
2475
|
+
if (t = h, ((C = e.onRequest) == null ? void 0 : C.call(e, h)) !== !0) {
|
|
2476
|
+
if (h.readonly) {
|
|
2474
2477
|
o();
|
|
2475
2478
|
return;
|
|
2476
2479
|
}
|
|
@@ -2490,109 +2493,109 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2490
2493
|
"table-delete"
|
|
2491
2494
|
], Qs = () => {
|
|
2492
2495
|
const e = new Map(Ne.map((t) => [t.id, t]));
|
|
2493
|
-
return Ys.map((t) =>
|
|
2494
|
-
},
|
|
2496
|
+
return Ys.map((t) => io.find((n) => n.id === t) ?? e.get(t)).filter((t) => t !== void 0);
|
|
2497
|
+
}, Rn = Qs(), Zs = new Map(
|
|
2495
2498
|
/*
|
|
2496
2499
|
* Controls 按钮用 MenuItem.id 查完整 command,同类命令的不同 payload 不能用 command.type 合并。
|
|
2497
2500
|
* 后续加入插入前/后、合并/拆分等表格菜单时,只要 id 稳定,就不会互相覆盖。
|
|
2498
2501
|
*/
|
|
2499
|
-
|
|
2500
|
-
), ei = (e) => e.matches(".bridgerte__table") ? e : e.querySelector(".bridgerte__table") ?? e, ti = (e, t) => e.classList.contains("bridgerte__table-wrapper") ? e : t.parentElement instanceof HTMLElement ? t.parentElement : t, ni = (e) => e.querySelector(".bridgerte__content") ?? e,
|
|
2502
|
+
Rn.map((e) => [e.id, e])
|
|
2503
|
+
), ei = (e) => e.matches(".bridgerte__table") ? e : e.querySelector(".bridgerte__table") ?? e, ti = (e, t) => e.classList.contains("bridgerte__table-wrapper") ? e : t.parentElement instanceof HTMLElement ? t.parentElement : t, ni = (e) => e.querySelector(".bridgerte__content") ?? e, Vt = (e) => e instanceof Element ? e.closest(".bridgerte__table-wrapper") : null, ri = (e) => {
|
|
2501
2504
|
const t = e.getFirstChild();
|
|
2502
2505
|
if (!Wr(t)) return null;
|
|
2503
2506
|
const n = t.getFirstChild();
|
|
2504
|
-
return
|
|
2507
|
+
return Ur(n) ? n : null;
|
|
2505
2508
|
}, oi = (e) => {
|
|
2506
2509
|
const t = document.createElement("button");
|
|
2507
2510
|
return t.type = "button", t.className = de, t.textContent = e.label, t.dataset.menuItemId = e.id, t.setAttribute("aria-label", e.label), t;
|
|
2508
2511
|
}, ai = () => {
|
|
2509
2512
|
const e = document.createElement("div");
|
|
2510
|
-
return e.className = "bridgerte__table-controls", e.contentEditable = "false", e.setAttribute("aria-label", "表格操作"),
|
|
2513
|
+
return e.className = "bridgerte__table-controls", e.contentEditable = "false", e.setAttribute("aria-label", "表格操作"), Rn.forEach((t) => {
|
|
2511
2514
|
e.append(oi(t));
|
|
2512
2515
|
}), e;
|
|
2513
2516
|
}, si = (e) => {
|
|
2514
2517
|
const t = document.createElement("div"), n = ni(e.root), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
2515
2518
|
let s = null, l = null, d = !1, i = null;
|
|
2516
|
-
const
|
|
2517
|
-
const S = e.root.getBoundingClientRect(), N =
|
|
2519
|
+
const h = (g, v) => {
|
|
2520
|
+
const S = e.root.getBoundingClientRect(), N = v.getBoundingClientRect(), O = N.bottom < S.top || N.top > S.bottom, H = Math.max(
|
|
2518
2521
|
8,
|
|
2519
2522
|
S.width - g.offsetWidth - 8
|
|
2520
2523
|
), P = Math.min(
|
|
2521
2524
|
Math.max(N.left - S.left + 8, 8),
|
|
2522
2525
|
H
|
|
2523
|
-
),
|
|
2524
|
-
g.hidden = O, g.style.transform = `translate(${P}px, ${
|
|
2526
|
+
), x = Math.max(8, N.top - S.top - g.offsetHeight - 8);
|
|
2527
|
+
g.hidden = O, g.style.transform = `translate(${P}px, ${x}px)`;
|
|
2525
2528
|
}, w = (g) => i === g, C = (g) => {
|
|
2526
|
-
const
|
|
2527
|
-
if (!
|
|
2528
|
-
|
|
2529
|
+
const v = e.editor.getElementByKey(g);
|
|
2530
|
+
if (!v) {
|
|
2531
|
+
T(g);
|
|
2529
2532
|
return;
|
|
2530
2533
|
}
|
|
2531
|
-
|
|
2532
|
-
const S = ei(
|
|
2534
|
+
v.dataset.lexicalKey = g;
|
|
2535
|
+
const S = ei(v), N = ti(v, S);
|
|
2533
2536
|
a.set(N, g);
|
|
2534
2537
|
const O = r.get(g);
|
|
2535
2538
|
if (!w(g)) {
|
|
2536
|
-
|
|
2539
|
+
T(g);
|
|
2537
2540
|
return;
|
|
2538
2541
|
}
|
|
2539
2542
|
if (O) {
|
|
2540
|
-
|
|
2543
|
+
h(O, N);
|
|
2541
2544
|
return;
|
|
2542
2545
|
}
|
|
2543
|
-
const H = ai(), P =
|
|
2546
|
+
const H = ai(), P = W(H, {
|
|
2544
2547
|
targetSelector: `.${de}`
|
|
2545
2548
|
});
|
|
2546
|
-
H.dataset.lexicalKey = g, r.set(g, H), o.set(H, P), t.append(H),
|
|
2547
|
-
},
|
|
2549
|
+
H.dataset.lexicalKey = g, r.set(g, H), o.set(H, P), t.append(H), h(H, N);
|
|
2550
|
+
}, T = (g) => {
|
|
2548
2551
|
var S;
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2551
|
-
},
|
|
2552
|
-
s = null, a.forEach((g,
|
|
2553
|
-
e.root.contains(
|
|
2552
|
+
const v = r.get(g);
|
|
2553
|
+
v && ((S = o.get(v)) == null || S(), o.delete(v), v.remove(), r.delete(g), i === g && (i = null));
|
|
2554
|
+
}, b = () => {
|
|
2555
|
+
s = null, a.forEach((g, v) => {
|
|
2556
|
+
e.root.contains(v) || (a.delete(v), T(g));
|
|
2554
2557
|
}), e.root.querySelectorAll(".bridgerte__table-wrapper").forEach((g) => {
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2557
|
-
}), r.forEach((g,
|
|
2558
|
-
C(
|
|
2558
|
+
const v = g.dataset.lexicalKey;
|
|
2559
|
+
v && (a.set(g, v), C(v));
|
|
2560
|
+
}), r.forEach((g, v) => {
|
|
2561
|
+
C(v);
|
|
2559
2562
|
}), i !== null && C(i);
|
|
2560
|
-
},
|
|
2561
|
-
s === null && (s = Te(
|
|
2563
|
+
}, y = () => {
|
|
2564
|
+
s === null && (s = Te(b));
|
|
2562
2565
|
}, M = (g) => {
|
|
2563
2566
|
e.editor.update(() => {
|
|
2564
2567
|
var S;
|
|
2565
|
-
const
|
|
2566
|
-
|
|
2568
|
+
const v = me(g);
|
|
2569
|
+
v instanceof We && ((S = ri(v)) == null || S.selectStart());
|
|
2567
2570
|
}), e.editor.focus();
|
|
2568
|
-
},
|
|
2569
|
-
M(g), e.executeCommand(
|
|
2570
|
-
},
|
|
2571
|
-
const S =
|
|
2572
|
-
!S || !O ||
|
|
2573
|
-
},
|
|
2571
|
+
}, m = (g, v) => {
|
|
2572
|
+
M(g), e.executeCommand(v);
|
|
2573
|
+
}, f = (g, v) => {
|
|
2574
|
+
const S = v.dataset.lexicalKey, N = g.dataset.menuItemId, O = N ? Zs.get(N) : void 0;
|
|
2575
|
+
!S || !O || m(S, O.command);
|
|
2576
|
+
}, E = (g) => {
|
|
2574
2577
|
if (!g) {
|
|
2575
2578
|
const N = i;
|
|
2576
2579
|
i = null, N !== null && C(N);
|
|
2577
2580
|
return;
|
|
2578
2581
|
}
|
|
2579
|
-
const
|
|
2580
|
-
if (!
|
|
2582
|
+
const v = g.dataset.lexicalKey ? g.dataset.lexicalKey : a.get(g) ?? null;
|
|
2583
|
+
if (!v || i === v) return;
|
|
2581
2584
|
const S = i;
|
|
2582
|
-
i =
|
|
2583
|
-
},
|
|
2584
|
-
|
|
2585
|
+
i = v, S !== null && C(S), C(v);
|
|
2586
|
+
}, k = (g) => {
|
|
2587
|
+
E(Vt(g.target));
|
|
2585
2588
|
}, I = (g) => {
|
|
2586
|
-
|
|
2589
|
+
E(Vt(g.target));
|
|
2587
2590
|
}, R = (g) => {
|
|
2588
|
-
const
|
|
2589
|
-
if (!(
|
|
2590
|
-
const S =
|
|
2591
|
+
const v = g.target;
|
|
2592
|
+
if (!(v instanceof HTMLElement)) return;
|
|
2593
|
+
const S = v.closest(`.${de}`);
|
|
2591
2594
|
S && (g.preventDefault(), l = g.pointerType === "mouse" ? null : S);
|
|
2592
2595
|
}, L = (g) => {
|
|
2593
2596
|
if (g.pointerType === "mouse" || !l) return;
|
|
2594
|
-
const
|
|
2595
|
-
N === l && S && (g.preventDefault(), g.stopPropagation(),
|
|
2597
|
+
const v = g.target, S = v instanceof HTMLElement ? v.closest(".bridgerte__table-controls") : null, N = v instanceof HTMLElement ? v.closest(`.${de}`) : null;
|
|
2598
|
+
N === l && S && (g.preventDefault(), g.stopPropagation(), f(N, S), d = !0), l = null;
|
|
2596
2599
|
}, _ = () => {
|
|
2597
2600
|
l = null;
|
|
2598
2601
|
}, u = (g) => {
|
|
@@ -2600,27 +2603,27 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2600
2603
|
d = !1, g.preventDefault(), g.stopPropagation();
|
|
2601
2604
|
return;
|
|
2602
2605
|
}
|
|
2603
|
-
const
|
|
2604
|
-
if (!(
|
|
2605
|
-
const S =
|
|
2606
|
-
!S || !N || (g.preventDefault(), g.stopPropagation(),
|
|
2606
|
+
const v = g.target;
|
|
2607
|
+
if (!(v instanceof HTMLElement)) return;
|
|
2608
|
+
const S = v.closest(`.${de}`), N = v.closest(".bridgerte__table-controls");
|
|
2609
|
+
!S || !N || (g.preventDefault(), g.stopPropagation(), f(S, N));
|
|
2607
2610
|
}, c = e.editor.registerMutationListener(
|
|
2608
2611
|
We,
|
|
2609
2612
|
(g) => {
|
|
2610
|
-
g.forEach((
|
|
2611
|
-
if (
|
|
2612
|
-
|
|
2613
|
+
g.forEach((v, S) => {
|
|
2614
|
+
if (v === "destroyed") {
|
|
2615
|
+
T(S);
|
|
2613
2616
|
return;
|
|
2614
2617
|
}
|
|
2615
2618
|
C(S);
|
|
2616
2619
|
});
|
|
2617
2620
|
}
|
|
2618
|
-
),
|
|
2619
|
-
return t.className = "bridgerte__table-controls-layer", e.root.append(t), t.addEventListener("pointerdown", R), t.addEventListener("pointerup", L), t.addEventListener("pointercancel", _), t.addEventListener("click", u), n.addEventListener("pointerdown",
|
|
2621
|
+
), p = e.editor.registerUpdateListener(y);
|
|
2622
|
+
return t.className = "bridgerte__table-controls-layer", e.root.append(t), t.addEventListener("pointerdown", R), t.addEventListener("pointerup", L), t.addEventListener("pointercancel", _), t.addEventListener("click", u), n.addEventListener("pointerdown", k), n.addEventListener("focusin", I), n.addEventListener("scroll", y, { passive: !0 }), window.addEventListener("resize", y), {
|
|
2620
2623
|
destroy() {
|
|
2621
|
-
c(),
|
|
2622
|
-
var
|
|
2623
|
-
(
|
|
2624
|
+
c(), p(), s !== null && (rt(s), s = null), t.removeEventListener("pointerdown", R), t.removeEventListener("pointerup", L), t.removeEventListener("pointercancel", _), t.removeEventListener("click", u), n.removeEventListener("pointerdown", k), n.removeEventListener("focusin", I), n.removeEventListener("scroll", y), window.removeEventListener("resize", y), r.forEach((g) => {
|
|
2625
|
+
var v;
|
|
2626
|
+
(v = o.get(g)) == null || v(), g.remove();
|
|
2624
2627
|
}), r.clear(), o.clear(), a.clear(), t.remove();
|
|
2625
2628
|
}
|
|
2626
2629
|
};
|
|
@@ -2632,7 +2635,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2632
2635
|
executeCommand: e.executeCommand,
|
|
2633
2636
|
getClearCommand: e.getClearCommand,
|
|
2634
2637
|
onRequest: e.onRequest
|
|
2635
|
-
}), n =
|
|
2638
|
+
}), n = ns({
|
|
2636
2639
|
editor: e.lexicalEditor,
|
|
2637
2640
|
root: e.editorRoot,
|
|
2638
2641
|
isReadonly: e.isReadonly,
|
|
@@ -2643,7 +2646,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2643
2646
|
editor: e.lexicalEditor,
|
|
2644
2647
|
root: e.editorRoot,
|
|
2645
2648
|
executeCommand: e.executeCommand
|
|
2646
|
-
}), o =
|
|
2649
|
+
}), o = vs({
|
|
2647
2650
|
editor: e.lexicalEditor,
|
|
2648
2651
|
root: e.editorRoot,
|
|
2649
2652
|
defaultWidthPercent: e.defaultMediaWidthPercent,
|
|
@@ -2680,7 +2683,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2680
2683
|
},
|
|
2681
2684
|
restore() {
|
|
2682
2685
|
t && e.update(() => {
|
|
2683
|
-
|
|
2686
|
+
ar((t == null ? void 0 : t.clone()) ?? null);
|
|
2684
2687
|
});
|
|
2685
2688
|
},
|
|
2686
2689
|
clear() {
|
|
@@ -2691,12 +2694,12 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2691
2694
|
changeHandlers: [],
|
|
2692
2695
|
excludeParents: [],
|
|
2693
2696
|
matchers: [
|
|
2694
|
-
|
|
2695
|
-
|
|
2697
|
+
mt(di, (e) => e.startsWith("http://") || e.startsWith("https://") ? e : `https://${e}`),
|
|
2698
|
+
mt(ui, (e) => `mailto:${e}`)
|
|
2696
2699
|
]
|
|
2697
2700
|
}, gi = ({
|
|
2698
2701
|
editor: e
|
|
2699
|
-
}) =>
|
|
2702
|
+
}) => Yr(e, mi), hi = [
|
|
2700
2703
|
".bridgerte__code-header",
|
|
2701
2704
|
".bridgerte__code-block-control",
|
|
2702
2705
|
".bridgerte__code-block-controls-layer",
|
|
@@ -2754,32 +2757,32 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2754
2757
|
height: (e == null ? void 0 : e.height) ?? window.innerHeight
|
|
2755
2758
|
};
|
|
2756
2759
|
}, Wt = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n));
|
|
2757
|
-
function
|
|
2760
|
+
function An(e, t, n = {}) {
|
|
2758
2761
|
const r = n.placement ?? "bottom-start", o = n.offset ?? 8, a = n.shiftPadding ?? 8, s = n.strategy ?? "absolute";
|
|
2759
2762
|
let l = null, d = !1;
|
|
2760
2763
|
const i = () => {
|
|
2761
2764
|
t.style.position = s, t.style.left = "0px", t.style.top = "0px", t.style.opacity = "0", t.style.pointerEvents = "none";
|
|
2762
|
-
},
|
|
2763
|
-
const M = vi(),
|
|
2764
|
-
t.style.left = `${Wt(
|
|
2765
|
+
}, h = (b, y) => {
|
|
2766
|
+
const M = vi(), m = t.getBoundingClientRect(), f = M.left + _e, E = M.top + _e, k = M.left + M.width - m.width - _e, I = M.top + M.height - m.height - _e;
|
|
2767
|
+
t.style.left = `${Wt(b, f, k)}px`, t.style.top = `${Wt(y, E, I)}px`, t.style.opacity = "", t.style.pointerEvents = "";
|
|
2765
2768
|
}, w = async () => {
|
|
2766
|
-
const
|
|
2769
|
+
const b = await po(e, t, {
|
|
2767
2770
|
placement: r,
|
|
2768
2771
|
strategy: s,
|
|
2769
|
-
platform:
|
|
2772
|
+
platform: fo,
|
|
2770
2773
|
middleware: [
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
+
bo(o),
|
|
2775
|
+
yo(),
|
|
2776
|
+
vo({ padding: a })
|
|
2774
2777
|
]
|
|
2775
2778
|
});
|
|
2776
|
-
|
|
2779
|
+
h(b.x, b.y);
|
|
2777
2780
|
}, C = () => {
|
|
2778
2781
|
l == null || l(), l = null;
|
|
2779
|
-
},
|
|
2780
|
-
if (d !==
|
|
2781
|
-
if (d =
|
|
2782
|
-
i(), t.hidden = !1, l =
|
|
2782
|
+
}, T = (b) => {
|
|
2783
|
+
if (d !== b) {
|
|
2784
|
+
if (d = b, C(), d) {
|
|
2785
|
+
i(), t.hidden = !1, l = ho(e, t, w), w();
|
|
2783
2786
|
return;
|
|
2784
2787
|
}
|
|
2785
2788
|
t.hidden = !0, t.style.opacity = "", t.style.pointerEvents = "";
|
|
@@ -2787,13 +2790,13 @@ function Rn(e, t, n = {}) {
|
|
|
2787
2790
|
};
|
|
2788
2791
|
return i(), t.hidden = !0, {
|
|
2789
2792
|
update: w,
|
|
2790
|
-
setOpen:
|
|
2793
|
+
setOpen: T,
|
|
2791
2794
|
destroy() {
|
|
2792
2795
|
C(), t.hidden = !0;
|
|
2793
2796
|
}
|
|
2794
2797
|
};
|
|
2795
2798
|
}
|
|
2796
|
-
const
|
|
2799
|
+
const Bn = {
|
|
2797
2800
|
// 居中对齐菜单使用,和 align 命令的 center value 对应。
|
|
2798
2801
|
"align-center": '<svg aria-hidden="true" class="lucide lucide-align-center" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M21 5H3" /> <path d="M17 12H7" /> <path d="M19 19H5" /> </svg>',
|
|
2799
2802
|
// 两端对齐菜单使用,保留段落排版语义,不和普通居中/左右对齐混用。
|
|
@@ -2889,13 +2892,13 @@ const An = {
|
|
|
2889
2892
|
}, wi = (e) => {
|
|
2890
2893
|
const t = document.createElement("span");
|
|
2891
2894
|
return t.className = "bridgerte__menu-icon-text", t.textContent = e, t;
|
|
2892
|
-
},
|
|
2895
|
+
}, Dn = (e, t, n) => {
|
|
2893
2896
|
if (t) {
|
|
2894
2897
|
e.innerHTML = t;
|
|
2895
2898
|
return;
|
|
2896
2899
|
}
|
|
2897
2900
|
e.append(wi(n));
|
|
2898
|
-
},
|
|
2901
|
+
}, Xe = () => {
|
|
2899
2902
|
const e = window.getSelection(), t = e != null && e.rangeCount ? e.getRangeAt(0) : null, n = t == null ? void 0 : t.getBoundingClientRect();
|
|
2900
2903
|
return !n || n.width === 0 && n.height === 0 ? null : n;
|
|
2901
2904
|
}, Ci = 160, _i = {
|
|
@@ -2916,12 +2919,12 @@ const An = {
|
|
|
2916
2919
|
}, ki = () => {
|
|
2917
2920
|
const e = A();
|
|
2918
2921
|
return D(e) && !e.isCollapsed();
|
|
2919
|
-
},
|
|
2922
|
+
}, Ut = (e, t) => e.target instanceof Node && t.contains(e.target), jt = (e) => e instanceof Element ? e.closest(".bridgerte__hoverbar-button") : null, xi = (e) => e.flatMap((t) => t.type === "button" ? [t.item] : t.type === "group" ? t.items : []), Ei = (e) => {
|
|
2920
2923
|
const t = document.createElement("span");
|
|
2921
2924
|
return t.className = "bridgerte__hoverbar-separator", t.dataset.separatorId = e.key, t.setAttribute("aria-hidden", "true"), t;
|
|
2922
2925
|
}, Mi = (e, t, n) => {
|
|
2923
|
-
const r =
|
|
2924
|
-
return o.type = "button", o.className = "bridgerte__hoverbar-button", o.dataset.hoverbarItemId = e.id, o.dataset.active = String(r.active), o.disabled = r.disabled, o.setAttribute("aria-label", e.label), o.setAttribute("aria-pressed", String(r.active)),
|
|
2926
|
+
const r = os(e, t), o = document.createElement("button");
|
|
2927
|
+
return o.type = "button", o.className = "bridgerte__hoverbar-button", o.dataset.hoverbarItemId = e.id, o.dataset.active = String(r.active), o.disabled = r.disabled, o.setAttribute("aria-label", e.label), o.setAttribute("aria-pressed", String(r.active)), Dn(o, n[e.icon] ?? Bn[e.icon], e.label), o;
|
|
2925
2928
|
}, Ti = ({
|
|
2926
2929
|
editorRoot: e,
|
|
2927
2930
|
contentElement: t,
|
|
@@ -2933,32 +2936,32 @@ const An = {
|
|
|
2933
2936
|
menuSchema: l,
|
|
2934
2937
|
hoverbarConfig: d,
|
|
2935
2938
|
menuLabels: i,
|
|
2936
|
-
payloadPanelConfig:
|
|
2939
|
+
payloadPanelConfig: h,
|
|
2937
2940
|
icons: w = {}
|
|
2938
2941
|
}) => {
|
|
2939
|
-
const C =
|
|
2942
|
+
const C = ot(l ?? Ne, {
|
|
2940
2943
|
menuLabels: i,
|
|
2941
|
-
payloadPanelConfig:
|
|
2942
|
-
}),
|
|
2943
|
-
let
|
|
2944
|
-
const
|
|
2944
|
+
payloadPanelConfig: h
|
|
2945
|
+
}), T = Ze(d ?? _i, C), b = xi(T), y = document.createElement("span"), M = document.createElement("div");
|
|
2946
|
+
let m = null, f = !1, E = null;
|
|
2947
|
+
const k = W(M, {
|
|
2945
2948
|
targetSelector: ".bridgerte__hoverbar-button"
|
|
2946
2949
|
});
|
|
2947
|
-
|
|
2950
|
+
y.className = "bridgerte__hoverbar-anchor", y.setAttribute("aria-hidden", "true"), M.className = "bridgerte__floating-menu bridgerte__hoverbar", M.setAttribute("role", "toolbar"), M.setAttribute("aria-label", "BridgeRTE hoverbar"), e.append(y, M), m = An(y, M, {
|
|
2948
2951
|
placement: "top",
|
|
2949
2952
|
offset: 8,
|
|
2950
2953
|
strategy: "fixed"
|
|
2951
2954
|
});
|
|
2952
2955
|
const I = () => {
|
|
2953
|
-
|
|
2956
|
+
E && (window.clearTimeout(E), E = null);
|
|
2954
2957
|
}, R = () => {
|
|
2955
|
-
I(),
|
|
2958
|
+
I(), f = !1, M.replaceChildren(), M.dataset.visible = "false", m == null || m.setOpen(!1);
|
|
2956
2959
|
}, L = () => {
|
|
2957
|
-
const P =
|
|
2958
|
-
|
|
2960
|
+
const P = Xe(), x = t.getBoundingClientRect();
|
|
2961
|
+
y.style.left = `${(P == null ? void 0 : P.left) ?? x.left}px`, y.style.top = `${(P == null ? void 0 : P.top) ?? x.top}px`, y.style.width = `${(P == null ? void 0 : P.width) || 1}px`, y.style.height = `${(P == null ? void 0 : P.height) || 1}px`;
|
|
2959
2962
|
}, _ = () => {
|
|
2960
2963
|
const P = s();
|
|
2961
|
-
M.replaceChildren(...
|
|
2964
|
+
M.replaceChildren(...T.flatMap((x) => x.type === "separator" ? [Ei(x)] : (x.type === "button" ? [x.item] : x.items).map((F) => Mi(F, P, w)))), L(), f = !0, M.dataset.visible = "true", m == null || m.setOpen(!0), m == null || m.update();
|
|
2962
2965
|
}, u = () => r() ? !1 : n.getEditorState().read(ki), c = (P = !1) => {
|
|
2963
2966
|
if (I(), !u()) {
|
|
2964
2967
|
R();
|
|
@@ -2968,19 +2971,19 @@ const An = {
|
|
|
2968
2971
|
_();
|
|
2969
2972
|
return;
|
|
2970
2973
|
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2974
|
+
f && R(), E = window.setTimeout(() => {
|
|
2975
|
+
E = null, u() && _();
|
|
2973
2976
|
}, Ci);
|
|
2974
|
-
},
|
|
2975
|
-
const
|
|
2976
|
-
if (!(!
|
|
2977
|
-
if (
|
|
2977
|
+
}, p = (P) => {
|
|
2978
|
+
const x = b.find((B) => B.id === P.dataset.hoverbarItemId);
|
|
2979
|
+
if (!(!x || P.disabled)) {
|
|
2980
|
+
if (x.payloadPanel) {
|
|
2978
2981
|
const B = P.getBoundingClientRect();
|
|
2979
2982
|
a({
|
|
2980
|
-
menuId:
|
|
2981
|
-
command:
|
|
2982
|
-
panel:
|
|
2983
|
-
currentValues:
|
|
2983
|
+
menuId: x.id,
|
|
2984
|
+
command: x.command,
|
|
2985
|
+
panel: x.payloadPanel,
|
|
2986
|
+
currentValues: rs(x, s()),
|
|
2984
2987
|
anchorRect: {
|
|
2985
2988
|
x: B.left,
|
|
2986
2989
|
y: B.top,
|
|
@@ -2990,28 +2993,28 @@ const An = {
|
|
|
2990
2993
|
}), c(!0);
|
|
2991
2994
|
return;
|
|
2992
2995
|
}
|
|
2993
|
-
o(
|
|
2996
|
+
o(x.command), c(!0);
|
|
2994
2997
|
}
|
|
2995
2998
|
}, g = (P) => {
|
|
2996
|
-
|
|
2997
|
-
},
|
|
2998
|
-
const
|
|
2999
|
-
|
|
2999
|
+
jt(P.target) && P.preventDefault();
|
|
3000
|
+
}, v = (P) => {
|
|
3001
|
+
const x = jt(P.target);
|
|
3002
|
+
x && (P.preventDefault(), p(x));
|
|
3000
3003
|
}, S = (P) => {
|
|
3001
|
-
!
|
|
3004
|
+
!f || Ut(P, M) || Ut(P, t) || R();
|
|
3002
3005
|
}, N = n.registerCommand(
|
|
3003
|
-
|
|
3006
|
+
rn,
|
|
3004
3007
|
() => (c(), !1),
|
|
3005
3008
|
U
|
|
3006
3009
|
), O = n.registerUpdateListener(() => {
|
|
3007
3010
|
c();
|
|
3008
3011
|
}), H = n.registerCommand(
|
|
3009
|
-
|
|
3010
|
-
(P) =>
|
|
3012
|
+
on,
|
|
3013
|
+
(P) => f ? (P == null || P.preventDefault(), R(), !0) : !1,
|
|
3011
3014
|
U
|
|
3012
3015
|
);
|
|
3013
|
-
return M.addEventListener("pointerdown", g), M.addEventListener("click",
|
|
3014
|
-
I(), N(), O(), H(), M.removeEventListener("pointerdown", g), M.removeEventListener("click",
|
|
3016
|
+
return M.addEventListener("pointerdown", g), M.addEventListener("click", v), document.addEventListener("pointerdown", S, !0), () => {
|
|
3017
|
+
I(), N(), O(), H(), M.removeEventListener("pointerdown", g), M.removeEventListener("click", v), document.removeEventListener("pointerdown", S, !0), k(), m == null || m.destroy(), y.remove(), M.remove();
|
|
3015
3018
|
};
|
|
3016
3019
|
}, Li = (e) => e.metaKey || e.ctrlKey, Si = {
|
|
3017
3020
|
b: { type: "format.bold" },
|
|
@@ -3062,15 +3065,15 @@ const An = {
|
|
|
3062
3065
|
return;
|
|
3063
3066
|
}
|
|
3064
3067
|
r > a && (e.scrollTop = r - e.clientHeight);
|
|
3065
|
-
},
|
|
3068
|
+
}, st = (e, t) => {
|
|
3066
3069
|
var n;
|
|
3067
3070
|
if (e instanceof Text && t <= (((n = e.textContent) == null ? void 0 : n.length) ?? 0)) return e;
|
|
3068
3071
|
for (const r of Array.from((e == null ? void 0 : e.childNodes) ?? [])) {
|
|
3069
|
-
const o =
|
|
3072
|
+
const o = st(r, t);
|
|
3070
3073
|
if (o) return o;
|
|
3071
3074
|
}
|
|
3072
3075
|
return null;
|
|
3073
|
-
},
|
|
3076
|
+
}, On = ({
|
|
3074
3077
|
editorRoot: e,
|
|
3075
3078
|
contentElement: t,
|
|
3076
3079
|
editor: n,
|
|
@@ -3081,68 +3084,68 @@ const An = {
|
|
|
3081
3084
|
getCurrentTrigger: l,
|
|
3082
3085
|
getTriggerRect: d,
|
|
3083
3086
|
resolveItems: i,
|
|
3084
|
-
renderItem:
|
|
3087
|
+
renderItem: h,
|
|
3085
3088
|
renderStatus: w,
|
|
3086
3089
|
onStateChange: C,
|
|
3087
|
-
onSelect:
|
|
3090
|
+
onSelect: T
|
|
3088
3091
|
}) => {
|
|
3089
|
-
let
|
|
3090
|
-
const M =
|
|
3092
|
+
let b = null, y = 0;
|
|
3093
|
+
const M = W(o, {
|
|
3091
3094
|
targetSelector: s
|
|
3092
|
-
}),
|
|
3095
|
+
}), m = An(a, o, {
|
|
3093
3096
|
placement: "bottom-start",
|
|
3094
3097
|
offset: 2,
|
|
3095
3098
|
strategy: "fixed"
|
|
3096
3099
|
});
|
|
3097
3100
|
e.append(a, o);
|
|
3098
|
-
const
|
|
3099
|
-
const
|
|
3100
|
-
return
|
|
3101
|
-
},
|
|
3102
|
-
const
|
|
3103
|
-
a.style.left = `${
|
|
3104
|
-
},
|
|
3105
|
-
|
|
3101
|
+
const f = () => {
|
|
3102
|
+
const x = b ? d(b.trigger) ?? Xe() : Xe(), B = t.getBoundingClientRect();
|
|
3103
|
+
return x ?? B;
|
|
3104
|
+
}, E = () => {
|
|
3105
|
+
const x = f();
|
|
3106
|
+
a.style.left = `${x.left}px`, a.style.top = `${x.top}px`, a.style.height = `${x.height || 1}px`;
|
|
3107
|
+
}, k = (x = !0) => {
|
|
3108
|
+
b = null, o.dataset.visible = "false", x && o.replaceChildren(), m.setOpen(!1);
|
|
3106
3109
|
}, I = () => {
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3109
|
-
}, R = (
|
|
3110
|
-
!
|
|
3110
|
+
const x = o.querySelector(`${s}[data-active="true"]`);
|
|
3111
|
+
x && Ai(o, x);
|
|
3112
|
+
}, R = (x, B) => {
|
|
3113
|
+
!b || b.requestId !== B.requestId || (k(), T(x, B.trigger));
|
|
3111
3114
|
}, L = () => {
|
|
3112
|
-
if (!
|
|
3113
|
-
|
|
3115
|
+
if (!b) {
|
|
3116
|
+
k();
|
|
3114
3117
|
return;
|
|
3115
3118
|
}
|
|
3116
|
-
const
|
|
3117
|
-
if ((C == null ? void 0 : C(
|
|
3119
|
+
const x = b, B = f();
|
|
3120
|
+
if ((C == null ? void 0 : C(x, {
|
|
3118
3121
|
anchorRect: B,
|
|
3119
|
-
close:
|
|
3120
|
-
selectItem: (te) => R(te,
|
|
3122
|
+
close: k,
|
|
3123
|
+
selectItem: (te) => R(te, x)
|
|
3121
3124
|
})) === !0) {
|
|
3122
|
-
o.replaceChildren(), o.dataset.visible = "false",
|
|
3125
|
+
o.replaceChildren(), o.dataset.visible = "false", m.setOpen(!1);
|
|
3123
3126
|
return;
|
|
3124
3127
|
}
|
|
3125
|
-
if (
|
|
3128
|
+
if (x.status === "success")
|
|
3126
3129
|
o.replaceChildren(
|
|
3127
|
-
...
|
|
3130
|
+
...x.items.map((te, dt) => h(te, dt, dt === x.activeIndex))
|
|
3128
3131
|
);
|
|
3129
3132
|
else {
|
|
3130
3133
|
const te = w == null ? void 0 : w(
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
+
x.status,
|
|
3135
|
+
x.trigger.query,
|
|
3136
|
+
x.error
|
|
3134
3137
|
);
|
|
3135
3138
|
o.replaceChildren(...te ? [te] : []);
|
|
3136
3139
|
}
|
|
3137
3140
|
const G = o.children.length > 0;
|
|
3138
|
-
o.dataset.visible = String(G),
|
|
3139
|
-
}, _ = async (
|
|
3141
|
+
o.dataset.visible = String(G), E(), m.setOpen(G), I(), m.update();
|
|
3142
|
+
}, _ = async (x, B) => {
|
|
3140
3143
|
let F;
|
|
3141
3144
|
try {
|
|
3142
|
-
F = await Promise.resolve(i(
|
|
3145
|
+
F = await Promise.resolve(i(x));
|
|
3143
3146
|
} catch (G) {
|
|
3144
|
-
(
|
|
3145
|
-
...
|
|
3147
|
+
(b == null ? void 0 : b.requestId) === B && (b = {
|
|
3148
|
+
...b,
|
|
3146
3149
|
items: [],
|
|
3147
3150
|
activeIndex: 0,
|
|
3148
3151
|
status: "error",
|
|
@@ -3150,67 +3153,67 @@ const An = {
|
|
|
3150
3153
|
}, L());
|
|
3151
3154
|
return;
|
|
3152
3155
|
}
|
|
3153
|
-
!
|
|
3154
|
-
...
|
|
3156
|
+
!b || B !== b.requestId || (b = {
|
|
3157
|
+
...b,
|
|
3155
3158
|
items: F,
|
|
3156
|
-
activeIndex: Math.min(
|
|
3159
|
+
activeIndex: Math.min(b.activeIndex, Math.max(F.length - 1, 0)),
|
|
3157
3160
|
status: F.length > 0 ? "success" : "empty",
|
|
3158
3161
|
error: void 0
|
|
3159
3162
|
}, L());
|
|
3160
3163
|
}, u = () => {
|
|
3161
3164
|
if (r()) {
|
|
3162
|
-
|
|
3165
|
+
k();
|
|
3163
3166
|
return;
|
|
3164
3167
|
}
|
|
3165
|
-
const
|
|
3166
|
-
if (!
|
|
3167
|
-
|
|
3168
|
+
const x = n.getEditorState().read(l);
|
|
3169
|
+
if (!x) {
|
|
3170
|
+
k(!1);
|
|
3168
3171
|
return;
|
|
3169
3172
|
}
|
|
3170
|
-
|
|
3171
|
-
trigger:
|
|
3173
|
+
y += 1, b = {
|
|
3174
|
+
trigger: x,
|
|
3172
3175
|
items: [],
|
|
3173
3176
|
activeIndex: 0,
|
|
3174
|
-
requestId:
|
|
3177
|
+
requestId: y,
|
|
3175
3178
|
status: "loading",
|
|
3176
3179
|
error: void 0
|
|
3177
|
-
}, L(), _(
|
|
3180
|
+
}, L(), _(x.query, y);
|
|
3178
3181
|
}, c = () => {
|
|
3179
|
-
if (!
|
|
3180
|
-
const
|
|
3181
|
-
return
|
|
3182
|
-
},
|
|
3183
|
-
...
|
|
3184
|
-
activeIndex: (
|
|
3185
|
-
}, L(), !0), g = (
|
|
3186
|
-
const B =
|
|
3187
|
-
!
|
|
3188
|
-
},
|
|
3189
|
-
const B =
|
|
3190
|
-
B instanceof HTMLElement && B.closest(s) &&
|
|
3182
|
+
if (!b || b.status !== "success") return !1;
|
|
3183
|
+
const x = b.items[b.activeIndex], B = b.trigger;
|
|
3184
|
+
return x ? (k(), T(x, B), !0) : !1;
|
|
3185
|
+
}, p = (x) => !b || b.status !== "success" || b.items.length === 0 ? !1 : (b = {
|
|
3186
|
+
...b,
|
|
3187
|
+
activeIndex: (b.activeIndex + x + b.items.length) % b.items.length
|
|
3188
|
+
}, L(), !0), g = (x) => {
|
|
3189
|
+
const B = x.target, F = B instanceof HTMLElement ? B.closest(s) : null, G = F != null && F.dataset.index ? Number.parseInt(F.dataset.index, 10) : Number.NaN;
|
|
3190
|
+
!b || b.status !== "success" || Number.isNaN(G) || (b = { ...b, activeIndex: G }, x.preventDefault(), c());
|
|
3191
|
+
}, v = (x) => {
|
|
3192
|
+
const B = x.target;
|
|
3193
|
+
B instanceof HTMLElement && B.closest(s) && x.preventDefault();
|
|
3191
3194
|
}, S = n.registerUpdateListener(() => {
|
|
3192
3195
|
u();
|
|
3193
3196
|
}), N = n.registerCommand(
|
|
3194
|
-
|
|
3195
|
-
(
|
|
3197
|
+
sr,
|
|
3198
|
+
(x) => p(1) ? (x == null || x.preventDefault(), !0) : !1,
|
|
3196
3199
|
U
|
|
3197
3200
|
), O = n.registerCommand(
|
|
3198
|
-
|
|
3199
|
-
(
|
|
3201
|
+
ir,
|
|
3202
|
+
(x) => p(-1) ? (x == null || x.preventDefault(), !0) : !1,
|
|
3200
3203
|
U
|
|
3201
3204
|
), H = n.registerCommand(
|
|
3202
|
-
|
|
3203
|
-
(
|
|
3205
|
+
lr,
|
|
3206
|
+
(x) => c() ? (x == null || x.preventDefault(), !0) : !1,
|
|
3204
3207
|
U
|
|
3205
3208
|
), P = n.registerCommand(
|
|
3206
|
-
|
|
3207
|
-
(
|
|
3209
|
+
on,
|
|
3210
|
+
(x) => b ? (x == null || x.preventDefault(), k(), !0) : !1,
|
|
3208
3211
|
U
|
|
3209
3212
|
);
|
|
3210
|
-
return o.addEventListener("click", g), o.addEventListener("pointerdown",
|
|
3211
|
-
close:
|
|
3213
|
+
return o.addEventListener("click", g), o.addEventListener("pointerdown", v), {
|
|
3214
|
+
close: k,
|
|
3212
3215
|
destroy() {
|
|
3213
|
-
S(), N(), O(), H(), P(), o.removeEventListener("click", g), o.removeEventListener("pointerdown",
|
|
3216
|
+
S(), N(), O(), H(), P(), o.removeEventListener("click", g), o.removeEventListener("pointerdown", v), M(), m.destroy(), a.remove(), o.remove();
|
|
3214
3217
|
}
|
|
3215
3218
|
};
|
|
3216
3219
|
}, Bi = {
|
|
@@ -3235,7 +3238,7 @@ const An = {
|
|
|
3235
3238
|
if (t.startsWith("data.")) return Oi(e, t);
|
|
3236
3239
|
const n = t === "id" ? e.id : t === "label" ? e.label : t === "value" ? e.value : t === "avatar" ? e.avatar : e.description;
|
|
3237
3240
|
return typeof n == "string" && n ? n : void 0;
|
|
3238
|
-
}, Hi = (e) => e.startsWith("@") ? e : `@${e}`,
|
|
3241
|
+
}, Hi = (e) => e.startsWith("@") ? e : `@${e}`, Hn = (e, t) => {
|
|
3239
3242
|
const n = ke(e, t.labelField) ?? e.label ?? e.value ?? e.id, r = t.showDescription ? ke(e, t.descriptionField) ?? e.description : void 0, o = t.showAvatar ? ke(e, t.avatarField) ?? e.avatar : void 0, a = t.showIcon && !o ? ke(e, t.iconField) : void 0;
|
|
3240
3243
|
return {
|
|
3241
3244
|
item: e,
|
|
@@ -3244,7 +3247,7 @@ const An = {
|
|
|
3244
3247
|
...o ? { avatar: o } : {},
|
|
3245
3248
|
...a ? { icon: a } : {}
|
|
3246
3249
|
};
|
|
3247
|
-
}, $i = (e, t) => e.map((n) =>
|
|
3250
|
+
}, $i = (e, t) => e.map((n) => Hn(n, t)), Je = (e) => e instanceof ee && e.getTextContent().startsWith(" "), Fi = (e) => {
|
|
3248
3251
|
const n = e.getTextContent().slice(1);
|
|
3249
3252
|
if (!n) {
|
|
3250
3253
|
e.remove();
|
|
@@ -3252,24 +3255,24 @@ const An = {
|
|
|
3252
3255
|
}
|
|
3253
3256
|
e.setTextContent(n);
|
|
3254
3257
|
}, zi = (e, t) => {
|
|
3255
|
-
const n = e.getPreviousSibling(), r = e.getNextSibling(), o =
|
|
3256
|
-
if (
|
|
3258
|
+
const n = e.getPreviousSibling(), r = e.getNextSibling(), o = Je(r) ? r.getNextSibling() : r;
|
|
3259
|
+
if (Je(r) && Fi(r), e.remove(), t) {
|
|
3257
3260
|
n == null || n.selectEnd();
|
|
3258
3261
|
return;
|
|
3259
3262
|
}
|
|
3260
3263
|
o == null || o.selectStart();
|
|
3261
|
-
},
|
|
3264
|
+
}, Vi = (e) => {
|
|
3262
3265
|
const t = A();
|
|
3263
3266
|
if (!D(t) || !t.isCollapsed()) return null;
|
|
3264
3267
|
const n = t.anchor, r = n.getNode();
|
|
3265
|
-
if (
|
|
3268
|
+
if (kt(r)) return r;
|
|
3266
3269
|
if (!(r instanceof ee)) return null;
|
|
3267
|
-
const o = r.getTextContentSize(), a = r.getPreviousSibling(), s = r.getNextSibling(), l =
|
|
3268
|
-
return
|
|
3269
|
-
},
|
|
3270
|
+
const o = r.getTextContentSize(), a = r.getPreviousSibling(), s = r.getNextSibling(), l = Je(r) && n.offset === 1, d = e ? n.offset === 0 || l ? a : null : n.offset === o ? s : null;
|
|
3271
|
+
return kt(d) ? d : null;
|
|
3272
|
+
}, Wi = (e, t, n) => {
|
|
3270
3273
|
const r = (a) => {
|
|
3271
3274
|
if (t()) return !1;
|
|
3272
|
-
const s =
|
|
3275
|
+
const s = Vi(a);
|
|
3273
3276
|
return s ? (zi(s, a), n(), !0) : !1;
|
|
3274
3277
|
}, o = (a, s) => {
|
|
3275
3278
|
const l = r(s);
|
|
@@ -3277,28 +3280,28 @@ const An = {
|
|
|
3277
3280
|
};
|
|
3278
3281
|
return [
|
|
3279
3282
|
e.registerCommand(
|
|
3280
|
-
|
|
3283
|
+
cr,
|
|
3281
3284
|
(a) => o(a, !0),
|
|
3282
3285
|
Ae
|
|
3283
3286
|
),
|
|
3284
3287
|
e.registerCommand(
|
|
3285
|
-
|
|
3288
|
+
dr,
|
|
3286
3289
|
(a) => o(a, !1),
|
|
3287
3290
|
Ae
|
|
3288
3291
|
),
|
|
3289
3292
|
e.registerCommand(
|
|
3290
|
-
|
|
3293
|
+
ur,
|
|
3291
3294
|
(a) => r(a),
|
|
3292
3295
|
Ae
|
|
3293
3296
|
)
|
|
3294
3297
|
];
|
|
3295
|
-
}, Ui = /(?:^|\s)@([\p{L}\p{N}_-]*)$/u,
|
|
3298
|
+
}, Ui = /(?:^|\s)@([\p{L}\p{N}_-]*)$/u, qt = [
|
|
3296
3299
|
{ id: "bridgerte-team", label: "BridgeRTE Team", value: "bridgerte-team" },
|
|
3297
3300
|
{ id: "frontend", label: "Frontend", value: "frontend" },
|
|
3298
3301
|
{ id: "designer", label: "Designer", value: "designer" }
|
|
3299
3302
|
], ji = (e) => e.trim().toLowerCase(), qi = (e) => [e.label, e.value, e.description].filter(Boolean).join(" ").toLowerCase(), Ki = (e) => {
|
|
3300
3303
|
const t = ji(e);
|
|
3301
|
-
return t ?
|
|
3304
|
+
return t ? qt.filter((n) => qi(n).includes(t)) : qt;
|
|
3302
3305
|
}, Gi = () => {
|
|
3303
3306
|
const e = A();
|
|
3304
3307
|
if (!D(e) || !e.isCollapsed()) return null;
|
|
@@ -3321,7 +3324,7 @@ const An = {
|
|
|
3321
3324
|
return e.className = "bridgerte__mention-anchor", e.setAttribute("aria-hidden", "true"), e;
|
|
3322
3325
|
}, Yi = (e, t) => {
|
|
3323
3326
|
var s;
|
|
3324
|
-
const n = e.getElementByKey(t.nodeKey), r =
|
|
3327
|
+
const n = e.getElementByKey(t.nodeKey), r = st(n, t.startOffset + 1);
|
|
3325
3328
|
if (!(r instanceof Text)) return null;
|
|
3326
3329
|
const o = document.createRange(), a = Math.min(t.startOffset + 1, ((s = r.textContent) == null ? void 0 : s.length) ?? 0);
|
|
3327
3330
|
return a <= t.startOffset ? null : (o.setStart(r, t.startOffset), o.setEnd(r, a), o.getBoundingClientRect());
|
|
@@ -3366,12 +3369,12 @@ const An = {
|
|
|
3366
3369
|
mentionMenuConfig: s,
|
|
3367
3370
|
onMentionMenuRequest: l
|
|
3368
3371
|
}) => {
|
|
3369
|
-
const d = Xi(), i = Ji(),
|
|
3372
|
+
const d = Xi(), i = Ji(), h = Di(s), w = (b, y) => {
|
|
3370
3373
|
n.update(() => {
|
|
3371
|
-
const M = me(
|
|
3372
|
-
M instanceof ee && (M.spliceText(
|
|
3373
|
-
}), o({ type: "mention.insert", item:
|
|
3374
|
-
}, C =
|
|
3374
|
+
const M = me(y.nodeKey);
|
|
3375
|
+
M instanceof ee && (M.spliceText(y.startOffset, y.endOffset - y.startOffset, ""), M.select(y.startOffset, y.startOffset));
|
|
3376
|
+
}), o({ type: "mention.insert", item: b });
|
|
3377
|
+
}, C = On({
|
|
3375
3378
|
editorRoot: e,
|
|
3376
3379
|
contentElement: t,
|
|
3377
3380
|
editor: n,
|
|
@@ -3380,38 +3383,38 @@ const An = {
|
|
|
3380
3383
|
anchor: i,
|
|
3381
3384
|
itemSelector: ".bridgerte__mention-item",
|
|
3382
3385
|
getCurrentTrigger: Gi,
|
|
3383
|
-
getTriggerRect: (
|
|
3384
|
-
resolveItems: async (
|
|
3385
|
-
const
|
|
3386
|
-
a ? a(
|
|
3386
|
+
getTriggerRect: (b) => Yi(n, b),
|
|
3387
|
+
resolveItems: async (b) => {
|
|
3388
|
+
const y = await Promise.resolve(
|
|
3389
|
+
a ? a(b) : Ki(b)
|
|
3387
3390
|
);
|
|
3388
|
-
return $i(
|
|
3391
|
+
return $i(y, h);
|
|
3389
3392
|
},
|
|
3390
3393
|
renderItem: Qi,
|
|
3391
|
-
renderStatus: (
|
|
3392
|
-
|
|
3393
|
-
el(
|
|
3394
|
+
renderStatus: (b) => Zi(
|
|
3395
|
+
b,
|
|
3396
|
+
el(b, h)
|
|
3394
3397
|
),
|
|
3395
|
-
onStateChange: l ? (
|
|
3396
|
-
id: `bridgerte-mention-menu-${
|
|
3397
|
-
query:
|
|
3398
|
-
status:
|
|
3399
|
-
items:
|
|
3400
|
-
config:
|
|
3398
|
+
onStateChange: l ? (b, y) => l({
|
|
3399
|
+
id: `bridgerte-mention-menu-${b.requestId}`,
|
|
3400
|
+
query: b.trigger.query,
|
|
3401
|
+
status: b.status,
|
|
3402
|
+
items: b.items,
|
|
3403
|
+
config: h,
|
|
3401
3404
|
readonly: r(),
|
|
3402
|
-
anchorRect: tl(
|
|
3403
|
-
...
|
|
3404
|
-
submit: (M) =>
|
|
3405
|
-
|
|
3405
|
+
anchorRect: tl(y.anchorRect),
|
|
3406
|
+
...b.error ? { error: b.error } : {},
|
|
3407
|
+
submit: (M) => y.selectItem(
|
|
3408
|
+
Hn(M, h)
|
|
3406
3409
|
),
|
|
3407
|
-
cancel:
|
|
3410
|
+
cancel: y.close
|
|
3408
3411
|
}) : void 0,
|
|
3409
|
-
onSelect: (
|
|
3410
|
-
}),
|
|
3411
|
-
...
|
|
3412
|
+
onSelect: (b, y) => w(b.item, y)
|
|
3413
|
+
}), T = an(
|
|
3414
|
+
...Wi(n, r, () => C.close(!1))
|
|
3412
3415
|
);
|
|
3413
3416
|
return () => {
|
|
3414
|
-
|
|
3417
|
+
T(), C.destroy();
|
|
3415
3418
|
};
|
|
3416
3419
|
}, rl = [
|
|
3417
3420
|
"script",
|
|
@@ -3480,7 +3483,7 @@ const An = {
|
|
|
3480
3483
|
"TT",
|
|
3481
3484
|
"U",
|
|
3482
3485
|
"UL"
|
|
3483
|
-
]), sl = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]), il = "p,div,blockquote,pre,h1,h2,h3,h4,h5,h6,ul,ol,table", ll = "p,blockquote,pre,h1,h2,h3,h4,h5,h6,ul,ol,table", cl = /* @__PURE__ */ new Set(["colspan", "rowspan"]), dl = /* @__PURE__ */ new Set(["TD", "TH"]), ul = /* @__PURE__ */ new Set(["M", "O", "V", "W"]), ml = /* @__PURE__ */ new Set(["SPAN"]), gl = /* @__PURE__ */ new Set(["color", "background-color"]), hl = /^#([\da-f]{3}|[\da-f]{6}|[\da-f]{8})$/i,
|
|
3486
|
+
]), sl = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]), il = "p,div,blockquote,pre,h1,h2,h3,h4,h5,h6,ul,ol,table", ll = "p,blockquote,pre,h1,h2,h3,h4,h5,h6,ul,ol,table", cl = /* @__PURE__ */ new Set(["colspan", "rowspan"]), dl = /* @__PURE__ */ new Set(["TD", "TH"]), ul = /* @__PURE__ */ new Set(["M", "O", "V", "W"]), ml = /* @__PURE__ */ new Set(["SPAN"]), gl = /* @__PURE__ */ new Set(["color", "background-color"]), hl = /^#([\da-f]{3}|[\da-f]{6}|[\da-f]{8})$/i, Kt = /* @__PURE__ */ new Map([
|
|
3484
3487
|
["B", "strong"],
|
|
3485
3488
|
["DEL", "s"],
|
|
3486
3489
|
["I", "em"],
|
|
@@ -3493,23 +3496,23 @@ const An = {
|
|
|
3493
3496
|
} catch {
|
|
3494
3497
|
return !1;
|
|
3495
3498
|
}
|
|
3496
|
-
},
|
|
3499
|
+
}, it = (e) => {
|
|
3497
3500
|
e.replaceWith(...e.childNodes);
|
|
3498
|
-
},
|
|
3501
|
+
}, lt = (e, t) => {
|
|
3499
3502
|
const n = e.ownerDocument.createElement(t);
|
|
3500
3503
|
return n.append(...e.childNodes), e.replaceWith(n), n;
|
|
3501
3504
|
}, fl = (e) => {
|
|
3502
3505
|
const t = e.tagName.split(":")[0] ?? "";
|
|
3503
3506
|
return e.tagName.includes(":") && ul.has(t);
|
|
3504
|
-
},
|
|
3507
|
+
}, $n = (e) => {
|
|
3505
3508
|
[...e.childNodes].forEach((t) => {
|
|
3506
3509
|
if (t.nodeType === Node.COMMENT_NODE) {
|
|
3507
3510
|
t.remove();
|
|
3508
3511
|
return;
|
|
3509
3512
|
}
|
|
3510
|
-
|
|
3513
|
+
$n(t);
|
|
3511
3514
|
});
|
|
3512
|
-
},
|
|
3515
|
+
}, Fn = (e) => {
|
|
3513
3516
|
[...e.childNodes].forEach((t) => {
|
|
3514
3517
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
3515
3518
|
const n = t.parentElement, r = !!(n != null && n.closest("pre,code,textarea")), o = (t.textContent ?? "").replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/\u00A0/g, r ? " " : " ");
|
|
@@ -3521,15 +3524,15 @@ const An = {
|
|
|
3521
3524
|
t.previousSibling || (a = a.trimStart()), t.nextSibling || (a = a.trimEnd()), t.textContent = a;
|
|
3522
3525
|
return;
|
|
3523
3526
|
}
|
|
3524
|
-
|
|
3527
|
+
Fn(t);
|
|
3525
3528
|
});
|
|
3526
|
-
}, bl = (e) => /^[1-9]\d*$/.test(e.trim()),
|
|
3529
|
+
}, bl = (e) => /^[1-9]\d*$/.test(e.trim()), ct = (e) => {
|
|
3527
3530
|
const t = e.trim().toLowerCase(), [, n] = t.match(hl) ?? [];
|
|
3528
3531
|
return n ? n.length === 8 ? `#${n.slice(2)}` : t : null;
|
|
3529
3532
|
}, yl = (e, t) => {
|
|
3530
3533
|
if (!ml.has(e)) return null;
|
|
3531
3534
|
const n = t.split(";").flatMap((r) => {
|
|
3532
|
-
const [o, ...a] = r.split(":"), s = o == null ? void 0 : o.trim().toLowerCase(), l =
|
|
3535
|
+
const [o, ...a] = r.split(":"), s = o == null ? void 0 : o.trim().toLowerCase(), l = ct(a.join(":"));
|
|
3533
3536
|
return !s || !l || !gl.has(s) ? [] : [`${s}: ${l}`];
|
|
3534
3537
|
});
|
|
3535
3538
|
return n.length > 0 ? `${n.join("; ")};` : null;
|
|
@@ -3539,7 +3542,7 @@ const An = {
|
|
|
3539
3542
|
return;
|
|
3540
3543
|
}
|
|
3541
3544
|
if (!al.has(e.tagName)) {
|
|
3542
|
-
|
|
3545
|
+
it(e);
|
|
3543
3546
|
return;
|
|
3544
3547
|
}
|
|
3545
3548
|
[...e.attributes].forEach((t) => {
|
|
@@ -3573,7 +3576,7 @@ const An = {
|
|
|
3573
3576
|
return;
|
|
3574
3577
|
}
|
|
3575
3578
|
if (e.tagName === "FONT" && n === "color") {
|
|
3576
|
-
if (
|
|
3579
|
+
if (ct(t.value)) return;
|
|
3577
3580
|
e.removeAttribute(t.name);
|
|
3578
3581
|
return;
|
|
3579
3582
|
}
|
|
@@ -3582,27 +3585,27 @@ const An = {
|
|
|
3582
3585
|
});
|
|
3583
3586
|
}, wl = (e) => {
|
|
3584
3587
|
[...e.querySelectorAll("font")].forEach((t) => {
|
|
3585
|
-
const n = t.getAttribute("color"), r = n ?
|
|
3588
|
+
const n = t.getAttribute("color"), r = n ? ct(n) : null, o = lt(t, "span");
|
|
3586
3589
|
r && o.setAttribute("style", `color: ${r};`);
|
|
3587
3590
|
});
|
|
3588
3591
|
}, Cl = (e) => {
|
|
3589
|
-
[...e.querySelectorAll([...
|
|
3590
|
-
const n =
|
|
3591
|
-
n &&
|
|
3592
|
+
[...e.querySelectorAll([...Kt.keys()].join(","))].forEach((t) => {
|
|
3593
|
+
const n = Kt.get(t.tagName);
|
|
3594
|
+
n && lt(t, n);
|
|
3592
3595
|
});
|
|
3593
3596
|
}, _l = (e) => {
|
|
3594
3597
|
[...e.querySelectorAll("div")].reverse().forEach((t) => {
|
|
3595
3598
|
if (t.querySelector(ll)) {
|
|
3596
|
-
|
|
3599
|
+
it(t);
|
|
3597
3600
|
return;
|
|
3598
3601
|
}
|
|
3599
|
-
|
|
3602
|
+
lt(t, "p");
|
|
3600
3603
|
});
|
|
3601
3604
|
}, kl = (e) => {
|
|
3602
3605
|
[...e.querySelectorAll("span")].forEach((t) => {
|
|
3603
|
-
t.attributes.length === 0 &&
|
|
3606
|
+
t.attributes.length === 0 && it(t);
|
|
3604
3607
|
});
|
|
3605
|
-
}, xl = (e) => !["P", "DIV", "SPAN"].includes(e.tagName) || e.querySelector("br,table,ul,ol") ? !1 : !(e.textContent ?? "").trim(),
|
|
3608
|
+
}, xl = (e) => !["P", "DIV", "SPAN"].includes(e.tagName) || e.querySelector("br,table,ul,ol") ? !1 : !(e.textContent ?? "").trim(), Gt = (e) => {
|
|
3606
3609
|
[...e.querySelectorAll("p,div,span")].reverse().forEach((t) => {
|
|
3607
3610
|
xl(t) && t.remove();
|
|
3608
3611
|
});
|
|
@@ -3636,13 +3639,13 @@ const An = {
|
|
|
3636
3639
|
r.remove();
|
|
3637
3640
|
}), t.content.querySelectorAll(ol).forEach((r) => {
|
|
3638
3641
|
r.remove();
|
|
3639
|
-
}),
|
|
3642
|
+
}), $n(t.content), Aa(t.content), [...t.content.querySelectorAll("*")].forEach(vl), Fn(t.content), wl(t.content), Cl(t.content), _l(t.content), kl(t.content), Gt(t.content);
|
|
3640
3643
|
const n = document.createElement("div");
|
|
3641
|
-
return n.append(t.content.cloneNode(!0)), Ml(n),
|
|
3644
|
+
return n.append(t.content.cloneNode(!0)), Ml(n), Gt(n), n.innerHTML;
|
|
3642
3645
|
}, Ll = /^https?:\/\/[^\s<>"']+\.[^\s<>"']+$/i, Sl = /^www\.[^\s<>"']+\.[^\s<>"']+$/i, Nl = new RegExp(
|
|
3643
3646
|
`^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(?:/[^\\s<>"']*)?$`,
|
|
3644
3647
|
"i"
|
|
3645
|
-
), Pl = /^[^\s@]+@[^\s@]+\.[^\s@]+$/i, Il = /^\s*```([a-z0-9_+#.-]+)\s*\n([\s\S]*?)\n?```\s*$/i, Rl = (e) => e.type.startsWith("image/") ? "image" : e.type.startsWith("video/") ? "video" : null,
|
|
3648
|
+
), Pl = /^[^\s@]+@[^\s@]+\.[^\s@]+$/i, Il = /^\s*```([a-z0-9_+#.-]+)\s*\n([\s\S]*?)\n?```\s*$/i, Rl = (e) => e.type.startsWith("image/") ? "image" : e.type.startsWith("video/") ? "video" : null, zn = (e) => e ? [...e].flatMap((t) => {
|
|
3646
3649
|
const n = Rl(t);
|
|
3647
3650
|
return n ? [{ type: n, file: t }] : [];
|
|
3648
3651
|
}) : [], Ie = (e) => ({
|
|
@@ -3661,38 +3664,38 @@ const An = {
|
|
|
3661
3664
|
}, Dl = (e) => {
|
|
3662
3665
|
const t = e.trim();
|
|
3663
3666
|
return !t || /\s/.test(t) || t.includes("<") || t.includes(">") || /^[a-z][a-z0-9+.-]*:/i.test(t) && !/^https?:\/\//i.test(t) || Pl.test(t) ? !1 : Ll.test(t) || Sl.test(t) || Nl.test(t);
|
|
3664
|
-
},
|
|
3667
|
+
}, Vn = (e, {
|
|
3665
3668
|
isReadonly: t,
|
|
3666
3669
|
executeCommand: n
|
|
3667
3670
|
}) => t() || !Dl(e.text) ? !1 : (n({
|
|
3668
3671
|
type: "link.set",
|
|
3669
3672
|
href: e.text.trim()
|
|
3670
|
-
}), !0),
|
|
3673
|
+
}), !0), Ye = (e, {
|
|
3671
3674
|
isReadonly: t,
|
|
3672
3675
|
canUploadMedia: n,
|
|
3673
3676
|
uploadMediaFile: r
|
|
3674
3677
|
}) => {
|
|
3675
3678
|
if (t() || !n()) return !1;
|
|
3676
|
-
const o =
|
|
3679
|
+
const o = zn(e.files);
|
|
3677
3680
|
return o.length === 0 ? !1 : (o.forEach(({ type: a, file: s }) => {
|
|
3678
3681
|
r(a, s);
|
|
3679
3682
|
}), !0);
|
|
3680
3683
|
}, Ol = (e, t) => {
|
|
3681
3684
|
const r = new DOMParser().parseFromString(t, "text/html");
|
|
3682
|
-
|
|
3683
|
-
const o =
|
|
3684
|
-
return
|
|
3685
|
+
Ba(r.body);
|
|
3686
|
+
const o = dn(e, r);
|
|
3687
|
+
return Da(o, r.body), o;
|
|
3685
3688
|
}, Hl = (e, t) => {
|
|
3686
3689
|
const n = Ol(e, t);
|
|
3687
3690
|
if (n.length === 0) return !1;
|
|
3688
3691
|
if (A() || $().selectEnd(), n.some(K)) {
|
|
3689
3692
|
n.forEach((o) => {
|
|
3690
|
-
|
|
3693
|
+
un(o);
|
|
3691
3694
|
});
|
|
3692
3695
|
const r = n[n.length - 1];
|
|
3693
|
-
return r && K(r) &&
|
|
3696
|
+
return r && K(r) && V([z()]), !0;
|
|
3694
3697
|
}
|
|
3695
|
-
return
|
|
3698
|
+
return V(n), !0;
|
|
3696
3699
|
}, $l = (e, {
|
|
3697
3700
|
editor: t,
|
|
3698
3701
|
isReadonly: n
|
|
@@ -3710,37 +3713,37 @@ const An = {
|
|
|
3710
3713
|
if (n() || e.html.trim() || !e.text.trim()) return !1;
|
|
3711
3714
|
const r = Bl(e.text);
|
|
3712
3715
|
return r ? (t.update(() => {
|
|
3713
|
-
const o =
|
|
3714
|
-
A() || $().selectEnd(), o.append(Se(r.code)),
|
|
3716
|
+
const o = wn(r.language || void 0), a = z();
|
|
3717
|
+
A() || $().selectEnd(), o.append(Se(r.code)), un(o), V([a]), a.selectStart();
|
|
3715
3718
|
}), !0) : !1;
|
|
3716
3719
|
}, zl = (e, {
|
|
3717
3720
|
editor: t,
|
|
3718
3721
|
isReadonly: n
|
|
3719
3722
|
}) => n() || e.html.trim() || !e.text ? !1 : (t.update(() => {
|
|
3720
|
-
A() || $().selectEnd(),
|
|
3723
|
+
A() || $().selectEnd(), V([Se(e.text)]);
|
|
3721
3724
|
}), !0), Wn = (e, t) => Fl(e, t) || $l(e, t), Q = (e) => {
|
|
3722
3725
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
3723
|
-
},
|
|
3726
|
+
}, Vl = (e, t) => Ye(e, t) || Vn(e, t) || Wn(e, t), Wl = (e) => {
|
|
3724
3727
|
const t = (n) => {
|
|
3725
|
-
n.defaultPrevented ||
|
|
3728
|
+
n.defaultPrevented || Vn(Ie(n.clipboardData), e) && Q(n);
|
|
3726
3729
|
};
|
|
3727
3730
|
return e.target.addEventListener("paste", t, { capture: !0 }), () => {
|
|
3728
3731
|
e.target.removeEventListener("paste", t, { capture: !0 });
|
|
3729
3732
|
};
|
|
3730
3733
|
}, Ul = (e) => {
|
|
3731
3734
|
const t = (o) => {
|
|
3732
|
-
o.defaultPrevented ||
|
|
3735
|
+
o.defaultPrevented || Ye(Ie(o.clipboardData), e) && Q(o);
|
|
3733
3736
|
}, n = (o) => {
|
|
3734
3737
|
var s;
|
|
3735
3738
|
if (e.isReadonly() || !e.canUploadMedia()) return;
|
|
3736
3739
|
const a = (s = o.dataTransfer) != null && s.files ? [...o.dataTransfer.files] : [];
|
|
3737
|
-
|
|
3740
|
+
zn(a).length !== 0 && (o.preventDefault(), o.dataTransfer && (o.dataTransfer.dropEffect = "copy"));
|
|
3738
3741
|
}, r = (o) => {
|
|
3739
3742
|
var s;
|
|
3740
3743
|
const a = {
|
|
3741
3744
|
files: (s = o.dataTransfer) != null && s.files ? [...o.dataTransfer.files] : []
|
|
3742
3745
|
};
|
|
3743
|
-
|
|
3746
|
+
Ye(a, e) && Q(o);
|
|
3744
3747
|
};
|
|
3745
3748
|
return e.target.addEventListener("paste", t, { capture: !0 }), e.target.addEventListener("dragover", n), e.target.addEventListener("drop", r), () => {
|
|
3746
3749
|
e.target.removeEventListener("paste", t, { capture: !0 }), e.target.removeEventListener("dragover", n), e.target.removeEventListener("drop", r);
|
|
@@ -3761,9 +3764,9 @@ const An = {
|
|
|
3761
3764
|
executeCommand: a,
|
|
3762
3765
|
editor: s
|
|
3763
3766
|
}) => {
|
|
3764
|
-
const l = (i,
|
|
3765
|
-
text:
|
|
3766
|
-
html:
|
|
3767
|
+
const l = (i, h) => Vl({
|
|
3768
|
+
text: h.text ?? i.text,
|
|
3769
|
+
html: h.html ?? i.html,
|
|
3767
3770
|
files: i.files
|
|
3768
3771
|
}, {
|
|
3769
3772
|
isReadonly: t,
|
|
@@ -3773,14 +3776,14 @@ const An = {
|
|
|
3773
3776
|
editor: s
|
|
3774
3777
|
}), d = (i) => {
|
|
3775
3778
|
if (t() || !n) return;
|
|
3776
|
-
const
|
|
3777
|
-
text:
|
|
3778
|
-
html:
|
|
3779
|
-
files:
|
|
3779
|
+
const h = Ie(i.clipboardData), w = n({
|
|
3780
|
+
text: h.text,
|
|
3781
|
+
html: h.html,
|
|
3782
|
+
files: h.files.map(Al)
|
|
3780
3783
|
});
|
|
3781
3784
|
if (w instanceof Promise) {
|
|
3782
3785
|
Q(i), w.then((C) => {
|
|
3783
|
-
C !== !0 && C && l(
|
|
3786
|
+
C !== !0 && C && l(h, C);
|
|
3784
3787
|
});
|
|
3785
3788
|
return;
|
|
3786
3789
|
}
|
|
@@ -3788,7 +3791,7 @@ const An = {
|
|
|
3788
3791
|
Q(i);
|
|
3789
3792
|
return;
|
|
3790
3793
|
}
|
|
3791
|
-
w && (Q(i), l(
|
|
3794
|
+
w && (Q(i), l(h, w));
|
|
3792
3795
|
};
|
|
3793
3796
|
return e.addEventListener("paste", d, { capture: !0 }), () => {
|
|
3794
3797
|
e.removeEventListener("paste", d, { capture: !0 });
|
|
@@ -3827,16 +3830,16 @@ const An = {
|
|
|
3827
3830
|
payloadPanel: e.payloadPanel,
|
|
3828
3831
|
group: e.group,
|
|
3829
3832
|
source: "schema"
|
|
3830
|
-
}), Zl = (e, t) => Jl(
|
|
3833
|
+
}), Zl = (e, t) => Jl(Ze(
|
|
3831
3834
|
Yl(t),
|
|
3832
3835
|
e
|
|
3833
|
-
)).map(Ql),
|
|
3836
|
+
)).map(Ql), Un = (e) => ({
|
|
3834
3837
|
...e,
|
|
3835
3838
|
source: "provider"
|
|
3836
3839
|
}), ec = /(?:^|\s)\/([\p{L}\p{N}_-]*)$/u, tc = (e) => e.trim().toLowerCase(), nc = (e) => [e.label, e.id, e.description, e.group, ...e.keywords ?? []].filter(Boolean).join(" ").toLowerCase(), rc = (e, t) => {
|
|
3837
3840
|
const n = tc(t);
|
|
3838
3841
|
return n ? e.filter((r) => nc(r).includes(n)) : e;
|
|
3839
|
-
}, oc = async (e, t) => (await Promise.resolve((t == null ? void 0 : t(e)) ?? [])).map(
|
|
3842
|
+
}, oc = async (e, t) => (await Promise.resolve((t == null ? void 0 : t(e)) ?? [])).map(Un), ac = (e) => "source" in e ? e : Un(e), sc = ({
|
|
3840
3843
|
menuSchema: e,
|
|
3841
3844
|
slashCommandConfig: t
|
|
3842
3845
|
}) => e !== void 0 || t !== void 0, ic = () => {
|
|
@@ -3859,9 +3862,9 @@ const An = {
|
|
|
3859
3862
|
}, cc = () => {
|
|
3860
3863
|
const e = document.createElement("span");
|
|
3861
3864
|
return e.className = "bridgerte__slash-command-anchor", e.setAttribute("aria-hidden", "true"), e;
|
|
3862
|
-
},
|
|
3865
|
+
}, Xt = (e, t) => {
|
|
3863
3866
|
var s;
|
|
3864
|
-
const n = e.getElementByKey(t.nodeKey), r =
|
|
3867
|
+
const n = e.getElementByKey(t.nodeKey), r = st(n, t.startOffset + 1);
|
|
3865
3868
|
if (!(r instanceof Text)) return null;
|
|
3866
3869
|
const o = document.createRange(), a = Math.min(t.startOffset + 1, ((s = r.textContent) == null ? void 0 : s.length) ?? 0);
|
|
3867
3870
|
return a <= t.startOffset ? null : (o.setStart(r, t.startOffset), o.setEnd(r, a), o.getBoundingClientRect());
|
|
@@ -3869,7 +3872,7 @@ const An = {
|
|
|
3869
3872
|
const a = document.createElement("button"), s = document.createElement("span");
|
|
3870
3873
|
if (a.type = "button", a.className = "bridgerte__menu-item bridgerte__slash-command-item", a.dataset.commandId = e.id, a.dataset.index = String(t), a.dataset.active = String(n), r.showIcon && e.icon) {
|
|
3871
3874
|
const l = document.createElement("span");
|
|
3872
|
-
l.className = "bridgerte__slash-command-item-icon", l.setAttribute("aria-hidden", "true"),
|
|
3875
|
+
l.className = "bridgerte__slash-command-item-icon", l.setAttribute("aria-hidden", "true"), Dn(l, o[e.icon] ?? Bn[e.icon], e.label), a.append(l);
|
|
3873
3876
|
}
|
|
3874
3877
|
if (s.className = "bridgerte__slash-command-item-title", s.textContent = e.label, a.append(s), e.description) {
|
|
3875
3878
|
const l = document.createElement("span");
|
|
@@ -3888,7 +3891,7 @@ const An = {
|
|
|
3888
3891
|
case "error":
|
|
3889
3892
|
return t.errorText;
|
|
3890
3893
|
}
|
|
3891
|
-
},
|
|
3894
|
+
}, Jt = (e) => e ? {
|
|
3892
3895
|
x: e.x,
|
|
3893
3896
|
y: e.y,
|
|
3894
3897
|
width: e.width,
|
|
@@ -3904,15 +3907,15 @@ const An = {
|
|
|
3904
3907
|
slashCommandConfig: l,
|
|
3905
3908
|
icons: d = {},
|
|
3906
3909
|
menuLabels: i,
|
|
3907
|
-
payloadPanelConfig:
|
|
3910
|
+
payloadPanelConfig: h,
|
|
3908
3911
|
slashCommandMenuConfig: w,
|
|
3909
3912
|
onSlashCommandMenuRequest: C,
|
|
3910
|
-
slashCommandProvider:
|
|
3913
|
+
slashCommandProvider: T
|
|
3911
3914
|
}) => {
|
|
3912
|
-
const
|
|
3915
|
+
const b = lc(), y = cc(), M = Xl(w), m = ot(s ?? Ne, {
|
|
3913
3916
|
menuLabels: i,
|
|
3914
|
-
payloadPanelConfig:
|
|
3915
|
-
}),
|
|
3917
|
+
payloadPanelConfig: h
|
|
3918
|
+
}), f = Zl(m, l), E = new Map(m.map((u) => [u.id, u])), k = sc({
|
|
3916
3919
|
menuSchema: s,
|
|
3917
3920
|
slashCommandConfig: l
|
|
3918
3921
|
}), I = (u) => {
|
|
@@ -3921,30 +3924,30 @@ const An = {
|
|
|
3921
3924
|
c instanceof ee && (c.spliceText(u.startOffset, u.endOffset - u.startOffset, ""), c.select(u.startOffset, u.startOffset));
|
|
3922
3925
|
});
|
|
3923
3926
|
};
|
|
3924
|
-
return
|
|
3927
|
+
return On({
|
|
3925
3928
|
editorRoot: e,
|
|
3926
3929
|
contentElement: t,
|
|
3927
3930
|
editor: n,
|
|
3928
3931
|
isReadonly: r,
|
|
3929
|
-
menu:
|
|
3930
|
-
anchor:
|
|
3932
|
+
menu: b,
|
|
3933
|
+
anchor: y,
|
|
3931
3934
|
itemSelector: ".bridgerte__slash-command-item",
|
|
3932
3935
|
getCurrentTrigger: ic,
|
|
3933
|
-
getTriggerRect: (u) =>
|
|
3936
|
+
getTriggerRect: (u) => Xt(n, u),
|
|
3934
3937
|
resolveItems: async (u) => {
|
|
3935
|
-
const c =
|
|
3938
|
+
const c = k || !T ? rc(f, u) : [];
|
|
3936
3939
|
try {
|
|
3937
|
-
const
|
|
3938
|
-
return [...c, ...
|
|
3939
|
-
} catch (
|
|
3940
|
+
const p = await oc(u, T);
|
|
3941
|
+
return [...c, ...p];
|
|
3942
|
+
} catch (p) {
|
|
3940
3943
|
if (c.length > 0) return c;
|
|
3941
|
-
throw
|
|
3944
|
+
throw p;
|
|
3942
3945
|
}
|
|
3943
3946
|
},
|
|
3944
|
-
renderItem: (u, c,
|
|
3947
|
+
renderItem: (u, c, p) => dc(
|
|
3945
3948
|
u,
|
|
3946
3949
|
c,
|
|
3947
|
-
|
|
3950
|
+
p,
|
|
3948
3951
|
M,
|
|
3949
3952
|
d
|
|
3950
3953
|
),
|
|
@@ -3959,34 +3962,34 @@ const An = {
|
|
|
3959
3962
|
items: u.items,
|
|
3960
3963
|
config: M,
|
|
3961
3964
|
readonly: r(),
|
|
3962
|
-
anchorRect:
|
|
3965
|
+
anchorRect: Jt(c.anchorRect),
|
|
3963
3966
|
...u.error ? { error: u.error } : {},
|
|
3964
|
-
submit: (
|
|
3967
|
+
submit: (p) => c.selectItem(ac(p)),
|
|
3965
3968
|
cancel: c.close
|
|
3966
3969
|
}) : void 0,
|
|
3967
3970
|
onSelect: (u, c) => {
|
|
3968
3971
|
I(c);
|
|
3969
|
-
const
|
|
3970
|
-
if (
|
|
3971
|
-
const g =
|
|
3972
|
+
const p = u.source === "schema" ? E.get(u.id) : void 0;
|
|
3973
|
+
if (p != null && p.payloadPanel) {
|
|
3974
|
+
const g = Xt(n, c);
|
|
3972
3975
|
a({
|
|
3973
|
-
menuId:
|
|
3974
|
-
command:
|
|
3975
|
-
panel:
|
|
3976
|
-
anchorRect:
|
|
3976
|
+
menuId: p.id,
|
|
3977
|
+
command: p.command,
|
|
3978
|
+
panel: p.payloadPanel,
|
|
3979
|
+
anchorRect: Jt(g ?? void 0)
|
|
3977
3980
|
});
|
|
3978
3981
|
return;
|
|
3979
3982
|
}
|
|
3980
3983
|
o(u.command);
|
|
3981
3984
|
}
|
|
3982
3985
|
}).destroy;
|
|
3983
|
-
},
|
|
3986
|
+
}, Yt = 32, He = (e) => {
|
|
3984
3987
|
var t;
|
|
3985
3988
|
return e instanceof HTMLElement && e.getAttribute("role") === "checkbox" && ((t = e.parentElement) == null ? void 0 : t.classList.contains("bridgerte__list--todo")) === !0;
|
|
3986
|
-
},
|
|
3989
|
+
}, $e = (e) => e instanceof HTMLElement ? e.closest('[role="checkbox"]') : null, hc = (e) => mr(e), Qt = (e) => e.button === 0, Fe = (e, t) => {
|
|
3987
3990
|
const n = t.getBoundingClientRect();
|
|
3988
|
-
return t.dir === "rtl" ? e.clientX >= n.right -
|
|
3989
|
-
},
|
|
3991
|
+
return t.dir === "rtl" ? e.clientX >= n.right - Yt && e.clientX <= n.right : e.clientX >= n.left && e.clientX <= n.left + Yt;
|
|
3992
|
+
}, Zt = (e) => {
|
|
3990
3993
|
e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
|
|
3991
3994
|
}, pc = ({
|
|
3992
3995
|
contentElement: e,
|
|
@@ -3995,27 +3998,27 @@ const An = {
|
|
|
3995
3998
|
}) => {
|
|
3996
3999
|
let r = 0;
|
|
3997
4000
|
const o = (d) => {
|
|
3998
|
-
if (n() || !
|
|
3999
|
-
const i =
|
|
4000
|
-
!i || !
|
|
4001
|
+
if (n() || !Qt(d)) return;
|
|
4002
|
+
const i = $e(d.target);
|
|
4003
|
+
!i || !He(i) || Fe(d, i) && Zt(d);
|
|
4001
4004
|
}, a = (d, i) => {
|
|
4002
|
-
|
|
4003
|
-
const
|
|
4004
|
-
|
|
4005
|
+
Zt(d), t.update(() => {
|
|
4006
|
+
const h = hc(i);
|
|
4007
|
+
Ir(h) && h.toggleChecked();
|
|
4005
4008
|
});
|
|
4006
4009
|
}, s = (d) => {
|
|
4007
|
-
if (n() || !
|
|
4008
|
-
const i =
|
|
4009
|
-
!i || !
|
|
4010
|
+
if (n() || !Qt(d) || Date.now() - r < 700) return;
|
|
4011
|
+
const i = $e(d.target);
|
|
4012
|
+
!i || !He(i) || Fe(d, i) && a(d, i);
|
|
4010
4013
|
}, l = (d) => {
|
|
4011
4014
|
if (n() || d.pointerType !== "touch") return;
|
|
4012
|
-
const i =
|
|
4013
|
-
!i || !
|
|
4015
|
+
const i = $e(d.target);
|
|
4016
|
+
!i || !He(i) || Fe(d, i) && (r = Date.now(), a(d, i));
|
|
4014
4017
|
};
|
|
4015
4018
|
return e.addEventListener("pointerdown", o, !0), e.addEventListener("pointerup", l, !0), e.addEventListener("click", s, !0), () => {
|
|
4016
4019
|
e.removeEventListener("pointerdown", o, !0), e.removeEventListener("pointerup", l, !0), e.removeEventListener("click", s, !0);
|
|
4017
4020
|
};
|
|
4018
|
-
},
|
|
4021
|
+
}, ze = (e, t) => {
|
|
4019
4022
|
var n;
|
|
4020
4023
|
return ((n = e.floatingMenus) == null ? void 0 : n[t]) !== !1;
|
|
4021
4024
|
}, fc = ({
|
|
@@ -4029,14 +4032,14 @@ const An = {
|
|
|
4029
4032
|
requestPayloadPanel: l,
|
|
4030
4033
|
uploadMediaFile: d,
|
|
4031
4034
|
canUploadMedia: i,
|
|
4032
|
-
syncAfterEditorUpdate:
|
|
4035
|
+
syncAfterEditorUpdate: h,
|
|
4033
4036
|
refreshCommandStates: w,
|
|
4034
4037
|
getCommandStates: C,
|
|
4035
|
-
setCanUndo:
|
|
4036
|
-
setCanRedo:
|
|
4037
|
-
enableKeyboardShortcuts:
|
|
4038
|
+
setCanUndo: T,
|
|
4039
|
+
setCanRedo: b,
|
|
4040
|
+
enableKeyboardShortcuts: y
|
|
4038
4041
|
}) => {
|
|
4039
|
-
const M =
|
|
4042
|
+
const M = ze(e, "mention"), m = ze(e, "slash"), f = ze(e, "hoverbar"), E = an(
|
|
4040
4043
|
/*
|
|
4041
4044
|
* 业务自定义 paste hook 最先看到原始剪贴板摘要;返回 undefined 时完全不拦截,
|
|
4042
4045
|
* 继续走 BridgeRTE 内置媒体、URL 和 HTML 清洗链路。
|
|
@@ -4064,7 +4067,7 @@ const An = {
|
|
|
4064
4067
|
* URL 粘贴是 BridgeRTE 的高意图快捷路径,必须先于 Lexical 默认 paste 监听注册。
|
|
4065
4068
|
* 否则 Lexical 会先把 URL 当普通文本插入,后续就失去“选区变链接”的语义。
|
|
4066
4069
|
*/
|
|
4067
|
-
|
|
4070
|
+
Wl({
|
|
4068
4071
|
target: r,
|
|
4069
4072
|
isReadonly: a,
|
|
4070
4073
|
executeCommand: s
|
|
@@ -4082,15 +4085,15 @@ const An = {
|
|
|
4082
4085
|
target: r,
|
|
4083
4086
|
isReadonly: a
|
|
4084
4087
|
}),
|
|
4085
|
-
|
|
4088
|
+
Cr(t),
|
|
4086
4089
|
/*
|
|
4087
4090
|
* 代码块高亮一刀切使用 Lexical 官方 Shiki 管线。BridgeRTE tokenizer 只保留稳定 class,
|
|
4088
4091
|
* 不把 Shiki theme 的 inline style 写进内容 HTML。
|
|
4089
4092
|
*/
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
Ir(t),
|
|
4093
|
+
go(t, $a),
|
|
4094
|
+
eo(t, o, wa),
|
|
4093
4095
|
Rr(t),
|
|
4096
|
+
Ar(t),
|
|
4094
4097
|
pc({
|
|
4095
4098
|
contentElement: r,
|
|
4096
4099
|
editor: t,
|
|
@@ -4107,7 +4110,7 @@ const An = {
|
|
|
4107
4110
|
onMentionMenuRequest: e.onMentionMenuRequest
|
|
4108
4111
|
}) : () => {
|
|
4109
4112
|
},
|
|
4110
|
-
|
|
4113
|
+
f ? Ti({
|
|
4111
4114
|
editorRoot: n,
|
|
4112
4115
|
contentElement: r,
|
|
4113
4116
|
editor: t,
|
|
@@ -4122,9 +4125,9 @@ const An = {
|
|
|
4122
4125
|
payloadPanelConfig: e.payloadPanelConfig
|
|
4123
4126
|
}) : () => {
|
|
4124
4127
|
},
|
|
4125
|
-
|
|
4128
|
+
jr(t),
|
|
4126
4129
|
gi({ editor: t }),
|
|
4127
|
-
|
|
4130
|
+
m ? gc({
|
|
4128
4131
|
editorRoot: n,
|
|
4129
4132
|
contentElement: r,
|
|
4130
4133
|
editor: t,
|
|
@@ -4141,103 +4144,103 @@ const An = {
|
|
|
4141
4144
|
slashCommandProvider: e.slashCommandProvider
|
|
4142
4145
|
}) : () => {
|
|
4143
4146
|
},
|
|
4144
|
-
|
|
4147
|
+
Do({
|
|
4145
4148
|
editor: t,
|
|
4146
4149
|
contentElement: r,
|
|
4147
4150
|
isReadonly: a
|
|
4148
4151
|
}),
|
|
4149
|
-
|
|
4152
|
+
y ? Ri({
|
|
4150
4153
|
target: r,
|
|
4151
4154
|
isReadonly: a,
|
|
4152
4155
|
executeCommand: s
|
|
4153
4156
|
}) : () => {
|
|
4154
4157
|
},
|
|
4155
4158
|
t.registerUpdateListener(() => {
|
|
4156
|
-
|
|
4159
|
+
h(), w();
|
|
4157
4160
|
}),
|
|
4158
4161
|
t.registerCommand(
|
|
4159
|
-
|
|
4162
|
+
rn,
|
|
4160
4163
|
() => (w(), !1),
|
|
4161
4164
|
U
|
|
4162
4165
|
),
|
|
4163
4166
|
t.registerCommand(
|
|
4164
|
-
|
|
4165
|
-
(
|
|
4167
|
+
gr,
|
|
4168
|
+
(k) => (T(k), !1),
|
|
4166
4169
|
U
|
|
4167
4170
|
),
|
|
4168
4171
|
t.registerCommand(
|
|
4169
|
-
|
|
4170
|
-
(
|
|
4172
|
+
hr,
|
|
4173
|
+
(k) => (b(k), !1),
|
|
4171
4174
|
U
|
|
4172
4175
|
)
|
|
4173
4176
|
);
|
|
4174
4177
|
return {
|
|
4175
4178
|
destroy() {
|
|
4176
|
-
|
|
4179
|
+
E();
|
|
4177
4180
|
}
|
|
4178
4181
|
};
|
|
4179
4182
|
};
|
|
4180
4183
|
function bc(e, t = {}) {
|
|
4181
|
-
const n =
|
|
4182
|
-
placeholder: t.placeholder ??
|
|
4184
|
+
const n = to(), r = t.mediaDefaultWidthPercent ?? 50, { contentElement: o } = li(e, {
|
|
4185
|
+
placeholder: t.placeholder ?? Ro
|
|
4183
4186
|
}), a = t.keyboardShortcuts === !0;
|
|
4184
|
-
let s = t.readonly ?? !1, l = !1, d =
|
|
4185
|
-
const i =
|
|
4186
|
-
namespace:
|
|
4187
|
+
let s = t.readonly ?? !1, l = !1, d = je(t.value);
|
|
4188
|
+
const i = pr({
|
|
4189
|
+
namespace: Ca,
|
|
4187
4190
|
editable: !s,
|
|
4188
4191
|
nodes: [
|
|
4189
|
-
Cr,
|
|
4190
4192
|
_r,
|
|
4191
|
-
|
|
4192
|
-
Mr,
|
|
4193
|
+
kr,
|
|
4193
4194
|
sn,
|
|
4194
|
-
|
|
4195
|
+
Tr,
|
|
4196
|
+
ln,
|
|
4197
|
+
Br,
|
|
4195
4198
|
We,
|
|
4196
|
-
jr,
|
|
4197
4199
|
qr,
|
|
4198
|
-
|
|
4200
|
+
Kr,
|
|
4199
4201
|
Qr,
|
|
4202
|
+
Zr,
|
|
4200
4203
|
ge,
|
|
4201
4204
|
se,
|
|
4202
4205
|
pe
|
|
4203
4206
|
],
|
|
4204
|
-
theme:
|
|
4207
|
+
theme: sa,
|
|
4205
4208
|
onError: (u) => {
|
|
4206
4209
|
j(t, "lexical.runtime", "Lexical runtime error.", u);
|
|
4207
4210
|
}
|
|
4208
4211
|
});
|
|
4209
|
-
|
|
4210
|
-
const
|
|
4211
|
-
|
|
4212
|
-
},
|
|
4212
|
+
Gr(i, !0);
|
|
4213
|
+
const h = () => l, w = () => s, C = () => {
|
|
4214
|
+
h() || Bo({ editor: i, contentElement: o });
|
|
4215
|
+
}, T = ci({ editor: i }), b = _a({
|
|
4213
4216
|
lexicalEditor: i,
|
|
4214
4217
|
options: t,
|
|
4215
|
-
isDestroyed:
|
|
4218
|
+
isDestroyed: h,
|
|
4216
4219
|
setContent: (u) => {
|
|
4217
4220
|
d = u;
|
|
4218
4221
|
},
|
|
4219
4222
|
syncPlaceholder: C
|
|
4220
|
-
}),
|
|
4223
|
+
}), y = ea({
|
|
4221
4224
|
lexicalEditor: i,
|
|
4222
4225
|
options: t,
|
|
4223
|
-
isDestroyed:
|
|
4226
|
+
isDestroyed: h,
|
|
4224
4227
|
canUploadMedia: () => t.uploadAdapter !== void 0,
|
|
4225
4228
|
isReadonly: w
|
|
4226
|
-
}), M =
|
|
4229
|
+
}), M = va({
|
|
4227
4230
|
container: e,
|
|
4228
4231
|
lexicalEditor: i,
|
|
4229
4232
|
options: t,
|
|
4230
|
-
isDestroyed:
|
|
4233
|
+
isDestroyed: h,
|
|
4231
4234
|
isReadonly: w,
|
|
4232
4235
|
reportError: j
|
|
4233
|
-
}),
|
|
4236
|
+
}), m = () => {
|
|
4234
4237
|
o.contentEditable = String(!s), i.setEditable(!s);
|
|
4235
|
-
},
|
|
4238
|
+
}, E = ii({
|
|
4236
4239
|
editorRoot: e,
|
|
4237
4240
|
lexicalEditor: i,
|
|
4238
4241
|
isReadonly: w,
|
|
4239
4242
|
restoreEditorFocus: (u) => {
|
|
4240
|
-
|
|
4243
|
+
T.restore(), i.focus(u);
|
|
4241
4244
|
},
|
|
4242
4245
|
executeCommand: M,
|
|
4243
4246
|
getClearCommand: (u) => {
|
|
@@ -4258,10 +4261,10 @@ function bc(e, t = {}) {
|
|
|
4258
4261
|
menuLabels: t.menuLabels,
|
|
4259
4262
|
onRequest: t.onPayloadPanelRequest,
|
|
4260
4263
|
defaultMediaWidthPercent: r
|
|
4261
|
-
}),
|
|
4262
|
-
|
|
4264
|
+
}), k = () => Yo(t), I = () => Qo(t), R = (u) => {
|
|
4265
|
+
h() || (T.capture(), E.payloadPanelController.open(u));
|
|
4263
4266
|
};
|
|
4264
|
-
e.dataset.readonly = String(s), e.addEventListener("focusin",
|
|
4267
|
+
e.dataset.readonly = String(s), e.addEventListener("focusin", k), e.addEventListener("focusout", I), e.style.setProperty(
|
|
4265
4268
|
"--bridgerte-media-display-width",
|
|
4266
4269
|
`${r}%`
|
|
4267
4270
|
);
|
|
@@ -4276,48 +4279,48 @@ function bc(e, t = {}) {
|
|
|
4276
4279
|
requestPayloadPanel: R,
|
|
4277
4280
|
uploadMediaFile: M.uploadMediaFile,
|
|
4278
4281
|
canUploadMedia: () => t.uploadAdapter !== void 0,
|
|
4279
|
-
syncAfterEditorUpdate:
|
|
4280
|
-
refreshCommandStates:
|
|
4281
|
-
getCommandStates:
|
|
4282
|
-
setCanUndo:
|
|
4283
|
-
setCanRedo:
|
|
4282
|
+
syncAfterEditorUpdate: b.syncAfterEditorUpdate,
|
|
4283
|
+
refreshCommandStates: y.refreshCommandStates,
|
|
4284
|
+
getCommandStates: y.getCommandStates,
|
|
4285
|
+
setCanUndo: y.setCanUndo,
|
|
4286
|
+
setCanRedo: y.setCanRedo,
|
|
4284
4287
|
enableKeyboardShortcuts: a
|
|
4285
4288
|
});
|
|
4286
|
-
i.setRootElement(o),
|
|
4289
|
+
i.setRootElement(o), b.suppressNextChange(), d = So(i, t.value), m();
|
|
4287
4290
|
const _ = {
|
|
4288
4291
|
getContent() {
|
|
4289
|
-
return
|
|
4292
|
+
return h() || (b.clearContentChangeTimer(), b.syncContent(!1)), d;
|
|
4290
4293
|
},
|
|
4291
4294
|
setContent(u) {
|
|
4292
|
-
|
|
4295
|
+
h() || (b.clearContentChangeTimer(), d = je(u), b.suppressNextChange(), bn(i, d), b.enforceCurrentMaxLength(), C(), i.dispatchCommand(fr, void 0), y.setHistoryAvailability(!1, !1), b.syncContent(!0));
|
|
4293
4296
|
},
|
|
4294
4297
|
executeCommand(u) {
|
|
4295
4298
|
M(u);
|
|
4296
4299
|
},
|
|
4297
4300
|
requestPayloadPanel: R,
|
|
4298
|
-
getCommandStates:
|
|
4299
|
-
subscribeCommandStateChange:
|
|
4301
|
+
getCommandStates: y.getCommandStates,
|
|
4302
|
+
subscribeCommandStateChange: y.subscribeCommandStateChange,
|
|
4300
4303
|
setReadonly(u) {
|
|
4301
|
-
|
|
4304
|
+
h() || (s = u, e.dataset.readonly = String(s), m(), y.refreshCommandStates());
|
|
4302
4305
|
},
|
|
4303
4306
|
focus() {
|
|
4304
|
-
|
|
4307
|
+
h() || i.focus();
|
|
4305
4308
|
},
|
|
4306
4309
|
blur() {
|
|
4307
|
-
|
|
4310
|
+
h() || o.blur();
|
|
4308
4311
|
},
|
|
4309
4312
|
destroy() {
|
|
4310
|
-
|
|
4313
|
+
h() || (l = !0, b.clearContentChangeTimer(), E.destroy(), M.destroy(), y.destroy(), T.clear(), L.destroy(), i.setRootElement(null), e.removeEventListener("focusin", k), e.removeEventListener("focusout", I), e.classList.remove("bridgerte"), e.textContent = "", delete e.dataset.readonly);
|
|
4311
4314
|
}
|
|
4312
4315
|
};
|
|
4313
|
-
return
|
|
4316
|
+
return b.syncContent(!1), C(), y.refreshCommandStates(), Zo(t, _), _;
|
|
4314
4317
|
}
|
|
4315
|
-
const yc = (e) => !
|
|
4318
|
+
const yc = (e) => !Gn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.type === "editor.executeCommand" || e.type === "editor.setContent" || e.type === "editor.setReadonly" || e.type === "editor.requestContent" || e.type === "editor.payloadPanelResolved" || e.type === "editor.payloadPanelCanceled" || e.type === "editor.uploadResolved" || e.type === "editor.uploadRejected", vc = (e) => ({
|
|
4316
4319
|
id: e,
|
|
4317
4320
|
type: "editor.ready",
|
|
4318
4321
|
payload: {
|
|
4319
4322
|
menuSchema: Ne,
|
|
4320
|
-
eventTiming:
|
|
4323
|
+
eventTiming: Jn,
|
|
4321
4324
|
version: Le
|
|
4322
4325
|
}
|
|
4323
4326
|
}), wc = (e) => `native-upload:${e}:${Date.now()}:${Math.random().toString(36).slice(2)}`, Hc = ({
|
|
@@ -4326,7 +4329,7 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4326
4329
|
}) => {
|
|
4327
4330
|
var L;
|
|
4328
4331
|
let n = null, r = !1, o = null, a = null, s = null, l = 0;
|
|
4329
|
-
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(),
|
|
4332
|
+
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), h = (_) => {
|
|
4330
4333
|
r || t.postMessage(_);
|
|
4331
4334
|
}, w = () => {
|
|
4332
4335
|
s && (clearTimeout(s), s = null);
|
|
@@ -4334,24 +4337,24 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4334
4337
|
w(), s = setTimeout(() => {
|
|
4335
4338
|
if (r) return;
|
|
4336
4339
|
const _ = Math.ceil(e.getBoundingClientRect().height);
|
|
4337
|
-
_ !== l && (l = _,
|
|
4340
|
+
_ !== l && (l = _, h({
|
|
4338
4341
|
type: "editor.heightChange",
|
|
4339
4342
|
payload: { height: _ }
|
|
4340
4343
|
}));
|
|
4341
|
-
},
|
|
4342
|
-
},
|
|
4344
|
+
}, Xn);
|
|
4345
|
+
}, T = (_) => {
|
|
4343
4346
|
if (!n) return;
|
|
4344
4347
|
const u = n.getContent();
|
|
4345
|
-
|
|
4348
|
+
h({
|
|
4346
4349
|
id: _,
|
|
4347
4350
|
type: "editor.content",
|
|
4348
4351
|
payload: u
|
|
4349
|
-
}),
|
|
4352
|
+
}), h({
|
|
4350
4353
|
id: _,
|
|
4351
4354
|
type: "editor.contentChange",
|
|
4352
4355
|
payload: u
|
|
4353
4356
|
});
|
|
4354
|
-
},
|
|
4357
|
+
}, b = (_) => {
|
|
4355
4358
|
const u = _.payload, c = d.get(u.assetId);
|
|
4356
4359
|
if (c) {
|
|
4357
4360
|
if (d.delete(u.assetId), c.source === "uploadAdapter") {
|
|
@@ -4368,14 +4371,14 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4368
4371
|
assetId: u.assetId
|
|
4369
4372
|
});
|
|
4370
4373
|
}
|
|
4371
|
-
},
|
|
4374
|
+
}, y = (_) => {
|
|
4372
4375
|
const u = _.payload, c = d.get(u.assetId);
|
|
4373
4376
|
if (c) {
|
|
4374
4377
|
if (d.delete(u.assetId), c.source === "uploadAdapter") {
|
|
4375
4378
|
c.reject(new Error(u.message));
|
|
4376
4379
|
return;
|
|
4377
4380
|
}
|
|
4378
|
-
|
|
4381
|
+
h({
|
|
4379
4382
|
id: _.id,
|
|
4380
4383
|
type: "editor.error",
|
|
4381
4384
|
payload: {
|
|
@@ -4384,14 +4387,14 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4384
4387
|
}
|
|
4385
4388
|
});
|
|
4386
4389
|
}
|
|
4387
|
-
}, M = (_, u) => new Promise((c,
|
|
4390
|
+
}, M = (_, u) => new Promise((c, p) => {
|
|
4388
4391
|
d.set(u, {
|
|
4389
4392
|
type: _,
|
|
4390
4393
|
assetId: u,
|
|
4391
4394
|
source: "uploadAdapter",
|
|
4392
4395
|
resolve: c,
|
|
4393
|
-
reject:
|
|
4394
|
-
}),
|
|
4396
|
+
reject: p
|
|
4397
|
+
}), h({
|
|
4395
4398
|
type: "editor.uploadRequest",
|
|
4396
4399
|
payload: {
|
|
4397
4400
|
assetId: u,
|
|
@@ -4399,13 +4402,13 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4399
4402
|
accept: _ === "image" ? "image/*" : "video/*"
|
|
4400
4403
|
}
|
|
4401
4404
|
});
|
|
4402
|
-
}),
|
|
4405
|
+
}), m = (_) => {
|
|
4403
4406
|
const u = wc(_);
|
|
4404
4407
|
d.set(u, {
|
|
4405
4408
|
type: _,
|
|
4406
4409
|
assetId: u,
|
|
4407
4410
|
source: "nativePicker"
|
|
4408
|
-
}),
|
|
4411
|
+
}), h({
|
|
4409
4412
|
type: "editor.uploadRequest",
|
|
4410
4413
|
payload: {
|
|
4411
4414
|
assetId: u,
|
|
@@ -4413,36 +4416,36 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4413
4416
|
accept: _ === "image" ? "image/*" : "video/*"
|
|
4414
4417
|
}
|
|
4415
4418
|
});
|
|
4416
|
-
},
|
|
4419
|
+
}, f = (_) => {
|
|
4417
4420
|
const u = i.get(_.payload.requestId);
|
|
4418
4421
|
u && (i.delete(_.payload.requestId), u.request.submit(_.payload.values));
|
|
4419
|
-
},
|
|
4422
|
+
}, E = (_) => {
|
|
4420
4423
|
const u = i.get(_.payload.requestId);
|
|
4421
4424
|
u && (i.delete(_.payload.requestId), u.request.cancel());
|
|
4422
|
-
},
|
|
4425
|
+
}, k = (_, u) => {
|
|
4423
4426
|
n == null || n.destroy(), o == null || o(), d.clear(), i.clear(), n = bc(e, {
|
|
4424
4427
|
...u,
|
|
4425
4428
|
uploadAdapter: {
|
|
4426
|
-
uploadImage(c,
|
|
4427
|
-
return M("image",
|
|
4429
|
+
uploadImage(c, p) {
|
|
4430
|
+
return M("image", p.assetId);
|
|
4428
4431
|
},
|
|
4429
|
-
uploadVideo(c,
|
|
4430
|
-
return M("video",
|
|
4432
|
+
uploadVideo(c, p) {
|
|
4433
|
+
return M("video", p.assetId);
|
|
4431
4434
|
}
|
|
4432
4435
|
},
|
|
4433
4436
|
onContentChange: (c) => {
|
|
4434
|
-
|
|
4437
|
+
h({
|
|
4435
4438
|
type: "editor.contentChange",
|
|
4436
4439
|
payload: c
|
|
4437
4440
|
}), C();
|
|
4438
4441
|
},
|
|
4439
4442
|
onCommandStateChange: (c) => {
|
|
4440
|
-
|
|
4443
|
+
h({
|
|
4441
4444
|
type: "editor.commandStateChange",
|
|
4442
4445
|
payload: c
|
|
4443
4446
|
});
|
|
4444
4447
|
},
|
|
4445
|
-
onPayloadPanelRequest: (c) => (i.set(c.id, { request: c }),
|
|
4448
|
+
onPayloadPanelRequest: (c) => (i.set(c.id, { request: c }), h({
|
|
4446
4449
|
type: "editor.payloadPanelRequest",
|
|
4447
4450
|
payload: {
|
|
4448
4451
|
menuId: c.menuId,
|
|
@@ -4455,24 +4458,24 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4455
4458
|
}
|
|
4456
4459
|
}), !0),
|
|
4457
4460
|
onError: (c) => {
|
|
4458
|
-
|
|
4461
|
+
h({
|
|
4459
4462
|
type: "editor.error",
|
|
4460
4463
|
payload: c
|
|
4461
4464
|
});
|
|
4462
4465
|
}
|
|
4463
4466
|
}), o = n.subscribeCommandStateChange((c) => {
|
|
4464
|
-
|
|
4467
|
+
h({
|
|
4465
4468
|
type: "editor.commandStateChange",
|
|
4466
4469
|
payload: c
|
|
4467
4470
|
});
|
|
4468
|
-
}),
|
|
4471
|
+
}), h(vc(_)), C();
|
|
4469
4472
|
}, I = (_) => {
|
|
4470
4473
|
if (_.type === "media.pickImage") {
|
|
4471
|
-
|
|
4474
|
+
m("image");
|
|
4472
4475
|
return;
|
|
4473
4476
|
}
|
|
4474
4477
|
if (_.type === "media.pickVideo") {
|
|
4475
|
-
|
|
4478
|
+
m("video");
|
|
4476
4479
|
return;
|
|
4477
4480
|
}
|
|
4478
4481
|
n == null || n.executeCommand(_);
|
|
@@ -4480,7 +4483,7 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4480
4483
|
if (!(r || !yc(_)))
|
|
4481
4484
|
switch (_.type) {
|
|
4482
4485
|
case "editor.init":
|
|
4483
|
-
|
|
4486
|
+
k(_.id, _.payload);
|
|
4484
4487
|
return;
|
|
4485
4488
|
case "editor.executeCommand":
|
|
4486
4489
|
I(_.payload);
|
|
@@ -4492,19 +4495,19 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4492
4495
|
n == null || n.setReadonly(_.payload.readonly);
|
|
4493
4496
|
return;
|
|
4494
4497
|
case "editor.requestContent":
|
|
4495
|
-
|
|
4498
|
+
T(_.id);
|
|
4496
4499
|
return;
|
|
4497
4500
|
case "editor.payloadPanelResolved":
|
|
4498
|
-
|
|
4501
|
+
f(_);
|
|
4499
4502
|
return;
|
|
4500
4503
|
case "editor.payloadPanelCanceled":
|
|
4501
|
-
|
|
4504
|
+
E(_);
|
|
4502
4505
|
return;
|
|
4503
4506
|
case "editor.uploadResolved":
|
|
4504
|
-
|
|
4507
|
+
b(_);
|
|
4505
4508
|
return;
|
|
4506
4509
|
case "editor.uploadRejected":
|
|
4507
|
-
|
|
4510
|
+
y(_);
|
|
4508
4511
|
return;
|
|
4509
4512
|
}
|
|
4510
4513
|
};
|
|
@@ -4518,12 +4521,12 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4518
4521
|
export {
|
|
4519
4522
|
bc as a,
|
|
4520
4523
|
Hc as b,
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4524
|
+
An as c,
|
|
4525
|
+
Bn as d,
|
|
4526
|
+
Dn as e,
|
|
4527
|
+
W as f,
|
|
4528
|
+
os as g,
|
|
4529
|
+
rs as h,
|
|
4530
|
+
ot as r
|
|
4528
4531
|
};
|
|
4529
|
-
//# sourceMappingURL=index-
|
|
4532
|
+
//# sourceMappingURL=index-BzpD9bI2.js.map
|