bridgerte 0.9.3 → 0.9.5
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 +892 -861
- package/dist/bridge.cjs.map +1 -1
- package/dist/bridge.d.ts +1 -3
- package/dist/bridge.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +9 -3
- package/dist/core.js +44 -54
- package/dist/core.js.map +1 -1
- package/dist/dom.cjs +1 -1
- package/dist/dom.d.ts +9 -3
- package/dist/dom.js +6 -5
- package/dist/index-BWi3d-Zp.js +314 -0
- package/dist/index-BWi3d-Zp.js.map +1 -0
- package/dist/index-B_g23O7q.cjs +4 -0
- package/dist/index-B_g23O7q.cjs.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-BwZ0II4h.js → index-DyCMSFrm.js} +1135 -1141
- package/dist/index-DyCMSFrm.js.map +1 -0
- package/dist/index-GaS65GL0.cjs.map +1 -1
- package/dist/index-H5V0EMkq.cjs +36 -0
- package/dist/index-H5V0EMkq.cjs.map +1 -0
- package/dist/index-sbZNOcCB.js +54 -0
- package/dist/index-sbZNOcCB.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -3
- package/dist/index.js +24 -21
- package/dist/index.js.map +1 -1
- package/dist/native-spec.cjs +1 -1
- package/dist/native-spec.cjs.map +1 -1
- package/dist/native-spec.d.ts +1 -3
- package/dist/native-spec.js +73 -119
- package/dist/native-spec.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webview.cjs +1 -1
- package/dist/webview.d.ts +1 -3
- 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 +0 -299
- 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,128 +1826,120 @@ 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" },
|
|
1882
1882
|
label: "左",
|
|
1883
|
-
icon: "align-left"
|
|
1884
|
-
group: "media"
|
|
1883
|
+
icon: "align-left"
|
|
1885
1884
|
},
|
|
1886
1885
|
{
|
|
1887
1886
|
id: "media-align-center",
|
|
1888
1887
|
command: { type: "media.align", assetId: "", value: "center" },
|
|
1889
1888
|
label: "中",
|
|
1890
|
-
icon: "align-center"
|
|
1891
|
-
group: "media"
|
|
1889
|
+
icon: "align-center"
|
|
1892
1890
|
},
|
|
1893
1891
|
{
|
|
1894
1892
|
id: "media-align-right",
|
|
1895
1893
|
command: { type: "media.align", assetId: "", value: "right" },
|
|
1896
1894
|
label: "右",
|
|
1897
|
-
icon: "align-right"
|
|
1898
|
-
group: "media"
|
|
1895
|
+
icon: "align-right"
|
|
1899
1896
|
},
|
|
1900
1897
|
{
|
|
1901
1898
|
id: "media-resize-20",
|
|
1902
1899
|
command: { type: "media.resize", assetId: "", widthPercent: 20 },
|
|
1903
1900
|
label: "20%",
|
|
1904
|
-
icon: "media-resize-20"
|
|
1905
|
-
group: "media"
|
|
1901
|
+
icon: "media-resize-20"
|
|
1906
1902
|
},
|
|
1907
1903
|
{
|
|
1908
1904
|
id: "media-resize-50",
|
|
1909
1905
|
command: { type: "media.resize", assetId: "", widthPercent: 50 },
|
|
1910
1906
|
label: "50%",
|
|
1911
|
-
icon: "media-resize-50"
|
|
1912
|
-
group: "media"
|
|
1907
|
+
icon: "media-resize-50"
|
|
1913
1908
|
},
|
|
1914
1909
|
{
|
|
1915
1910
|
id: "media-resize-100",
|
|
1916
1911
|
command: { type: "media.resize", assetId: "", widthPercent: 100 },
|
|
1917
1912
|
label: "100%",
|
|
1918
|
-
icon: "media-resize-100"
|
|
1919
|
-
group: "media"
|
|
1913
|
+
icon: "media-resize-100"
|
|
1920
1914
|
},
|
|
1921
1915
|
{
|
|
1922
1916
|
id: "media-retry",
|
|
1923
1917
|
command: { type: "media.retry", assetId: "" },
|
|
1924
1918
|
label: "重试",
|
|
1925
|
-
icon: "refresh-cw"
|
|
1926
|
-
group: "media"
|
|
1919
|
+
icon: "refresh-cw"
|
|
1927
1920
|
},
|
|
1928
1921
|
{
|
|
1929
1922
|
id: "media-remove",
|
|
1930
1923
|
command: { type: "media.remove", assetId: "" },
|
|
1931
1924
|
label: "删除",
|
|
1932
|
-
icon: "trash-2"
|
|
1933
|
-
group: "media"
|
|
1925
|
+
icon: "trash-2"
|
|
1934
1926
|
}
|
|
1935
|
-
],
|
|
1936
|
-
const t =
|
|
1927
|
+
], 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) => {
|
|
1928
|
+
const t = ds(e), n = at.filter((r) => !t.has(r));
|
|
1937
1929
|
return n.length === 0 ? e : [
|
|
1938
1930
|
...e,
|
|
1939
1931
|
"|",
|
|
1940
1932
|
...n
|
|
1941
1933
|
];
|
|
1942
|
-
},
|
|
1934
|
+
}, ms = (e) => {
|
|
1943
1935
|
var r;
|
|
1944
|
-
const t = (e == null ? void 0 : e.toolbarKeys) ??
|
|
1936
|
+
const t = (e == null ? void 0 : e.toolbarKeys) ?? as;
|
|
1945
1937
|
return {
|
|
1946
1938
|
...e,
|
|
1947
|
-
toolbarKeys:
|
|
1948
|
-
excludeKeys: (r = e == null ? void 0 : e.excludeKeys) == null ? void 0 : r.filter((o) => !
|
|
1939
|
+
toolbarKeys: us(t),
|
|
1940
|
+
excludeKeys: (r = e == null ? void 0 : e.excludeKeys) == null ? void 0 : r.filter((o) => !ls(o))
|
|
1949
1941
|
};
|
|
1950
|
-
},
|
|
1942
|
+
}, gs = (e, t) => {
|
|
1951
1943
|
switch (e.command.type) {
|
|
1952
1944
|
case "media.retry":
|
|
1953
1945
|
return { ...e.command, assetId: t };
|
|
@@ -1960,122 +1952,122 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
1960
1952
|
default:
|
|
1961
1953
|
return null;
|
|
1962
1954
|
}
|
|
1963
|
-
},
|
|
1964
|
-
const n =
|
|
1955
|
+
}, 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 = {}) => {
|
|
1956
|
+
const n = ot(is, {
|
|
1965
1957
|
menuLabels: t.menuLabels
|
|
1966
|
-
}), r = e === "error" ? { toolbarKeys:
|
|
1967
|
-
return
|
|
1968
|
-
}, ae = 8, le = "bridgerte__media-controls-button",
|
|
1958
|
+
}), r = e === "error" ? { toolbarKeys: ss } : ms(t.config);
|
|
1959
|
+
return Ze(r, n);
|
|
1960
|
+
}, 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
1961
|
const n = document.createElement("button");
|
|
1970
1962
|
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
|
-
},
|
|
1963
|
+
}, Tn = (e) => e.flatMap((t) => t.type === "button" ? [t.item] : t.type === "group" ? t.items : []), bs = (e, t, n, r) => {
|
|
1972
1964
|
if (t.type === "separator") {
|
|
1973
1965
|
const a = document.createElement("span");
|
|
1974
1966
|
a.className = "bridgerte__media-controls-separator", a.dataset.separatorId = t.key, a.setAttribute("aria-hidden", "true"), e.append(a);
|
|
1975
1967
|
return;
|
|
1976
1968
|
}
|
|
1977
1969
|
(t.type === "button" ? [t.item] : t.items).forEach((a) => {
|
|
1978
|
-
e.append(
|
|
1970
|
+
e.append(fs(
|
|
1979
1971
|
a,
|
|
1980
|
-
|
|
1972
|
+
hs(a, n, r)
|
|
1981
1973
|
));
|
|
1982
1974
|
});
|
|
1983
|
-
},
|
|
1975
|
+
}, ys = (e, t, n) => {
|
|
1984
1976
|
const r = document.createElement("div"), o = e.dataset.status, a = Number(
|
|
1985
1977
|
e.dataset.displayWidthPercent ?? t
|
|
1986
|
-
), s = e.dataset.align ?? "left", l =
|
|
1978
|
+
), s = e.dataset.align ?? "left", l = Mn(o, {
|
|
1987
1979
|
config: n.mediaControlsConfig,
|
|
1988
1980
|
menuLabels: n.menuLabels
|
|
1989
1981
|
});
|
|
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
|
-
|
|
1982
|
+
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) => {
|
|
1983
|
+
bs(r, d, a, s);
|
|
1992
1984
|
}), r;
|
|
1993
|
-
},
|
|
1994
|
-
const t = document.createElement("div"), n =
|
|
1985
|
+
}, vs = (e) => {
|
|
1986
|
+
const t = document.createElement("div"), n = ps(e.root), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
1995
1987
|
let s = null, l = null, d = !1, i = null;
|
|
1996
|
-
const
|
|
1988
|
+
const h = (c) => {
|
|
1997
1989
|
var g;
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2000
|
-
}, w = (c,
|
|
2001
|
-
const g = e.root.getBoundingClientRect(),
|
|
1990
|
+
const p = r.get(c);
|
|
1991
|
+
p && ((g = o.get(p)) == null || g(), o.delete(p), p.remove(), r.delete(c), i === c && (i = null));
|
|
1992
|
+
}, w = (c, p) => p.dataset.status === "error" || i === c, C = (c, p) => {
|
|
1993
|
+
const g = e.root.getBoundingClientRect(), v = p.getBoundingClientRect(), S = v.bottom < g.top || v.top > g.bottom, N = Math.max(
|
|
2002
1994
|
ae,
|
|
2003
1995
|
g.width - c.offsetWidth - ae
|
|
2004
1996
|
), O = Math.min(
|
|
2005
|
-
Math.max(
|
|
1997
|
+
Math.max(v.left - g.left + ae, ae),
|
|
2006
1998
|
N
|
|
2007
1999
|
), H = Math.max(
|
|
2008
2000
|
ae,
|
|
2009
|
-
|
|
2001
|
+
v.top - g.top - c.offsetHeight - ae
|
|
2010
2002
|
);
|
|
2011
2003
|
c.hidden = S, c.style.transform = `translate(${O}px, ${H}px)`;
|
|
2012
|
-
},
|
|
2013
|
-
const
|
|
2014
|
-
if (!
|
|
2015
|
-
|
|
2004
|
+
}, T = (c) => {
|
|
2005
|
+
const p = e.editor.getElementByKey(c);
|
|
2006
|
+
if (!p) {
|
|
2007
|
+
h(c);
|
|
2016
2008
|
return;
|
|
2017
2009
|
}
|
|
2018
|
-
|
|
2010
|
+
p.dataset.lexicalKey = c, a.set(p, c);
|
|
2019
2011
|
const g = r.get(c);
|
|
2020
|
-
if (!w(c,
|
|
2021
|
-
|
|
2012
|
+
if (!w(c, p)) {
|
|
2013
|
+
h(c);
|
|
2022
2014
|
return;
|
|
2023
2015
|
}
|
|
2024
2016
|
if (g) {
|
|
2025
|
-
const N =
|
|
2017
|
+
const N = p.dataset.status === "error", O = g.querySelector('[data-action="retry"]') !== null, H = p.dataset.displayWidthPercent ?? "", P = p.dataset.align ?? "";
|
|
2026
2018
|
if (N === O && g.dataset.displayWidthPercent === H && g.dataset.align === P) {
|
|
2027
|
-
C(g,
|
|
2019
|
+
C(g, p);
|
|
2028
2020
|
return;
|
|
2029
2021
|
}
|
|
2030
|
-
|
|
2022
|
+
h(c);
|
|
2031
2023
|
}
|
|
2032
|
-
const
|
|
2024
|
+
const v = ys(p, e.defaultWidthPercent, e), S = W(v, {
|
|
2033
2025
|
targetSelector: `.${le}`
|
|
2034
2026
|
});
|
|
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);
|
|
2027
|
+
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
2028
|
}, b = () => {
|
|
2046
|
-
s
|
|
2047
|
-
|
|
2048
|
-
|
|
2029
|
+
s = null, a.forEach((c, p) => {
|
|
2030
|
+
e.root.contains(p) || (a.delete(p), h(c));
|
|
2031
|
+
}), e.root.querySelectorAll(".bridgerte__media").forEach((c) => {
|
|
2032
|
+
const p = c.dataset.lexicalKey;
|
|
2033
|
+
p && (a.set(c, p), T(p));
|
|
2034
|
+
}), r.forEach((c, p) => {
|
|
2035
|
+
T(p);
|
|
2036
|
+
}), i !== null && T(i);
|
|
2037
|
+
}, y = () => {
|
|
2038
|
+
s === null && (s = Te(b));
|
|
2039
|
+
}, M = (c, p) => {
|
|
2040
|
+
const g = p.dataset.assetId, v = Tn(Mn(p.dataset.status, {
|
|
2049
2041
|
config: e.mediaControlsConfig,
|
|
2050
2042
|
menuLabels: e.menuLabels
|
|
2051
2043
|
})).find((N) => N.id === c.dataset.menuItemId);
|
|
2052
|
-
if (!g || !
|
|
2053
|
-
const S =
|
|
2044
|
+
if (!g || !v) return;
|
|
2045
|
+
const S = gs(v, g);
|
|
2054
2046
|
S && e.executeCommand(S);
|
|
2055
|
-
},
|
|
2047
|
+
}, m = (c) => {
|
|
2056
2048
|
if (!c) {
|
|
2057
|
-
const
|
|
2058
|
-
i = null,
|
|
2049
|
+
const v = i;
|
|
2050
|
+
i = null, v !== null && T(v);
|
|
2059
2051
|
return;
|
|
2060
2052
|
}
|
|
2061
|
-
const
|
|
2062
|
-
if (!
|
|
2053
|
+
const p = c.dataset.lexicalKey ? c.dataset.lexicalKey : a.get(c) ?? null;
|
|
2054
|
+
if (!p || i === p) return;
|
|
2063
2055
|
const g = i;
|
|
2064
|
-
i =
|
|
2065
|
-
},
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
}, T = (c) => {
|
|
2069
|
-
h(Rt(c.target));
|
|
2056
|
+
i = p, g !== null && T(g), T(p);
|
|
2057
|
+
}, f = (c) => {
|
|
2058
|
+
const p = At(c.target);
|
|
2059
|
+
m(p);
|
|
2070
2060
|
}, E = (c) => {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
const
|
|
2061
|
+
m(At(c.target));
|
|
2062
|
+
}, k = (c) => {
|
|
2063
|
+
const p = c.target;
|
|
2064
|
+
if (!(p instanceof HTMLElement)) return;
|
|
2065
|
+
const g = p.closest(`.${le}`);
|
|
2074
2066
|
g && (c.preventDefault(), l = c.pointerType === "mouse" ? null : g);
|
|
2075
2067
|
}, I = (c) => {
|
|
2076
2068
|
if (c.pointerType === "mouse" || !l) return;
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2069
|
+
const p = c.target, g = p instanceof HTMLElement ? p.closest(".bridgerte__media-controls") : null, v = p instanceof HTMLElement ? p.closest(`.${le}`) : null;
|
|
2070
|
+
v === l && g && (c.preventDefault(), c.stopPropagation(), M(v, g), d = !0), l = null;
|
|
2079
2071
|
}, R = () => {
|
|
2080
2072
|
l = null;
|
|
2081
2073
|
}, L = (c) => {
|
|
@@ -2083,41 +2075,41 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2083
2075
|
d = !1, c.preventDefault(), c.stopPropagation();
|
|
2084
2076
|
return;
|
|
2085
2077
|
}
|
|
2086
|
-
const
|
|
2087
|
-
if (!(
|
|
2088
|
-
const g =
|
|
2089
|
-
!g || !
|
|
2078
|
+
const p = c.target;
|
|
2079
|
+
if (!(p instanceof HTMLElement)) return;
|
|
2080
|
+
const g = p.closest(`.${le}`), v = p.closest(".bridgerte__media-controls");
|
|
2081
|
+
!g || !v || (c.preventDefault(), c.stopPropagation(), M(g, v));
|
|
2090
2082
|
}, _ = e.editor.registerMutationListener(
|
|
2091
2083
|
se,
|
|
2092
2084
|
(c) => {
|
|
2093
|
-
c.forEach((
|
|
2094
|
-
if (
|
|
2095
|
-
|
|
2085
|
+
c.forEach((p, g) => {
|
|
2086
|
+
if (p === "destroyed") {
|
|
2087
|
+
h(g);
|
|
2096
2088
|
return;
|
|
2097
2089
|
}
|
|
2098
|
-
|
|
2090
|
+
T(g);
|
|
2099
2091
|
});
|
|
2100
2092
|
}
|
|
2101
|
-
), u = e.editor.registerUpdateListener(
|
|
2102
|
-
return t.className = "bridgerte__media-controls-layer", e.root.append(t), t.addEventListener("pointerdown",
|
|
2093
|
+
), u = e.editor.registerUpdateListener(y);
|
|
2094
|
+
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
2095
|
destroy() {
|
|
2104
|
-
_(), u(), s !== null && (
|
|
2105
|
-
var
|
|
2106
|
-
(
|
|
2096
|
+
_(), 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) => {
|
|
2097
|
+
var p;
|
|
2098
|
+
(p = o.get(c)) == null || p(), c.remove();
|
|
2107
2099
|
}), r.clear(), o.clear(), a.clear(), t.remove();
|
|
2108
2100
|
}
|
|
2109
2101
|
};
|
|
2110
|
-
},
|
|
2102
|
+
}, ws = ["width", "height"], q = (e, t) => {
|
|
2111
2103
|
var r;
|
|
2112
2104
|
const n = (r = e[t]) == null ? void 0 : r.trim();
|
|
2113
2105
|
return n || void 0;
|
|
2114
|
-
},
|
|
2106
|
+
}, Ke = (e, t) => {
|
|
2115
2107
|
const n = Number.parseInt(e[t] ?? "", 10);
|
|
2116
2108
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2117
|
-
},
|
|
2118
|
-
const o =
|
|
2109
|
+
}, Bt = (e, t) => ws.reduce((n, r) => {
|
|
2110
|
+
const o = Ke(t, r);
|
|
2119
2111
|
return o === void 0 ? n : { ...n, [r]: o };
|
|
2120
|
-
}, e),
|
|
2112
|
+
}, e), Cs = (e, t) => {
|
|
2121
2113
|
if (e.type === "format.color" || e.type === "format.backgroundColor" || e.type === "format.fontSize" || e.type === "format.fontFamily" || e.type === "format.lineHeight")
|
|
2122
2114
|
return t.value !== void 0 ? { ...e, value: t.value } : e;
|
|
2123
2115
|
if (e.type === "link.set") {
|
|
@@ -2129,12 +2121,12 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2129
2121
|
if (e.type === "block.setCodeLanguage")
|
|
2130
2122
|
return t.language !== void 0 ? { ...e, language: t.language } : e;
|
|
2131
2123
|
if (e.type === "table.insert") {
|
|
2132
|
-
const n =
|
|
2124
|
+
const n = Ke(t, "rows"), r = Ke(t, "cols");
|
|
2133
2125
|
return n && r ? { type: "table.insert", rows: n, cols: r } : null;
|
|
2134
2126
|
}
|
|
2135
2127
|
if (e.type === "media.insertImage") {
|
|
2136
2128
|
const n = q(t, "url");
|
|
2137
|
-
return n ?
|
|
2129
|
+
return n ? Bt({
|
|
2138
2130
|
...e,
|
|
2139
2131
|
url: n,
|
|
2140
2132
|
alt: q(t, "alt"),
|
|
@@ -2143,7 +2135,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2143
2135
|
}
|
|
2144
2136
|
if (e.type === "media.insertVideo") {
|
|
2145
2137
|
const n = q(t, "url");
|
|
2146
|
-
return n ?
|
|
2138
|
+
return n ? Bt({
|
|
2147
2139
|
...e,
|
|
2148
2140
|
url: n,
|
|
2149
2141
|
poster: q(t, "poster"),
|
|
@@ -2151,7 +2143,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2151
2143
|
}, t) : null;
|
|
2152
2144
|
}
|
|
2153
2145
|
return e;
|
|
2154
|
-
}, Y = (e) => Math.min(Math.max(Math.round(e), 0), 255),
|
|
2146
|
+
}, 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
2147
|
const n = e.trim().match(/^#([0-9a-f]{6})$/i);
|
|
2156
2148
|
if (!n) return null;
|
|
2157
2149
|
const r = n[1] ?? "";
|
|
@@ -2160,17 +2152,17 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2160
2152
|
g: Number.parseInt(r.slice(2, 4), 16),
|
|
2161
2153
|
b: Number.parseInt(r.slice(4, 6), 16)
|
|
2162
2154
|
};
|
|
2163
|
-
},
|
|
2155
|
+
}, _s = (e) => {
|
|
2164
2156
|
const t = e.trim().match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);
|
|
2165
2157
|
return t ? {
|
|
2166
2158
|
r: Y(Number(t[1])),
|
|
2167
2159
|
g: Y(Number(t[2])),
|
|
2168
2160
|
b: Y(Number(t[3]))
|
|
2169
2161
|
} : null;
|
|
2170
|
-
},
|
|
2171
|
-
const t =
|
|
2172
|
-
return t ?
|
|
2173
|
-
},
|
|
2162
|
+
}, Oe = (e) => {
|
|
2163
|
+
const t = Ln(e) ?? _s(e);
|
|
2164
|
+
return t ? Ge(t) : null;
|
|
2165
|
+
}, Sn = (e) => Math.min(Math.max(e, 0), 1), ks = ({ r: e, g: t, b: n }) => {
|
|
2174
2166
|
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
2167
|
let i = 0;
|
|
2176
2168
|
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 +2170,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2178
2170
|
s: s === 0 ? 0 : d / s,
|
|
2179
2171
|
v: s
|
|
2180
2172
|
};
|
|
2181
|
-
},
|
|
2173
|
+
}, Dt = ({
|
|
2182
2174
|
h: e,
|
|
2183
2175
|
s: t,
|
|
2184
2176
|
v: n
|
|
@@ -2191,16 +2183,16 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2191
2183
|
b: (d + a) * 255
|
|
2192
2184
|
};
|
|
2193
2185
|
}, xs = ({ h: e, s: t }) => {
|
|
2194
|
-
const n = e * Math.PI / 180, r =
|
|
2186
|
+
const n = e * Math.PI / 180, r = Sn(t) * 50;
|
|
2195
2187
|
return {
|
|
2196
2188
|
x: 50 + Math.cos(n) * r,
|
|
2197
2189
|
y: 50 + Math.sin(n) * r
|
|
2198
2190
|
};
|
|
2199
|
-
},
|
|
2191
|
+
}, Ot = (e, t) => {
|
|
2200
2192
|
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
2193
|
return {
|
|
2202
2194
|
h: d < 0 ? d + 360 : d,
|
|
2203
|
-
s:
|
|
2195
|
+
s: Sn(l / (n.width / 2)),
|
|
2204
2196
|
v: 1
|
|
2205
2197
|
};
|
|
2206
2198
|
}, Es = [
|
|
@@ -2209,14 +2201,14 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2209
2201
|
], Ms = (e) => {
|
|
2210
2202
|
var t;
|
|
2211
2203
|
return (t = e.options) != null && t.length ? e.options : Es.map((n) => ({ label: n, value: n }));
|
|
2212
|
-
},
|
|
2204
|
+
}, Nn = () => {
|
|
2213
2205
|
const e = document.createElement("section");
|
|
2214
2206
|
return e.className = "bridgerte__payload-panel-field", e;
|
|
2215
2207
|
}, Ts = (e, t, n) => {
|
|
2216
|
-
const r =
|
|
2208
|
+
const r = Nn(), o = document.createElement("div");
|
|
2217
2209
|
return o.className = "bridgerte__payload-panel-option-list", e.options.forEach((a) => {
|
|
2218
2210
|
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",
|
|
2211
|
+
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
2212
|
l.preventDefault();
|
|
2221
2213
|
}), s.addEventListener("click", () => {
|
|
2222
2214
|
n({
|
|
@@ -2226,39 +2218,42 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2226
2218
|
}), o.append(s);
|
|
2227
2219
|
}), r.append(o), r;
|
|
2228
2220
|
}, Ls = (e, t, n) => {
|
|
2229
|
-
const r =
|
|
2230
|
-
let
|
|
2231
|
-
const
|
|
2232
|
-
const
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
const
|
|
2239
|
-
|
|
2221
|
+
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;
|
|
2222
|
+
let w = { h: 0, s: 0, v: 1 }, C = null;
|
|
2223
|
+
const T = (m) => {
|
|
2224
|
+
const f = Oe(m);
|
|
2225
|
+
return !!(f && i.some((E) => Oe(E.value) === f));
|
|
2226
|
+
}, b = (m, f = !0) => {
|
|
2227
|
+
const E = Oe(m);
|
|
2228
|
+
if (!E) return;
|
|
2229
|
+
t[e.name] = E, d.style.background = E, w = ks(Ln(E) ?? { r: 255, g: 255, b: 255 });
|
|
2230
|
+
const k = xs(w);
|
|
2231
|
+
a.dataset.active = f ? "true" : "false", d.dataset.empty = "false", f && (s.style.left = `${k.x}%`, s.style.top = `${k.y}%`);
|
|
2232
|
+
}, y = () => {
|
|
2233
|
+
const m = t[e.name];
|
|
2234
|
+
m && n({
|
|
2240
2235
|
...t,
|
|
2241
|
-
[e.name]:
|
|
2236
|
+
[e.name]: m
|
|
2242
2237
|
});
|
|
2243
2238
|
};
|
|
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
|
-
|
|
2239
|
+
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) => {
|
|
2240
|
+
const f = document.createElement("button"), E = m.value;
|
|
2241
|
+
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) => {
|
|
2242
|
+
k.preventDefault();
|
|
2243
|
+
}), f.addEventListener("click", () => {
|
|
2244
|
+
b(E, !1), y();
|
|
2245
|
+
}), l.append(f);
|
|
2246
|
+
}), a.addEventListener("pointerdown", (m) => {
|
|
2247
|
+
C = m.pointerId, a.setPointerCapture(m.pointerId), w = Ot(m, a), b(Ge(Dt(w))), m.preventDefault();
|
|
2248
|
+
}), a.addEventListener("pointermove", (m) => {
|
|
2249
|
+
C === m.pointerId && (w = Ot(m, a), b(Ge(Dt(w))));
|
|
2250
|
+
}), a.addEventListener("pointerup", (m) => {
|
|
2251
|
+
C === m.pointerId && (C = null, a.releasePointerCapture(m.pointerId), y());
|
|
2252
|
+
}), a.addEventListener("pointercancel", (m) => {
|
|
2253
|
+
C === m.pointerId && (C = null, a.releasePointerCapture(m.pointerId));
|
|
2259
2254
|
});
|
|
2260
|
-
const
|
|
2261
|
-
return
|
|
2255
|
+
const M = t[e.name];
|
|
2256
|
+
return M && b(M, !(h && T(M))), o.append(a, l), r.append(o, d), r;
|
|
2262
2257
|
}, Ss = (e, t, n) => {
|
|
2263
2258
|
const r = document.createElement("label"), o = document.createElement("input");
|
|
2264
2259
|
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 +2275,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2280
2275
|
}) => 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
2276
|
var t, n, r;
|
|
2282
2277
|
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)),
|
|
2278
|
+
}, 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
2279
|
const t = e.querySelector(
|
|
2285
2280
|
".bridgerte__payload-panel-text-input"
|
|
2286
2281
|
);
|
|
@@ -2291,7 +2286,7 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2291
2286
|
const r = document.createElement("div"), o = document.createElement("span"), a = (n == null ? void 0 : n(e)) ?? null;
|
|
2292
2287
|
if (r.className = "bridgerte__payload-panel-title", o.textContent = e.panel.title, r.append(o), a) {
|
|
2293
2288
|
const s = document.createElement("button");
|
|
2294
|
-
s.type = "button", s.className = "bridgerte__payload-panel-clear", s.textContent = "清除", s.setAttribute("aria-label", `清除${e.panel.title}`),
|
|
2289
|
+
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
2290
|
l.preventDefault();
|
|
2296
2291
|
}), s.addEventListener("click", () => {
|
|
2297
2292
|
t(a);
|
|
@@ -2304,14 +2299,14 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2304
2299
|
* 输入型面板保留默认宽度;table-insert 会按 schema 网格列数单独计算。
|
|
2305
2300
|
*/
|
|
2306
2301
|
e === "font-size" || e === "font-family" || e === "line-height" ? "180px" : "220px"
|
|
2307
|
-
), Os = 3, Hs = 3, $s = 10,
|
|
2302
|
+
), Os = 3, Hs = 3, $s = 10, Pn = 10, Fs = 16, zs = 2, Vs = 24, Ws = () => {
|
|
2308
2303
|
var e;
|
|
2309
2304
|
return typeof window < "u" && ((e = window.matchMedia) == null ? void 0 : e.call(window, "(hover: hover) and (pointer: fine)").matches) === !0;
|
|
2310
2305
|
}, ce = (e, t) => {
|
|
2311
2306
|
const n = Number.parseInt(e ?? "", 10);
|
|
2312
2307
|
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((
|
|
2308
|
+
}, 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) => {
|
|
2309
|
+
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
2310
|
min: a,
|
|
2316
2311
|
max: l,
|
|
2317
2312
|
defaultValue: d
|
|
@@ -2321,52 +2316,52 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2321
2316
|
max: l,
|
|
2322
2317
|
defaultValue: i
|
|
2323
2318
|
};
|
|
2324
|
-
},
|
|
2325
|
-
rows:
|
|
2319
|
+
}, In = (e) => ({
|
|
2320
|
+
rows: Ft(
|
|
2326
2321
|
e,
|
|
2327
2322
|
"rows",
|
|
2328
|
-
|
|
2323
|
+
en,
|
|
2329
2324
|
Os
|
|
2330
2325
|
),
|
|
2331
|
-
cols:
|
|
2326
|
+
cols: Ft(
|
|
2332
2327
|
e,
|
|
2333
2328
|
"cols",
|
|
2334
|
-
|
|
2329
|
+
tn,
|
|
2335
2330
|
Hs
|
|
2336
2331
|
)
|
|
2337
2332
|
}), js = (e) => {
|
|
2338
|
-
const t = Math.min(e.cols.max,
|
|
2339
|
-
return `${t * Fs + Math.max(t - 1, 0) * zs +
|
|
2333
|
+
const t = Math.min(e.cols.max, Pn);
|
|
2334
|
+
return `${t * Fs + Math.max(t - 1, 0) * zs + Vs}px`;
|
|
2340
2335
|
}, qs = ({
|
|
2341
2336
|
fields: e,
|
|
2342
2337
|
values: t,
|
|
2343
2338
|
onSubmit: n
|
|
2344
2339
|
}) => {
|
|
2345
|
-
const r =
|
|
2340
|
+
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
2341
|
...r.rows,
|
|
2347
2342
|
max: i,
|
|
2348
2343
|
defaultValue: Math.min(r.rows.defaultValue, i)
|
|
2349
2344
|
}, C = {
|
|
2350
2345
|
...r.cols,
|
|
2351
|
-
max:
|
|
2352
|
-
defaultValue: Math.min(r.cols.defaultValue,
|
|
2346
|
+
max: h,
|
|
2347
|
+
defaultValue: Math.min(r.cols.defaultValue, h)
|
|
2353
2348
|
};
|
|
2354
|
-
let
|
|
2349
|
+
let T = ce(
|
|
2355
2350
|
t.rows,
|
|
2356
2351
|
w
|
|
2357
|
-
),
|
|
2352
|
+
), b = ce(
|
|
2358
2353
|
t.cols,
|
|
2359
2354
|
C
|
|
2360
|
-
),
|
|
2355
|
+
), y = null;
|
|
2361
2356
|
const M = (L, _) => {
|
|
2362
|
-
|
|
2363
|
-
const c = Number.parseInt(u.dataset.rows ?? "0", 10),
|
|
2364
|
-
u.dataset.active = String(c <= L &&
|
|
2357
|
+
T = L, b = _, t.rows = String(L), t.cols = String(_), s.textContent = `${L} x ${_}`, l.forEach((u) => {
|
|
2358
|
+
const c = Number.parseInt(u.dataset.rows ?? "0", 10), p = Number.parseInt(u.dataset.cols ?? "0", 10);
|
|
2359
|
+
u.dataset.active = String(c <= L && p <= _);
|
|
2365
2360
|
});
|
|
2366
|
-
},
|
|
2361
|
+
}, m = (L) => {
|
|
2367
2362
|
var _;
|
|
2368
2363
|
return ((_ = document.elementFromPoint(L.clientX, L.clientY)) == null ? void 0 : _.closest(".bridgerte__payload-panel-table-cell")) ?? null;
|
|
2369
|
-
},
|
|
2364
|
+
}, f = (L) => {
|
|
2370
2365
|
if (!L) return;
|
|
2371
2366
|
const _ = ce(
|
|
2372
2367
|
L.dataset.rows,
|
|
@@ -2376,52 +2371,52 @@ const Qa = () => (It += 1, `${Ya}-${It}`), Za = (e, t, n) => {
|
|
|
2376
2371
|
C
|
|
2377
2372
|
);
|
|
2378
2373
|
M(_, u);
|
|
2379
|
-
},
|
|
2374
|
+
}, E = () => {
|
|
2380
2375
|
n({
|
|
2381
2376
|
...t,
|
|
2382
|
-
rows: String(
|
|
2383
|
-
cols: String(
|
|
2377
|
+
rows: String(T),
|
|
2378
|
+
cols: String(b)
|
|
2384
2379
|
});
|
|
2385
|
-
},
|
|
2386
|
-
|
|
2380
|
+
}, k = () => {
|
|
2381
|
+
y = null;
|
|
2387
2382
|
}, I = () => {
|
|
2388
|
-
window.setTimeout(
|
|
2383
|
+
window.setTimeout(k, 0);
|
|
2389
2384
|
}, R = (L, _) => {
|
|
2390
|
-
if (L.detail > 0 &&
|
|
2385
|
+
if (L.detail > 0 && y !== _) {
|
|
2391
2386
|
L.preventDefault(), L.stopPropagation();
|
|
2392
2387
|
return;
|
|
2393
2388
|
}
|
|
2394
|
-
|
|
2389
|
+
k(), f(_), E();
|
|
2395
2390
|
};
|
|
2396
2391
|
for (let L = 1; L <= i; L += 1)
|
|
2397
|
-
for (let _ = 1; _ <=
|
|
2392
|
+
for (let _ = 1; _ <= h; _ += 1) {
|
|
2398
2393
|
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",
|
|
2394
|
+
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) => {
|
|
2395
|
+
y = u, f(u), c.preventDefault();
|
|
2396
|
+
}), u.addEventListener("pointerup", I), u.addEventListener("pointercancel", k), u.addEventListener("click", (c) => {
|
|
2402
2397
|
R(c, u);
|
|
2403
2398
|
}), d && u.addEventListener("pointerenter", () => {
|
|
2404
|
-
|
|
2399
|
+
f(u);
|
|
2405
2400
|
}), l.push(u), a.append(u);
|
|
2406
2401
|
}
|
|
2407
2402
|
return o.className = "bridgerte__payload-panel-field", a.className = "bridgerte__payload-panel-table-grid", a.setAttribute("aria-label", "选择表格行列"), a.style.setProperty(
|
|
2408
2403
|
"--bridgerte-payload-panel-table-cols",
|
|
2409
|
-
String(
|
|
2404
|
+
String(h)
|
|
2410
2405
|
), s.className = "bridgerte__payload-panel-table-status", s.setAttribute("aria-live", "polite"), a.addEventListener("pointermove", (L) => {
|
|
2411
|
-
d ||
|
|
2412
|
-
}), M(
|
|
2406
|
+
d || f(m(L));
|
|
2407
|
+
}), M(T, b), o.append(a, s), o;
|
|
2413
2408
|
}, Ks = "bridgerte-payload-panel";
|
|
2414
|
-
let
|
|
2415
|
-
const Gs = () => (
|
|
2409
|
+
let zt = 0;
|
|
2410
|
+
const Gs = () => (zt += 1, `${Ks}-${zt}`), Ce = (e) => e.panel.id === "table-insert", Xs = (e, t) => {
|
|
2416
2411
|
const n = document.createElement("button");
|
|
2417
|
-
return n.type = "button", n.className = "bridgerte__payload-panel-submit", n.textContent = "应用",
|
|
2412
|
+
return n.type = "button", n.className = "bridgerte__payload-panel-submit", n.textContent = "应用", W(n), n.addEventListener("pointerdown", (r) => {
|
|
2418
2413
|
r.preventDefault();
|
|
2419
2414
|
}), n.addEventListener("click", () => {
|
|
2420
2415
|
t(e);
|
|
2421
2416
|
}), n;
|
|
2422
2417
|
}, Js = (e) => {
|
|
2423
2418
|
let t = null, n = {};
|
|
2424
|
-
const r =
|
|
2419
|
+
const r = En({
|
|
2425
2420
|
root: e.editorRoot,
|
|
2426
2421
|
className: "bridgerte__payload-panel",
|
|
2427
2422
|
onBackdropClick: () => {
|
|
@@ -2434,19 +2429,19 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2434
2429
|
const a = (i) => {
|
|
2435
2430
|
var w;
|
|
2436
2431
|
if (!t || t.readonly || e.isReadonly()) return;
|
|
2437
|
-
const
|
|
2438
|
-
|
|
2439
|
-
o(), e.isReadonly() || e.executeCommand(
|
|
2432
|
+
const h = Cs(t.command, i);
|
|
2433
|
+
h && ((w = e.restoreEditorFocus) == null || w.call(e, () => {
|
|
2434
|
+
o(), e.isReadonly() || e.executeCommand(h);
|
|
2440
2435
|
}));
|
|
2441
2436
|
}, s = (i) => {
|
|
2442
|
-
var
|
|
2443
|
-
!t || t.readonly || e.isReadonly() || (
|
|
2437
|
+
var h;
|
|
2438
|
+
!t || t.readonly || e.isReadonly() || (h = e.restoreEditorFocus) == null || h.call(e, () => {
|
|
2444
2439
|
o(), e.isReadonly() || e.executeCommand(i);
|
|
2445
2440
|
});
|
|
2446
2441
|
}, l = (i) => {
|
|
2447
2442
|
n = i.panel.fields.reduce((w, C) => (w[C.name] = Rs(C, i.currentValues), w), {});
|
|
2448
|
-
const
|
|
2449
|
-
r.element.style.width = `min(${
|
|
2443
|
+
const h = Ce(i) ? js(In(i.panel.fields)) : Ds(i.panel.id);
|
|
2444
|
+
r.element.style.width = `min(${h}, calc(100vw - 24px))`, r.content.append(Bs(i, s, e.getClearCommand)), Ce(i) ? r.content.append(qs({
|
|
2450
2445
|
fields: i.panel.fields,
|
|
2451
2446
|
values: n,
|
|
2452
2447
|
onSubmit: a
|
|
@@ -2456,21 +2451,21 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2456
2451
|
values: n,
|
|
2457
2452
|
onSubmit: a
|
|
2458
2453
|
}));
|
|
2459
|
-
}), !Ce(i) &&
|
|
2454
|
+
}), !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
2455
|
};
|
|
2461
2456
|
return {
|
|
2462
2457
|
open: (i) => {
|
|
2463
2458
|
var C;
|
|
2464
2459
|
o();
|
|
2465
|
-
const
|
|
2460
|
+
const h = {
|
|
2466
2461
|
...i,
|
|
2467
2462
|
id: Gs(),
|
|
2468
2463
|
readonly: e.isReadonly(),
|
|
2469
2464
|
submit: a,
|
|
2470
2465
|
cancel: o
|
|
2471
2466
|
};
|
|
2472
|
-
if (t =
|
|
2473
|
-
if (
|
|
2467
|
+
if (t = h, ((C = e.onRequest) == null ? void 0 : C.call(e, h)) !== !0) {
|
|
2468
|
+
if (h.readonly) {
|
|
2474
2469
|
o();
|
|
2475
2470
|
return;
|
|
2476
2471
|
}
|
|
@@ -2490,109 +2485,109 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2490
2485
|
"table-delete"
|
|
2491
2486
|
], Qs = () => {
|
|
2492
2487
|
const e = new Map(Ne.map((t) => [t.id, t]));
|
|
2493
|
-
return Ys.map((t) =>
|
|
2494
|
-
},
|
|
2488
|
+
return Ys.map((t) => io.find((n) => n.id === t) ?? e.get(t)).filter((t) => t !== void 0);
|
|
2489
|
+
}, Rn = Qs(), Zs = new Map(
|
|
2495
2490
|
/*
|
|
2496
2491
|
* Controls 按钮用 MenuItem.id 查完整 command,同类命令的不同 payload 不能用 command.type 合并。
|
|
2497
2492
|
* 后续加入插入前/后、合并/拆分等表格菜单时,只要 id 稳定,就不会互相覆盖。
|
|
2498
2493
|
*/
|
|
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,
|
|
2494
|
+
Rn.map((e) => [e.id, e])
|
|
2495
|
+
), 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
2496
|
const t = e.getFirstChild();
|
|
2502
2497
|
if (!Wr(t)) return null;
|
|
2503
2498
|
const n = t.getFirstChild();
|
|
2504
|
-
return
|
|
2499
|
+
return Ur(n) ? n : null;
|
|
2505
2500
|
}, oi = (e) => {
|
|
2506
2501
|
const t = document.createElement("button");
|
|
2507
2502
|
return t.type = "button", t.className = de, t.textContent = e.label, t.dataset.menuItemId = e.id, t.setAttribute("aria-label", e.label), t;
|
|
2508
2503
|
}, ai = () => {
|
|
2509
2504
|
const e = document.createElement("div");
|
|
2510
|
-
return e.className = "bridgerte__table-controls", e.contentEditable = "false", e.setAttribute("aria-label", "表格操作"),
|
|
2505
|
+
return e.className = "bridgerte__table-controls", e.contentEditable = "false", e.setAttribute("aria-label", "表格操作"), Rn.forEach((t) => {
|
|
2511
2506
|
e.append(oi(t));
|
|
2512
2507
|
}), e;
|
|
2513
2508
|
}, si = (e) => {
|
|
2514
2509
|
const t = document.createElement("div"), n = ni(e.root), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
2515
2510
|
let s = null, l = null, d = !1, i = null;
|
|
2516
|
-
const
|
|
2517
|
-
const S = e.root.getBoundingClientRect(), N =
|
|
2511
|
+
const h = (g, v) => {
|
|
2512
|
+
const S = e.root.getBoundingClientRect(), N = v.getBoundingClientRect(), O = N.bottom < S.top || N.top > S.bottom, H = Math.max(
|
|
2518
2513
|
8,
|
|
2519
2514
|
S.width - g.offsetWidth - 8
|
|
2520
2515
|
), P = Math.min(
|
|
2521
2516
|
Math.max(N.left - S.left + 8, 8),
|
|
2522
2517
|
H
|
|
2523
|
-
),
|
|
2524
|
-
g.hidden = O, g.style.transform = `translate(${P}px, ${
|
|
2518
|
+
), x = Math.max(8, N.top - S.top - g.offsetHeight - 8);
|
|
2519
|
+
g.hidden = O, g.style.transform = `translate(${P}px, ${x}px)`;
|
|
2525
2520
|
}, w = (g) => i === g, C = (g) => {
|
|
2526
|
-
const
|
|
2527
|
-
if (!
|
|
2528
|
-
|
|
2521
|
+
const v = e.editor.getElementByKey(g);
|
|
2522
|
+
if (!v) {
|
|
2523
|
+
T(g);
|
|
2529
2524
|
return;
|
|
2530
2525
|
}
|
|
2531
|
-
|
|
2532
|
-
const S = ei(
|
|
2526
|
+
v.dataset.lexicalKey = g;
|
|
2527
|
+
const S = ei(v), N = ti(v, S);
|
|
2533
2528
|
a.set(N, g);
|
|
2534
2529
|
const O = r.get(g);
|
|
2535
2530
|
if (!w(g)) {
|
|
2536
|
-
|
|
2531
|
+
T(g);
|
|
2537
2532
|
return;
|
|
2538
2533
|
}
|
|
2539
2534
|
if (O) {
|
|
2540
|
-
|
|
2535
|
+
h(O, N);
|
|
2541
2536
|
return;
|
|
2542
2537
|
}
|
|
2543
|
-
const H = ai(), P =
|
|
2538
|
+
const H = ai(), P = W(H, {
|
|
2544
2539
|
targetSelector: `.${de}`
|
|
2545
2540
|
});
|
|
2546
|
-
H.dataset.lexicalKey = g, r.set(g, H), o.set(H, P), t.append(H),
|
|
2547
|
-
},
|
|
2541
|
+
H.dataset.lexicalKey = g, r.set(g, H), o.set(H, P), t.append(H), h(H, N);
|
|
2542
|
+
}, T = (g) => {
|
|
2548
2543
|
var S;
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2551
|
-
},
|
|
2552
|
-
s = null, a.forEach((g,
|
|
2553
|
-
e.root.contains(
|
|
2544
|
+
const v = r.get(g);
|
|
2545
|
+
v && ((S = o.get(v)) == null || S(), o.delete(v), v.remove(), r.delete(g), i === g && (i = null));
|
|
2546
|
+
}, b = () => {
|
|
2547
|
+
s = null, a.forEach((g, v) => {
|
|
2548
|
+
e.root.contains(v) || (a.delete(v), T(g));
|
|
2554
2549
|
}), e.root.querySelectorAll(".bridgerte__table-wrapper").forEach((g) => {
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2557
|
-
}), r.forEach((g,
|
|
2558
|
-
C(
|
|
2550
|
+
const v = g.dataset.lexicalKey;
|
|
2551
|
+
v && (a.set(g, v), C(v));
|
|
2552
|
+
}), r.forEach((g, v) => {
|
|
2553
|
+
C(v);
|
|
2559
2554
|
}), i !== null && C(i);
|
|
2560
|
-
},
|
|
2561
|
-
s === null && (s = Te(
|
|
2555
|
+
}, y = () => {
|
|
2556
|
+
s === null && (s = Te(b));
|
|
2562
2557
|
}, M = (g) => {
|
|
2563
2558
|
e.editor.update(() => {
|
|
2564
2559
|
var S;
|
|
2565
|
-
const
|
|
2566
|
-
|
|
2560
|
+
const v = me(g);
|
|
2561
|
+
v instanceof We && ((S = ri(v)) == null || S.selectStart());
|
|
2567
2562
|
}), e.editor.focus();
|
|
2568
|
-
},
|
|
2569
|
-
M(g), e.executeCommand(
|
|
2570
|
-
},
|
|
2571
|
-
const S =
|
|
2572
|
-
!S || !O ||
|
|
2573
|
-
},
|
|
2563
|
+
}, m = (g, v) => {
|
|
2564
|
+
M(g), e.executeCommand(v);
|
|
2565
|
+
}, f = (g, v) => {
|
|
2566
|
+
const S = v.dataset.lexicalKey, N = g.dataset.menuItemId, O = N ? Zs.get(N) : void 0;
|
|
2567
|
+
!S || !O || m(S, O.command);
|
|
2568
|
+
}, E = (g) => {
|
|
2574
2569
|
if (!g) {
|
|
2575
2570
|
const N = i;
|
|
2576
2571
|
i = null, N !== null && C(N);
|
|
2577
2572
|
return;
|
|
2578
2573
|
}
|
|
2579
|
-
const
|
|
2580
|
-
if (!
|
|
2574
|
+
const v = g.dataset.lexicalKey ? g.dataset.lexicalKey : a.get(g) ?? null;
|
|
2575
|
+
if (!v || i === v) return;
|
|
2581
2576
|
const S = i;
|
|
2582
|
-
i =
|
|
2583
|
-
},
|
|
2584
|
-
|
|
2577
|
+
i = v, S !== null && C(S), C(v);
|
|
2578
|
+
}, k = (g) => {
|
|
2579
|
+
E(Vt(g.target));
|
|
2585
2580
|
}, I = (g) => {
|
|
2586
|
-
|
|
2581
|
+
E(Vt(g.target));
|
|
2587
2582
|
}, R = (g) => {
|
|
2588
|
-
const
|
|
2589
|
-
if (!(
|
|
2590
|
-
const S =
|
|
2583
|
+
const v = g.target;
|
|
2584
|
+
if (!(v instanceof HTMLElement)) return;
|
|
2585
|
+
const S = v.closest(`.${de}`);
|
|
2591
2586
|
S && (g.preventDefault(), l = g.pointerType === "mouse" ? null : S);
|
|
2592
2587
|
}, L = (g) => {
|
|
2593
2588
|
if (g.pointerType === "mouse" || !l) return;
|
|
2594
|
-
const
|
|
2595
|
-
N === l && S && (g.preventDefault(), g.stopPropagation(),
|
|
2589
|
+
const v = g.target, S = v instanceof HTMLElement ? v.closest(".bridgerte__table-controls") : null, N = v instanceof HTMLElement ? v.closest(`.${de}`) : null;
|
|
2590
|
+
N === l && S && (g.preventDefault(), g.stopPropagation(), f(N, S), d = !0), l = null;
|
|
2596
2591
|
}, _ = () => {
|
|
2597
2592
|
l = null;
|
|
2598
2593
|
}, u = (g) => {
|
|
@@ -2600,27 +2595,27 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2600
2595
|
d = !1, g.preventDefault(), g.stopPropagation();
|
|
2601
2596
|
return;
|
|
2602
2597
|
}
|
|
2603
|
-
const
|
|
2604
|
-
if (!(
|
|
2605
|
-
const S =
|
|
2606
|
-
!S || !N || (g.preventDefault(), g.stopPropagation(),
|
|
2598
|
+
const v = g.target;
|
|
2599
|
+
if (!(v instanceof HTMLElement)) return;
|
|
2600
|
+
const S = v.closest(`.${de}`), N = v.closest(".bridgerte__table-controls");
|
|
2601
|
+
!S || !N || (g.preventDefault(), g.stopPropagation(), f(S, N));
|
|
2607
2602
|
}, c = e.editor.registerMutationListener(
|
|
2608
2603
|
We,
|
|
2609
2604
|
(g) => {
|
|
2610
|
-
g.forEach((
|
|
2611
|
-
if (
|
|
2612
|
-
|
|
2605
|
+
g.forEach((v, S) => {
|
|
2606
|
+
if (v === "destroyed") {
|
|
2607
|
+
T(S);
|
|
2613
2608
|
return;
|
|
2614
2609
|
}
|
|
2615
2610
|
C(S);
|
|
2616
2611
|
});
|
|
2617
2612
|
}
|
|
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",
|
|
2613
|
+
), p = e.editor.registerUpdateListener(y);
|
|
2614
|
+
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
2615
|
destroy() {
|
|
2621
|
-
c(),
|
|
2622
|
-
var
|
|
2623
|
-
(
|
|
2616
|
+
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) => {
|
|
2617
|
+
var v;
|
|
2618
|
+
(v = o.get(g)) == null || v(), g.remove();
|
|
2624
2619
|
}), r.clear(), o.clear(), a.clear(), t.remove();
|
|
2625
2620
|
}
|
|
2626
2621
|
};
|
|
@@ -2632,7 +2627,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2632
2627
|
executeCommand: e.executeCommand,
|
|
2633
2628
|
getClearCommand: e.getClearCommand,
|
|
2634
2629
|
onRequest: e.onRequest
|
|
2635
|
-
}), n =
|
|
2630
|
+
}), n = ns({
|
|
2636
2631
|
editor: e.lexicalEditor,
|
|
2637
2632
|
root: e.editorRoot,
|
|
2638
2633
|
isReadonly: e.isReadonly,
|
|
@@ -2643,7 +2638,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2643
2638
|
editor: e.lexicalEditor,
|
|
2644
2639
|
root: e.editorRoot,
|
|
2645
2640
|
executeCommand: e.executeCommand
|
|
2646
|
-
}), o =
|
|
2641
|
+
}), o = vs({
|
|
2647
2642
|
editor: e.lexicalEditor,
|
|
2648
2643
|
root: e.editorRoot,
|
|
2649
2644
|
defaultWidthPercent: e.defaultMediaWidthPercent,
|
|
@@ -2680,7 +2675,7 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2680
2675
|
},
|
|
2681
2676
|
restore() {
|
|
2682
2677
|
t && e.update(() => {
|
|
2683
|
-
|
|
2678
|
+
ar((t == null ? void 0 : t.clone()) ?? null);
|
|
2684
2679
|
});
|
|
2685
2680
|
},
|
|
2686
2681
|
clear() {
|
|
@@ -2691,12 +2686,12 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2691
2686
|
changeHandlers: [],
|
|
2692
2687
|
excludeParents: [],
|
|
2693
2688
|
matchers: [
|
|
2694
|
-
|
|
2695
|
-
|
|
2689
|
+
mt(di, (e) => e.startsWith("http://") || e.startsWith("https://") ? e : `https://${e}`),
|
|
2690
|
+
mt(ui, (e) => `mailto:${e}`)
|
|
2696
2691
|
]
|
|
2697
2692
|
}, gi = ({
|
|
2698
2693
|
editor: e
|
|
2699
|
-
}) =>
|
|
2694
|
+
}) => Yr(e, mi), hi = [
|
|
2700
2695
|
".bridgerte__code-header",
|
|
2701
2696
|
".bridgerte__code-block-control",
|
|
2702
2697
|
".bridgerte__code-block-controls-layer",
|
|
@@ -2754,32 +2749,32 @@ const Gs = () => (Ft += 1, `${Ks}-${Ft}`), Ce = (e) => e.panel.id === "table-ins
|
|
|
2754
2749
|
height: (e == null ? void 0 : e.height) ?? window.innerHeight
|
|
2755
2750
|
};
|
|
2756
2751
|
}, Wt = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n));
|
|
2757
|
-
function
|
|
2752
|
+
function An(e, t, n = {}) {
|
|
2758
2753
|
const r = n.placement ?? "bottom-start", o = n.offset ?? 8, a = n.shiftPadding ?? 8, s = n.strategy ?? "absolute";
|
|
2759
2754
|
let l = null, d = !1;
|
|
2760
2755
|
const i = () => {
|
|
2761
2756
|
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(
|
|
2757
|
+
}, h = (b, y) => {
|
|
2758
|
+
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;
|
|
2759
|
+
t.style.left = `${Wt(b, f, k)}px`, t.style.top = `${Wt(y, E, I)}px`, t.style.opacity = "", t.style.pointerEvents = "";
|
|
2765
2760
|
}, w = async () => {
|
|
2766
|
-
const
|
|
2761
|
+
const b = await po(e, t, {
|
|
2767
2762
|
placement: r,
|
|
2768
2763
|
strategy: s,
|
|
2769
|
-
platform:
|
|
2764
|
+
platform: fo,
|
|
2770
2765
|
middleware: [
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2766
|
+
bo(o),
|
|
2767
|
+
yo(),
|
|
2768
|
+
vo({ padding: a })
|
|
2774
2769
|
]
|
|
2775
2770
|
});
|
|
2776
|
-
|
|
2771
|
+
h(b.x, b.y);
|
|
2777
2772
|
}, C = () => {
|
|
2778
2773
|
l == null || l(), l = null;
|
|
2779
|
-
},
|
|
2780
|
-
if (d !==
|
|
2781
|
-
if (d =
|
|
2782
|
-
i(), t.hidden = !1, l =
|
|
2774
|
+
}, T = (b) => {
|
|
2775
|
+
if (d !== b) {
|
|
2776
|
+
if (d = b, C(), d) {
|
|
2777
|
+
i(), t.hidden = !1, l = ho(e, t, w), w();
|
|
2783
2778
|
return;
|
|
2784
2779
|
}
|
|
2785
2780
|
t.hidden = !0, t.style.opacity = "", t.style.pointerEvents = "";
|
|
@@ -2787,13 +2782,13 @@ function Rn(e, t, n = {}) {
|
|
|
2787
2782
|
};
|
|
2788
2783
|
return i(), t.hidden = !0, {
|
|
2789
2784
|
update: w,
|
|
2790
|
-
setOpen:
|
|
2785
|
+
setOpen: T,
|
|
2791
2786
|
destroy() {
|
|
2792
2787
|
C(), t.hidden = !0;
|
|
2793
2788
|
}
|
|
2794
2789
|
};
|
|
2795
2790
|
}
|
|
2796
|
-
const
|
|
2791
|
+
const Bn = {
|
|
2797
2792
|
// 居中对齐菜单使用,和 align 命令的 center value 对应。
|
|
2798
2793
|
"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
2794
|
// 两端对齐菜单使用,保留段落排版语义,不和普通居中/左右对齐混用。
|
|
@@ -2889,13 +2884,13 @@ const An = {
|
|
|
2889
2884
|
}, wi = (e) => {
|
|
2890
2885
|
const t = document.createElement("span");
|
|
2891
2886
|
return t.className = "bridgerte__menu-icon-text", t.textContent = e, t;
|
|
2892
|
-
},
|
|
2887
|
+
}, Dn = (e, t, n) => {
|
|
2893
2888
|
if (t) {
|
|
2894
2889
|
e.innerHTML = t;
|
|
2895
2890
|
return;
|
|
2896
2891
|
}
|
|
2897
2892
|
e.append(wi(n));
|
|
2898
|
-
},
|
|
2893
|
+
}, Xe = () => {
|
|
2899
2894
|
const e = window.getSelection(), t = e != null && e.rangeCount ? e.getRangeAt(0) : null, n = t == null ? void 0 : t.getBoundingClientRect();
|
|
2900
2895
|
return !n || n.width === 0 && n.height === 0 ? null : n;
|
|
2901
2896
|
}, Ci = 160, _i = {
|
|
@@ -2916,12 +2911,12 @@ const An = {
|
|
|
2916
2911
|
}, ki = () => {
|
|
2917
2912
|
const e = A();
|
|
2918
2913
|
return D(e) && !e.isCollapsed();
|
|
2919
|
-
},
|
|
2914
|
+
}, 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
2915
|
const t = document.createElement("span");
|
|
2921
2916
|
return t.className = "bridgerte__hoverbar-separator", t.dataset.separatorId = e.key, t.setAttribute("aria-hidden", "true"), t;
|
|
2922
2917
|
}, 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)),
|
|
2918
|
+
const r = os(e, t), o = document.createElement("button");
|
|
2919
|
+
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
2920
|
}, Ti = ({
|
|
2926
2921
|
editorRoot: e,
|
|
2927
2922
|
contentElement: t,
|
|
@@ -2933,32 +2928,32 @@ const An = {
|
|
|
2933
2928
|
menuSchema: l,
|
|
2934
2929
|
hoverbarConfig: d,
|
|
2935
2930
|
menuLabels: i,
|
|
2936
|
-
payloadPanelConfig:
|
|
2931
|
+
payloadPanelConfig: h,
|
|
2937
2932
|
icons: w = {}
|
|
2938
2933
|
}) => {
|
|
2939
|
-
const C =
|
|
2934
|
+
const C = ot(l ?? Ne, {
|
|
2940
2935
|
menuLabels: i,
|
|
2941
|
-
payloadPanelConfig:
|
|
2942
|
-
}),
|
|
2943
|
-
let
|
|
2944
|
-
const
|
|
2936
|
+
payloadPanelConfig: h
|
|
2937
|
+
}), T = Ze(d ?? _i, C), b = xi(T), y = document.createElement("span"), M = document.createElement("div");
|
|
2938
|
+
let m = null, f = !1, E = null;
|
|
2939
|
+
const k = W(M, {
|
|
2945
2940
|
targetSelector: ".bridgerte__hoverbar-button"
|
|
2946
2941
|
});
|
|
2947
|
-
|
|
2942
|
+
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
2943
|
placement: "top",
|
|
2949
2944
|
offset: 8,
|
|
2950
2945
|
strategy: "fixed"
|
|
2951
2946
|
});
|
|
2952
2947
|
const I = () => {
|
|
2953
|
-
|
|
2948
|
+
E && (window.clearTimeout(E), E = null);
|
|
2954
2949
|
}, R = () => {
|
|
2955
|
-
I(),
|
|
2950
|
+
I(), f = !1, M.replaceChildren(), M.dataset.visible = "false", m == null || m.setOpen(!1);
|
|
2956
2951
|
}, L = () => {
|
|
2957
|
-
const P =
|
|
2958
|
-
|
|
2952
|
+
const P = Xe(), x = t.getBoundingClientRect();
|
|
2953
|
+
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
2954
|
}, _ = () => {
|
|
2960
2955
|
const P = s();
|
|
2961
|
-
M.replaceChildren(...
|
|
2956
|
+
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
2957
|
}, u = () => r() ? !1 : n.getEditorState().read(ki), c = (P = !1) => {
|
|
2963
2958
|
if (I(), !u()) {
|
|
2964
2959
|
R();
|
|
@@ -2968,19 +2963,19 @@ const An = {
|
|
|
2968
2963
|
_();
|
|
2969
2964
|
return;
|
|
2970
2965
|
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2966
|
+
f && R(), E = window.setTimeout(() => {
|
|
2967
|
+
E = null, u() && _();
|
|
2973
2968
|
}, Ci);
|
|
2974
|
-
},
|
|
2975
|
-
const
|
|
2976
|
-
if (!(!
|
|
2977
|
-
if (
|
|
2969
|
+
}, p = (P) => {
|
|
2970
|
+
const x = b.find((B) => B.id === P.dataset.hoverbarItemId);
|
|
2971
|
+
if (!(!x || P.disabled)) {
|
|
2972
|
+
if (x.payloadPanel) {
|
|
2978
2973
|
const B = P.getBoundingClientRect();
|
|
2979
2974
|
a({
|
|
2980
|
-
menuId:
|
|
2981
|
-
command:
|
|
2982
|
-
panel:
|
|
2983
|
-
currentValues:
|
|
2975
|
+
menuId: x.id,
|
|
2976
|
+
command: x.command,
|
|
2977
|
+
panel: x.payloadPanel,
|
|
2978
|
+
currentValues: rs(x, s()),
|
|
2984
2979
|
anchorRect: {
|
|
2985
2980
|
x: B.left,
|
|
2986
2981
|
y: B.top,
|
|
@@ -2990,28 +2985,28 @@ const An = {
|
|
|
2990
2985
|
}), c(!0);
|
|
2991
2986
|
return;
|
|
2992
2987
|
}
|
|
2993
|
-
o(
|
|
2988
|
+
o(x.command), c(!0);
|
|
2994
2989
|
}
|
|
2995
2990
|
}, g = (P) => {
|
|
2996
|
-
|
|
2997
|
-
},
|
|
2998
|
-
const
|
|
2999
|
-
|
|
2991
|
+
jt(P.target) && P.preventDefault();
|
|
2992
|
+
}, v = (P) => {
|
|
2993
|
+
const x = jt(P.target);
|
|
2994
|
+
x && (P.preventDefault(), p(x));
|
|
3000
2995
|
}, S = (P) => {
|
|
3001
|
-
!
|
|
2996
|
+
!f || Ut(P, M) || Ut(P, t) || R();
|
|
3002
2997
|
}, N = n.registerCommand(
|
|
3003
|
-
|
|
2998
|
+
rn,
|
|
3004
2999
|
() => (c(), !1),
|
|
3005
3000
|
U
|
|
3006
3001
|
), O = n.registerUpdateListener(() => {
|
|
3007
3002
|
c();
|
|
3008
3003
|
}), H = n.registerCommand(
|
|
3009
|
-
|
|
3010
|
-
(P) =>
|
|
3004
|
+
on,
|
|
3005
|
+
(P) => f ? (P == null || P.preventDefault(), R(), !0) : !1,
|
|
3011
3006
|
U
|
|
3012
3007
|
);
|
|
3013
|
-
return M.addEventListener("pointerdown", g), M.addEventListener("click",
|
|
3014
|
-
I(), N(), O(), H(), M.removeEventListener("pointerdown", g), M.removeEventListener("click",
|
|
3008
|
+
return M.addEventListener("pointerdown", g), M.addEventListener("click", v), document.addEventListener("pointerdown", S, !0), () => {
|
|
3009
|
+
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
3010
|
};
|
|
3016
3011
|
}, Li = (e) => e.metaKey || e.ctrlKey, Si = {
|
|
3017
3012
|
b: { type: "format.bold" },
|
|
@@ -3062,15 +3057,15 @@ const An = {
|
|
|
3062
3057
|
return;
|
|
3063
3058
|
}
|
|
3064
3059
|
r > a && (e.scrollTop = r - e.clientHeight);
|
|
3065
|
-
},
|
|
3060
|
+
}, st = (e, t) => {
|
|
3066
3061
|
var n;
|
|
3067
3062
|
if (e instanceof Text && t <= (((n = e.textContent) == null ? void 0 : n.length) ?? 0)) return e;
|
|
3068
3063
|
for (const r of Array.from((e == null ? void 0 : e.childNodes) ?? [])) {
|
|
3069
|
-
const o =
|
|
3064
|
+
const o = st(r, t);
|
|
3070
3065
|
if (o) return o;
|
|
3071
3066
|
}
|
|
3072
3067
|
return null;
|
|
3073
|
-
},
|
|
3068
|
+
}, On = ({
|
|
3074
3069
|
editorRoot: e,
|
|
3075
3070
|
contentElement: t,
|
|
3076
3071
|
editor: n,
|
|
@@ -3081,68 +3076,68 @@ const An = {
|
|
|
3081
3076
|
getCurrentTrigger: l,
|
|
3082
3077
|
getTriggerRect: d,
|
|
3083
3078
|
resolveItems: i,
|
|
3084
|
-
renderItem:
|
|
3079
|
+
renderItem: h,
|
|
3085
3080
|
renderStatus: w,
|
|
3086
3081
|
onStateChange: C,
|
|
3087
|
-
onSelect:
|
|
3082
|
+
onSelect: T
|
|
3088
3083
|
}) => {
|
|
3089
|
-
let
|
|
3090
|
-
const M =
|
|
3084
|
+
let b = null, y = 0;
|
|
3085
|
+
const M = W(o, {
|
|
3091
3086
|
targetSelector: s
|
|
3092
|
-
}),
|
|
3087
|
+
}), m = An(a, o, {
|
|
3093
3088
|
placement: "bottom-start",
|
|
3094
3089
|
offset: 2,
|
|
3095
3090
|
strategy: "fixed"
|
|
3096
3091
|
});
|
|
3097
3092
|
e.append(a, o);
|
|
3098
|
-
const
|
|
3099
|
-
const
|
|
3100
|
-
return
|
|
3101
|
-
},
|
|
3102
|
-
const
|
|
3103
|
-
a.style.left = `${
|
|
3104
|
-
},
|
|
3105
|
-
|
|
3093
|
+
const f = () => {
|
|
3094
|
+
const x = b ? d(b.trigger) ?? Xe() : Xe(), B = t.getBoundingClientRect();
|
|
3095
|
+
return x ?? B;
|
|
3096
|
+
}, E = () => {
|
|
3097
|
+
const x = f();
|
|
3098
|
+
a.style.left = `${x.left}px`, a.style.top = `${x.top}px`, a.style.height = `${x.height || 1}px`;
|
|
3099
|
+
}, k = (x = !0) => {
|
|
3100
|
+
b = null, o.dataset.visible = "false", x && o.replaceChildren(), m.setOpen(!1);
|
|
3106
3101
|
}, I = () => {
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3109
|
-
}, R = (
|
|
3110
|
-
!
|
|
3102
|
+
const x = o.querySelector(`${s}[data-active="true"]`);
|
|
3103
|
+
x && Ai(o, x);
|
|
3104
|
+
}, R = (x, B) => {
|
|
3105
|
+
!b || b.requestId !== B.requestId || (k(), T(x, B.trigger));
|
|
3111
3106
|
}, L = () => {
|
|
3112
|
-
if (!
|
|
3113
|
-
|
|
3107
|
+
if (!b) {
|
|
3108
|
+
k();
|
|
3114
3109
|
return;
|
|
3115
3110
|
}
|
|
3116
|
-
const
|
|
3117
|
-
if ((C == null ? void 0 : C(
|
|
3111
|
+
const x = b, B = f();
|
|
3112
|
+
if ((C == null ? void 0 : C(x, {
|
|
3118
3113
|
anchorRect: B,
|
|
3119
|
-
close:
|
|
3120
|
-
selectItem: (te) => R(te,
|
|
3114
|
+
close: k,
|
|
3115
|
+
selectItem: (te) => R(te, x)
|
|
3121
3116
|
})) === !0) {
|
|
3122
|
-
o.replaceChildren(), o.dataset.visible = "false",
|
|
3117
|
+
o.replaceChildren(), o.dataset.visible = "false", m.setOpen(!1);
|
|
3123
3118
|
return;
|
|
3124
3119
|
}
|
|
3125
|
-
if (
|
|
3120
|
+
if (x.status === "success")
|
|
3126
3121
|
o.replaceChildren(
|
|
3127
|
-
...
|
|
3122
|
+
...x.items.map((te, dt) => h(te, dt, dt === x.activeIndex))
|
|
3128
3123
|
);
|
|
3129
3124
|
else {
|
|
3130
3125
|
const te = w == null ? void 0 : w(
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3126
|
+
x.status,
|
|
3127
|
+
x.trigger.query,
|
|
3128
|
+
x.error
|
|
3134
3129
|
);
|
|
3135
3130
|
o.replaceChildren(...te ? [te] : []);
|
|
3136
3131
|
}
|
|
3137
3132
|
const G = o.children.length > 0;
|
|
3138
|
-
o.dataset.visible = String(G),
|
|
3139
|
-
}, _ = async (
|
|
3133
|
+
o.dataset.visible = String(G), E(), m.setOpen(G), I(), m.update();
|
|
3134
|
+
}, _ = async (x, B) => {
|
|
3140
3135
|
let F;
|
|
3141
3136
|
try {
|
|
3142
|
-
F = await Promise.resolve(i(
|
|
3137
|
+
F = await Promise.resolve(i(x));
|
|
3143
3138
|
} catch (G) {
|
|
3144
|
-
(
|
|
3145
|
-
...
|
|
3139
|
+
(b == null ? void 0 : b.requestId) === B && (b = {
|
|
3140
|
+
...b,
|
|
3146
3141
|
items: [],
|
|
3147
3142
|
activeIndex: 0,
|
|
3148
3143
|
status: "error",
|
|
@@ -3150,67 +3145,67 @@ const An = {
|
|
|
3150
3145
|
}, L());
|
|
3151
3146
|
return;
|
|
3152
3147
|
}
|
|
3153
|
-
!
|
|
3154
|
-
...
|
|
3148
|
+
!b || B !== b.requestId || (b = {
|
|
3149
|
+
...b,
|
|
3155
3150
|
items: F,
|
|
3156
|
-
activeIndex: Math.min(
|
|
3151
|
+
activeIndex: Math.min(b.activeIndex, Math.max(F.length - 1, 0)),
|
|
3157
3152
|
status: F.length > 0 ? "success" : "empty",
|
|
3158
3153
|
error: void 0
|
|
3159
3154
|
}, L());
|
|
3160
3155
|
}, u = () => {
|
|
3161
3156
|
if (r()) {
|
|
3162
|
-
|
|
3157
|
+
k();
|
|
3163
3158
|
return;
|
|
3164
3159
|
}
|
|
3165
|
-
const
|
|
3166
|
-
if (!
|
|
3167
|
-
|
|
3160
|
+
const x = n.getEditorState().read(l);
|
|
3161
|
+
if (!x) {
|
|
3162
|
+
k(!1);
|
|
3168
3163
|
return;
|
|
3169
3164
|
}
|
|
3170
|
-
|
|
3171
|
-
trigger:
|
|
3165
|
+
y += 1, b = {
|
|
3166
|
+
trigger: x,
|
|
3172
3167
|
items: [],
|
|
3173
3168
|
activeIndex: 0,
|
|
3174
|
-
requestId:
|
|
3169
|
+
requestId: y,
|
|
3175
3170
|
status: "loading",
|
|
3176
3171
|
error: void 0
|
|
3177
|
-
}, L(), _(
|
|
3172
|
+
}, L(), _(x.query, y);
|
|
3178
3173
|
}, 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) &&
|
|
3174
|
+
if (!b || b.status !== "success") return !1;
|
|
3175
|
+
const x = b.items[b.activeIndex], B = b.trigger;
|
|
3176
|
+
return x ? (k(), T(x, B), !0) : !1;
|
|
3177
|
+
}, p = (x) => !b || b.status !== "success" || b.items.length === 0 ? !1 : (b = {
|
|
3178
|
+
...b,
|
|
3179
|
+
activeIndex: (b.activeIndex + x + b.items.length) % b.items.length
|
|
3180
|
+
}, L(), !0), g = (x) => {
|
|
3181
|
+
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;
|
|
3182
|
+
!b || b.status !== "success" || Number.isNaN(G) || (b = { ...b, activeIndex: G }, x.preventDefault(), c());
|
|
3183
|
+
}, v = (x) => {
|
|
3184
|
+
const B = x.target;
|
|
3185
|
+
B instanceof HTMLElement && B.closest(s) && x.preventDefault();
|
|
3191
3186
|
}, S = n.registerUpdateListener(() => {
|
|
3192
3187
|
u();
|
|
3193
3188
|
}), N = n.registerCommand(
|
|
3194
|
-
|
|
3195
|
-
(
|
|
3189
|
+
sr,
|
|
3190
|
+
(x) => p(1) ? (x == null || x.preventDefault(), !0) : !1,
|
|
3196
3191
|
U
|
|
3197
3192
|
), O = n.registerCommand(
|
|
3198
|
-
|
|
3199
|
-
(
|
|
3193
|
+
ir,
|
|
3194
|
+
(x) => p(-1) ? (x == null || x.preventDefault(), !0) : !1,
|
|
3200
3195
|
U
|
|
3201
3196
|
), H = n.registerCommand(
|
|
3202
|
-
|
|
3203
|
-
(
|
|
3197
|
+
lr,
|
|
3198
|
+
(x) => c() ? (x == null || x.preventDefault(), !0) : !1,
|
|
3204
3199
|
U
|
|
3205
3200
|
), P = n.registerCommand(
|
|
3206
|
-
|
|
3207
|
-
(
|
|
3201
|
+
on,
|
|
3202
|
+
(x) => b ? (x == null || x.preventDefault(), k(), !0) : !1,
|
|
3208
3203
|
U
|
|
3209
3204
|
);
|
|
3210
|
-
return o.addEventListener("click", g), o.addEventListener("pointerdown",
|
|
3211
|
-
close:
|
|
3205
|
+
return o.addEventListener("click", g), o.addEventListener("pointerdown", v), {
|
|
3206
|
+
close: k,
|
|
3212
3207
|
destroy() {
|
|
3213
|
-
S(), N(), O(), H(), P(), o.removeEventListener("click", g), o.removeEventListener("pointerdown",
|
|
3208
|
+
S(), N(), O(), H(), P(), o.removeEventListener("click", g), o.removeEventListener("pointerdown", v), M(), m.destroy(), a.remove(), o.remove();
|
|
3214
3209
|
}
|
|
3215
3210
|
};
|
|
3216
3211
|
}, Bi = {
|
|
@@ -3235,7 +3230,7 @@ const An = {
|
|
|
3235
3230
|
if (t.startsWith("data.")) return Oi(e, t);
|
|
3236
3231
|
const n = t === "id" ? e.id : t === "label" ? e.label : t === "value" ? e.value : t === "avatar" ? e.avatar : e.description;
|
|
3237
3232
|
return typeof n == "string" && n ? n : void 0;
|
|
3238
|
-
}, Hi = (e) => e.startsWith("@") ? e : `@${e}`,
|
|
3233
|
+
}, Hi = (e) => e.startsWith("@") ? e : `@${e}`, Hn = (e, t) => {
|
|
3239
3234
|
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
3235
|
return {
|
|
3241
3236
|
item: e,
|
|
@@ -3244,7 +3239,7 @@ const An = {
|
|
|
3244
3239
|
...o ? { avatar: o } : {},
|
|
3245
3240
|
...a ? { icon: a } : {}
|
|
3246
3241
|
};
|
|
3247
|
-
}, $i = (e, t) => e.map((n) =>
|
|
3242
|
+
}, $i = (e, t) => e.map((n) => Hn(n, t)), Je = (e) => e instanceof ee && e.getTextContent().startsWith(" "), Fi = (e) => {
|
|
3248
3243
|
const n = e.getTextContent().slice(1);
|
|
3249
3244
|
if (!n) {
|
|
3250
3245
|
e.remove();
|
|
@@ -3252,24 +3247,24 @@ const An = {
|
|
|
3252
3247
|
}
|
|
3253
3248
|
e.setTextContent(n);
|
|
3254
3249
|
}, zi = (e, t) => {
|
|
3255
|
-
const n = e.getPreviousSibling(), r = e.getNextSibling(), o =
|
|
3256
|
-
if (
|
|
3250
|
+
const n = e.getPreviousSibling(), r = e.getNextSibling(), o = Je(r) ? r.getNextSibling() : r;
|
|
3251
|
+
if (Je(r) && Fi(r), e.remove(), t) {
|
|
3257
3252
|
n == null || n.selectEnd();
|
|
3258
3253
|
return;
|
|
3259
3254
|
}
|
|
3260
3255
|
o == null || o.selectStart();
|
|
3261
|
-
},
|
|
3256
|
+
}, Vi = (e) => {
|
|
3262
3257
|
const t = A();
|
|
3263
3258
|
if (!D(t) || !t.isCollapsed()) return null;
|
|
3264
3259
|
const n = t.anchor, r = n.getNode();
|
|
3265
|
-
if (
|
|
3260
|
+
if (kt(r)) return r;
|
|
3266
3261
|
if (!(r instanceof ee)) return null;
|
|
3267
|
-
const o = r.getTextContentSize(), a = r.getPreviousSibling(), s = r.getNextSibling(), l =
|
|
3268
|
-
return
|
|
3269
|
-
},
|
|
3262
|
+
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;
|
|
3263
|
+
return kt(d) ? d : null;
|
|
3264
|
+
}, Wi = (e, t, n) => {
|
|
3270
3265
|
const r = (a) => {
|
|
3271
3266
|
if (t()) return !1;
|
|
3272
|
-
const s =
|
|
3267
|
+
const s = Vi(a);
|
|
3273
3268
|
return s ? (zi(s, a), n(), !0) : !1;
|
|
3274
3269
|
}, o = (a, s) => {
|
|
3275
3270
|
const l = r(s);
|
|
@@ -3277,28 +3272,28 @@ const An = {
|
|
|
3277
3272
|
};
|
|
3278
3273
|
return [
|
|
3279
3274
|
e.registerCommand(
|
|
3280
|
-
|
|
3275
|
+
cr,
|
|
3281
3276
|
(a) => o(a, !0),
|
|
3282
3277
|
Ae
|
|
3283
3278
|
),
|
|
3284
3279
|
e.registerCommand(
|
|
3285
|
-
|
|
3280
|
+
dr,
|
|
3286
3281
|
(a) => o(a, !1),
|
|
3287
3282
|
Ae
|
|
3288
3283
|
),
|
|
3289
3284
|
e.registerCommand(
|
|
3290
|
-
|
|
3285
|
+
ur,
|
|
3291
3286
|
(a) => r(a),
|
|
3292
3287
|
Ae
|
|
3293
3288
|
)
|
|
3294
3289
|
];
|
|
3295
|
-
}, Ui = /(?:^|\s)@([\p{L}\p{N}_-]*)$/u,
|
|
3290
|
+
}, Ui = /(?:^|\s)@([\p{L}\p{N}_-]*)$/u, qt = [
|
|
3296
3291
|
{ id: "bridgerte-team", label: "BridgeRTE Team", value: "bridgerte-team" },
|
|
3297
3292
|
{ id: "frontend", label: "Frontend", value: "frontend" },
|
|
3298
3293
|
{ id: "designer", label: "Designer", value: "designer" }
|
|
3299
3294
|
], ji = (e) => e.trim().toLowerCase(), qi = (e) => [e.label, e.value, e.description].filter(Boolean).join(" ").toLowerCase(), Ki = (e) => {
|
|
3300
3295
|
const t = ji(e);
|
|
3301
|
-
return t ?
|
|
3296
|
+
return t ? qt.filter((n) => qi(n).includes(t)) : qt;
|
|
3302
3297
|
}, Gi = () => {
|
|
3303
3298
|
const e = A();
|
|
3304
3299
|
if (!D(e) || !e.isCollapsed()) return null;
|
|
@@ -3321,7 +3316,7 @@ const An = {
|
|
|
3321
3316
|
return e.className = "bridgerte__mention-anchor", e.setAttribute("aria-hidden", "true"), e;
|
|
3322
3317
|
}, Yi = (e, t) => {
|
|
3323
3318
|
var s;
|
|
3324
|
-
const n = e.getElementByKey(t.nodeKey), r =
|
|
3319
|
+
const n = e.getElementByKey(t.nodeKey), r = st(n, t.startOffset + 1);
|
|
3325
3320
|
if (!(r instanceof Text)) return null;
|
|
3326
3321
|
const o = document.createRange(), a = Math.min(t.startOffset + 1, ((s = r.textContent) == null ? void 0 : s.length) ?? 0);
|
|
3327
3322
|
return a <= t.startOffset ? null : (o.setStart(r, t.startOffset), o.setEnd(r, a), o.getBoundingClientRect());
|
|
@@ -3366,12 +3361,12 @@ const An = {
|
|
|
3366
3361
|
mentionMenuConfig: s,
|
|
3367
3362
|
onMentionMenuRequest: l
|
|
3368
3363
|
}) => {
|
|
3369
|
-
const d = Xi(), i = Ji(),
|
|
3364
|
+
const d = Xi(), i = Ji(), h = Di(s), w = (b, y) => {
|
|
3370
3365
|
n.update(() => {
|
|
3371
|
-
const M = me(
|
|
3372
|
-
M instanceof ee && (M.spliceText(
|
|
3373
|
-
}), o({ type: "mention.insert", item:
|
|
3374
|
-
}, C =
|
|
3366
|
+
const M = me(y.nodeKey);
|
|
3367
|
+
M instanceof ee && (M.spliceText(y.startOffset, y.endOffset - y.startOffset, ""), M.select(y.startOffset, y.startOffset));
|
|
3368
|
+
}), o({ type: "mention.insert", item: b });
|
|
3369
|
+
}, C = On({
|
|
3375
3370
|
editorRoot: e,
|
|
3376
3371
|
contentElement: t,
|
|
3377
3372
|
editor: n,
|
|
@@ -3380,38 +3375,38 @@ const An = {
|
|
|
3380
3375
|
anchor: i,
|
|
3381
3376
|
itemSelector: ".bridgerte__mention-item",
|
|
3382
3377
|
getCurrentTrigger: Gi,
|
|
3383
|
-
getTriggerRect: (
|
|
3384
|
-
resolveItems: async (
|
|
3385
|
-
const
|
|
3386
|
-
a ? a(
|
|
3378
|
+
getTriggerRect: (b) => Yi(n, b),
|
|
3379
|
+
resolveItems: async (b) => {
|
|
3380
|
+
const y = await Promise.resolve(
|
|
3381
|
+
a ? a(b) : Ki(b)
|
|
3387
3382
|
);
|
|
3388
|
-
return $i(
|
|
3383
|
+
return $i(y, h);
|
|
3389
3384
|
},
|
|
3390
3385
|
renderItem: Qi,
|
|
3391
|
-
renderStatus: (
|
|
3392
|
-
|
|
3393
|
-
el(
|
|
3386
|
+
renderStatus: (b) => Zi(
|
|
3387
|
+
b,
|
|
3388
|
+
el(b, h)
|
|
3394
3389
|
),
|
|
3395
|
-
onStateChange: l ? (
|
|
3396
|
-
id: `bridgerte-mention-menu-${
|
|
3397
|
-
query:
|
|
3398
|
-
status:
|
|
3399
|
-
items:
|
|
3400
|
-
config:
|
|
3390
|
+
onStateChange: l ? (b, y) => l({
|
|
3391
|
+
id: `bridgerte-mention-menu-${b.requestId}`,
|
|
3392
|
+
query: b.trigger.query,
|
|
3393
|
+
status: b.status,
|
|
3394
|
+
items: b.items,
|
|
3395
|
+
config: h,
|
|
3401
3396
|
readonly: r(),
|
|
3402
|
-
anchorRect: tl(
|
|
3403
|
-
...
|
|
3404
|
-
submit: (M) =>
|
|
3405
|
-
|
|
3397
|
+
anchorRect: tl(y.anchorRect),
|
|
3398
|
+
...b.error ? { error: b.error } : {},
|
|
3399
|
+
submit: (M) => y.selectItem(
|
|
3400
|
+
Hn(M, h)
|
|
3406
3401
|
),
|
|
3407
|
-
cancel:
|
|
3402
|
+
cancel: y.close
|
|
3408
3403
|
}) : void 0,
|
|
3409
|
-
onSelect: (
|
|
3410
|
-
}),
|
|
3411
|
-
...
|
|
3404
|
+
onSelect: (b, y) => w(b.item, y)
|
|
3405
|
+
}), T = an(
|
|
3406
|
+
...Wi(n, r, () => C.close(!1))
|
|
3412
3407
|
);
|
|
3413
3408
|
return () => {
|
|
3414
|
-
|
|
3409
|
+
T(), C.destroy();
|
|
3415
3410
|
};
|
|
3416
3411
|
}, rl = [
|
|
3417
3412
|
"script",
|
|
@@ -3480,7 +3475,7 @@ const An = {
|
|
|
3480
3475
|
"TT",
|
|
3481
3476
|
"U",
|
|
3482
3477
|
"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,
|
|
3478
|
+
]), 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
3479
|
["B", "strong"],
|
|
3485
3480
|
["DEL", "s"],
|
|
3486
3481
|
["I", "em"],
|
|
@@ -3493,23 +3488,23 @@ const An = {
|
|
|
3493
3488
|
} catch {
|
|
3494
3489
|
return !1;
|
|
3495
3490
|
}
|
|
3496
|
-
},
|
|
3491
|
+
}, it = (e) => {
|
|
3497
3492
|
e.replaceWith(...e.childNodes);
|
|
3498
|
-
},
|
|
3493
|
+
}, lt = (e, t) => {
|
|
3499
3494
|
const n = e.ownerDocument.createElement(t);
|
|
3500
3495
|
return n.append(...e.childNodes), e.replaceWith(n), n;
|
|
3501
3496
|
}, fl = (e) => {
|
|
3502
3497
|
const t = e.tagName.split(":")[0] ?? "";
|
|
3503
3498
|
return e.tagName.includes(":") && ul.has(t);
|
|
3504
|
-
},
|
|
3499
|
+
}, $n = (e) => {
|
|
3505
3500
|
[...e.childNodes].forEach((t) => {
|
|
3506
3501
|
if (t.nodeType === Node.COMMENT_NODE) {
|
|
3507
3502
|
t.remove();
|
|
3508
3503
|
return;
|
|
3509
3504
|
}
|
|
3510
|
-
|
|
3505
|
+
$n(t);
|
|
3511
3506
|
});
|
|
3512
|
-
},
|
|
3507
|
+
}, Fn = (e) => {
|
|
3513
3508
|
[...e.childNodes].forEach((t) => {
|
|
3514
3509
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
3515
3510
|
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 +3516,15 @@ const An = {
|
|
|
3521
3516
|
t.previousSibling || (a = a.trimStart()), t.nextSibling || (a = a.trimEnd()), t.textContent = a;
|
|
3522
3517
|
return;
|
|
3523
3518
|
}
|
|
3524
|
-
|
|
3519
|
+
Fn(t);
|
|
3525
3520
|
});
|
|
3526
|
-
}, bl = (e) => /^[1-9]\d*$/.test(e.trim()),
|
|
3521
|
+
}, bl = (e) => /^[1-9]\d*$/.test(e.trim()), ct = (e) => {
|
|
3527
3522
|
const t = e.trim().toLowerCase(), [, n] = t.match(hl) ?? [];
|
|
3528
3523
|
return n ? n.length === 8 ? `#${n.slice(2)}` : t : null;
|
|
3529
3524
|
}, yl = (e, t) => {
|
|
3530
3525
|
if (!ml.has(e)) return null;
|
|
3531
3526
|
const n = t.split(";").flatMap((r) => {
|
|
3532
|
-
const [o, ...a] = r.split(":"), s = o == null ? void 0 : o.trim().toLowerCase(), l =
|
|
3527
|
+
const [o, ...a] = r.split(":"), s = o == null ? void 0 : o.trim().toLowerCase(), l = ct(a.join(":"));
|
|
3533
3528
|
return !s || !l || !gl.has(s) ? [] : [`${s}: ${l}`];
|
|
3534
3529
|
});
|
|
3535
3530
|
return n.length > 0 ? `${n.join("; ")};` : null;
|
|
@@ -3539,7 +3534,7 @@ const An = {
|
|
|
3539
3534
|
return;
|
|
3540
3535
|
}
|
|
3541
3536
|
if (!al.has(e.tagName)) {
|
|
3542
|
-
|
|
3537
|
+
it(e);
|
|
3543
3538
|
return;
|
|
3544
3539
|
}
|
|
3545
3540
|
[...e.attributes].forEach((t) => {
|
|
@@ -3573,7 +3568,7 @@ const An = {
|
|
|
3573
3568
|
return;
|
|
3574
3569
|
}
|
|
3575
3570
|
if (e.tagName === "FONT" && n === "color") {
|
|
3576
|
-
if (
|
|
3571
|
+
if (ct(t.value)) return;
|
|
3577
3572
|
e.removeAttribute(t.name);
|
|
3578
3573
|
return;
|
|
3579
3574
|
}
|
|
@@ -3582,27 +3577,27 @@ const An = {
|
|
|
3582
3577
|
});
|
|
3583
3578
|
}, wl = (e) => {
|
|
3584
3579
|
[...e.querySelectorAll("font")].forEach((t) => {
|
|
3585
|
-
const n = t.getAttribute("color"), r = n ?
|
|
3580
|
+
const n = t.getAttribute("color"), r = n ? ct(n) : null, o = lt(t, "span");
|
|
3586
3581
|
r && o.setAttribute("style", `color: ${r};`);
|
|
3587
3582
|
});
|
|
3588
3583
|
}, Cl = (e) => {
|
|
3589
|
-
[...e.querySelectorAll([...
|
|
3590
|
-
const n =
|
|
3591
|
-
n &&
|
|
3584
|
+
[...e.querySelectorAll([...Kt.keys()].join(","))].forEach((t) => {
|
|
3585
|
+
const n = Kt.get(t.tagName);
|
|
3586
|
+
n && lt(t, n);
|
|
3592
3587
|
});
|
|
3593
3588
|
}, _l = (e) => {
|
|
3594
3589
|
[...e.querySelectorAll("div")].reverse().forEach((t) => {
|
|
3595
3590
|
if (t.querySelector(ll)) {
|
|
3596
|
-
|
|
3591
|
+
it(t);
|
|
3597
3592
|
return;
|
|
3598
3593
|
}
|
|
3599
|
-
|
|
3594
|
+
lt(t, "p");
|
|
3600
3595
|
});
|
|
3601
3596
|
}, kl = (e) => {
|
|
3602
3597
|
[...e.querySelectorAll("span")].forEach((t) => {
|
|
3603
|
-
t.attributes.length === 0 &&
|
|
3598
|
+
t.attributes.length === 0 && it(t);
|
|
3604
3599
|
});
|
|
3605
|
-
}, xl = (e) => !["P", "DIV", "SPAN"].includes(e.tagName) || e.querySelector("br,table,ul,ol") ? !1 : !(e.textContent ?? "").trim(),
|
|
3600
|
+
}, xl = (e) => !["P", "DIV", "SPAN"].includes(e.tagName) || e.querySelector("br,table,ul,ol") ? !1 : !(e.textContent ?? "").trim(), Gt = (e) => {
|
|
3606
3601
|
[...e.querySelectorAll("p,div,span")].reverse().forEach((t) => {
|
|
3607
3602
|
xl(t) && t.remove();
|
|
3608
3603
|
});
|
|
@@ -3636,13 +3631,13 @@ const An = {
|
|
|
3636
3631
|
r.remove();
|
|
3637
3632
|
}), t.content.querySelectorAll(ol).forEach((r) => {
|
|
3638
3633
|
r.remove();
|
|
3639
|
-
}),
|
|
3634
|
+
}), $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
3635
|
const n = document.createElement("div");
|
|
3641
|
-
return n.append(t.content.cloneNode(!0)), Ml(n),
|
|
3636
|
+
return n.append(t.content.cloneNode(!0)), Ml(n), Gt(n), n.innerHTML;
|
|
3642
3637
|
}, Ll = /^https?:\/\/[^\s<>"']+\.[^\s<>"']+$/i, Sl = /^www\.[^\s<>"']+\.[^\s<>"']+$/i, Nl = new RegExp(
|
|
3643
3638
|
`^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(?:/[^\\s<>"']*)?$`,
|
|
3644
3639
|
"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,
|
|
3640
|
+
), 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
3641
|
const n = Rl(t);
|
|
3647
3642
|
return n ? [{ type: n, file: t }] : [];
|
|
3648
3643
|
}) : [], Ie = (e) => ({
|
|
@@ -3661,38 +3656,38 @@ const An = {
|
|
|
3661
3656
|
}, Dl = (e) => {
|
|
3662
3657
|
const t = e.trim();
|
|
3663
3658
|
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
|
-
},
|
|
3659
|
+
}, Vn = (e, {
|
|
3665
3660
|
isReadonly: t,
|
|
3666
3661
|
executeCommand: n
|
|
3667
3662
|
}) => t() || !Dl(e.text) ? !1 : (n({
|
|
3668
3663
|
type: "link.set",
|
|
3669
3664
|
href: e.text.trim()
|
|
3670
|
-
}), !0),
|
|
3665
|
+
}), !0), Ye = (e, {
|
|
3671
3666
|
isReadonly: t,
|
|
3672
3667
|
canUploadMedia: n,
|
|
3673
3668
|
uploadMediaFile: r
|
|
3674
3669
|
}) => {
|
|
3675
3670
|
if (t() || !n()) return !1;
|
|
3676
|
-
const o =
|
|
3671
|
+
const o = zn(e.files);
|
|
3677
3672
|
return o.length === 0 ? !1 : (o.forEach(({ type: a, file: s }) => {
|
|
3678
3673
|
r(a, s);
|
|
3679
3674
|
}), !0);
|
|
3680
3675
|
}, Ol = (e, t) => {
|
|
3681
3676
|
const r = new DOMParser().parseFromString(t, "text/html");
|
|
3682
|
-
|
|
3683
|
-
const o =
|
|
3684
|
-
return
|
|
3677
|
+
Ba(r.body);
|
|
3678
|
+
const o = dn(e, r);
|
|
3679
|
+
return Da(o, r.body), o;
|
|
3685
3680
|
}, Hl = (e, t) => {
|
|
3686
3681
|
const n = Ol(e, t);
|
|
3687
3682
|
if (n.length === 0) return !1;
|
|
3688
3683
|
if (A() || $().selectEnd(), n.some(K)) {
|
|
3689
3684
|
n.forEach((o) => {
|
|
3690
|
-
|
|
3685
|
+
un(o);
|
|
3691
3686
|
});
|
|
3692
3687
|
const r = n[n.length - 1];
|
|
3693
|
-
return r && K(r) &&
|
|
3688
|
+
return r && K(r) && V([z()]), !0;
|
|
3694
3689
|
}
|
|
3695
|
-
return
|
|
3690
|
+
return V(n), !0;
|
|
3696
3691
|
}, $l = (e, {
|
|
3697
3692
|
editor: t,
|
|
3698
3693
|
isReadonly: n
|
|
@@ -3710,37 +3705,37 @@ const An = {
|
|
|
3710
3705
|
if (n() || e.html.trim() || !e.text.trim()) return !1;
|
|
3711
3706
|
const r = Bl(e.text);
|
|
3712
3707
|
return r ? (t.update(() => {
|
|
3713
|
-
const o =
|
|
3714
|
-
A() || $().selectEnd(), o.append(Se(r.code)),
|
|
3708
|
+
const o = wn(r.language || void 0), a = z();
|
|
3709
|
+
A() || $().selectEnd(), o.append(Se(r.code)), un(o), V([a]), a.selectStart();
|
|
3715
3710
|
}), !0) : !1;
|
|
3716
3711
|
}, zl = (e, {
|
|
3717
3712
|
editor: t,
|
|
3718
3713
|
isReadonly: n
|
|
3719
3714
|
}) => n() || e.html.trim() || !e.text ? !1 : (t.update(() => {
|
|
3720
|
-
A() || $().selectEnd(),
|
|
3715
|
+
A() || $().selectEnd(), V([Se(e.text)]);
|
|
3721
3716
|
}), !0), Wn = (e, t) => Fl(e, t) || $l(e, t), Q = (e) => {
|
|
3722
3717
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
3723
|
-
},
|
|
3718
|
+
}, Vl = (e, t) => Ye(e, t) || Vn(e, t) || Wn(e, t), Wl = (e) => {
|
|
3724
3719
|
const t = (n) => {
|
|
3725
|
-
n.defaultPrevented ||
|
|
3720
|
+
n.defaultPrevented || Vn(Ie(n.clipboardData), e) && Q(n);
|
|
3726
3721
|
};
|
|
3727
3722
|
return e.target.addEventListener("paste", t, { capture: !0 }), () => {
|
|
3728
3723
|
e.target.removeEventListener("paste", t, { capture: !0 });
|
|
3729
3724
|
};
|
|
3730
3725
|
}, Ul = (e) => {
|
|
3731
3726
|
const t = (o) => {
|
|
3732
|
-
o.defaultPrevented ||
|
|
3727
|
+
o.defaultPrevented || Ye(Ie(o.clipboardData), e) && Q(o);
|
|
3733
3728
|
}, n = (o) => {
|
|
3734
3729
|
var s;
|
|
3735
3730
|
if (e.isReadonly() || !e.canUploadMedia()) return;
|
|
3736
3731
|
const a = (s = o.dataTransfer) != null && s.files ? [...o.dataTransfer.files] : [];
|
|
3737
|
-
|
|
3732
|
+
zn(a).length !== 0 && (o.preventDefault(), o.dataTransfer && (o.dataTransfer.dropEffect = "copy"));
|
|
3738
3733
|
}, r = (o) => {
|
|
3739
3734
|
var s;
|
|
3740
3735
|
const a = {
|
|
3741
3736
|
files: (s = o.dataTransfer) != null && s.files ? [...o.dataTransfer.files] : []
|
|
3742
3737
|
};
|
|
3743
|
-
|
|
3738
|
+
Ye(a, e) && Q(o);
|
|
3744
3739
|
};
|
|
3745
3740
|
return e.target.addEventListener("paste", t, { capture: !0 }), e.target.addEventListener("dragover", n), e.target.addEventListener("drop", r), () => {
|
|
3746
3741
|
e.target.removeEventListener("paste", t, { capture: !0 }), e.target.removeEventListener("dragover", n), e.target.removeEventListener("drop", r);
|
|
@@ -3761,9 +3756,9 @@ const An = {
|
|
|
3761
3756
|
executeCommand: a,
|
|
3762
3757
|
editor: s
|
|
3763
3758
|
}) => {
|
|
3764
|
-
const l = (i,
|
|
3765
|
-
text:
|
|
3766
|
-
html:
|
|
3759
|
+
const l = (i, h) => Vl({
|
|
3760
|
+
text: h.text ?? i.text,
|
|
3761
|
+
html: h.html ?? i.html,
|
|
3767
3762
|
files: i.files
|
|
3768
3763
|
}, {
|
|
3769
3764
|
isReadonly: t,
|
|
@@ -3773,14 +3768,14 @@ const An = {
|
|
|
3773
3768
|
editor: s
|
|
3774
3769
|
}), d = (i) => {
|
|
3775
3770
|
if (t() || !n) return;
|
|
3776
|
-
const
|
|
3777
|
-
text:
|
|
3778
|
-
html:
|
|
3779
|
-
files:
|
|
3771
|
+
const h = Ie(i.clipboardData), w = n({
|
|
3772
|
+
text: h.text,
|
|
3773
|
+
html: h.html,
|
|
3774
|
+
files: h.files.map(Al)
|
|
3780
3775
|
});
|
|
3781
3776
|
if (w instanceof Promise) {
|
|
3782
3777
|
Q(i), w.then((C) => {
|
|
3783
|
-
C !== !0 && C && l(
|
|
3778
|
+
C !== !0 && C && l(h, C);
|
|
3784
3779
|
});
|
|
3785
3780
|
return;
|
|
3786
3781
|
}
|
|
@@ -3788,7 +3783,7 @@ const An = {
|
|
|
3788
3783
|
Q(i);
|
|
3789
3784
|
return;
|
|
3790
3785
|
}
|
|
3791
|
-
w && (Q(i), l(
|
|
3786
|
+
w && (Q(i), l(h, w));
|
|
3792
3787
|
};
|
|
3793
3788
|
return e.addEventListener("paste", d, { capture: !0 }), () => {
|
|
3794
3789
|
e.removeEventListener("paste", d, { capture: !0 });
|
|
@@ -3825,18 +3820,17 @@ const An = {
|
|
|
3825
3820
|
icon: e.icon,
|
|
3826
3821
|
requiresPayload: e.requiresPayload,
|
|
3827
3822
|
payloadPanel: e.payloadPanel,
|
|
3828
|
-
group: e.group,
|
|
3829
3823
|
source: "schema"
|
|
3830
|
-
}), Zl = (e, t) => Jl(
|
|
3824
|
+
}), Zl = (e, t) => Jl(Ze(
|
|
3831
3825
|
Yl(t),
|
|
3832
3826
|
e
|
|
3833
|
-
)).map(Ql),
|
|
3827
|
+
)).map(Ql), Un = (e) => ({
|
|
3834
3828
|
...e,
|
|
3835
3829
|
source: "provider"
|
|
3836
|
-
}), ec = /(?:^|\s)\/([\p{L}\p{N}_-]*)$/u, tc = (e) => e.trim().toLowerCase(), nc = (e) => [e.label, e.id, e.description,
|
|
3830
|
+
}), ec = /(?:^|\s)\/([\p{L}\p{N}_-]*)$/u, tc = (e) => e.trim().toLowerCase(), nc = (e) => [e.label, e.id, e.description, ...e.keywords ?? []].filter(Boolean).join(" ").toLowerCase(), rc = (e, t) => {
|
|
3837
3831
|
const n = tc(t);
|
|
3838
3832
|
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(
|
|
3833
|
+
}, 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
3834
|
menuSchema: e,
|
|
3841
3835
|
slashCommandConfig: t
|
|
3842
3836
|
}) => e !== void 0 || t !== void 0, ic = () => {
|
|
@@ -3859,9 +3853,9 @@ const An = {
|
|
|
3859
3853
|
}, cc = () => {
|
|
3860
3854
|
const e = document.createElement("span");
|
|
3861
3855
|
return e.className = "bridgerte__slash-command-anchor", e.setAttribute("aria-hidden", "true"), e;
|
|
3862
|
-
},
|
|
3856
|
+
}, Xt = (e, t) => {
|
|
3863
3857
|
var s;
|
|
3864
|
-
const n = e.getElementByKey(t.nodeKey), r =
|
|
3858
|
+
const n = e.getElementByKey(t.nodeKey), r = st(n, t.startOffset + 1);
|
|
3865
3859
|
if (!(r instanceof Text)) return null;
|
|
3866
3860
|
const o = document.createRange(), a = Math.min(t.startOffset + 1, ((s = r.textContent) == null ? void 0 : s.length) ?? 0);
|
|
3867
3861
|
return a <= t.startOffset ? null : (o.setStart(r, t.startOffset), o.setEnd(r, a), o.getBoundingClientRect());
|
|
@@ -3869,7 +3863,7 @@ const An = {
|
|
|
3869
3863
|
const a = document.createElement("button"), s = document.createElement("span");
|
|
3870
3864
|
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
3865
|
const l = document.createElement("span");
|
|
3872
|
-
l.className = "bridgerte__slash-command-item-icon", l.setAttribute("aria-hidden", "true"),
|
|
3866
|
+
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
3867
|
}
|
|
3874
3868
|
if (s.className = "bridgerte__slash-command-item-title", s.textContent = e.label, a.append(s), e.description) {
|
|
3875
3869
|
const l = document.createElement("span");
|
|
@@ -3888,7 +3882,7 @@ const An = {
|
|
|
3888
3882
|
case "error":
|
|
3889
3883
|
return t.errorText;
|
|
3890
3884
|
}
|
|
3891
|
-
},
|
|
3885
|
+
}, Jt = (e) => e ? {
|
|
3892
3886
|
x: e.x,
|
|
3893
3887
|
y: e.y,
|
|
3894
3888
|
width: e.width,
|
|
@@ -3904,15 +3898,15 @@ const An = {
|
|
|
3904
3898
|
slashCommandConfig: l,
|
|
3905
3899
|
icons: d = {},
|
|
3906
3900
|
menuLabels: i,
|
|
3907
|
-
payloadPanelConfig:
|
|
3901
|
+
payloadPanelConfig: h,
|
|
3908
3902
|
slashCommandMenuConfig: w,
|
|
3909
3903
|
onSlashCommandMenuRequest: C,
|
|
3910
|
-
slashCommandProvider:
|
|
3904
|
+
slashCommandProvider: T
|
|
3911
3905
|
}) => {
|
|
3912
|
-
const
|
|
3906
|
+
const b = lc(), y = cc(), M = Xl(w), m = ot(s ?? Ne, {
|
|
3913
3907
|
menuLabels: i,
|
|
3914
|
-
payloadPanelConfig:
|
|
3915
|
-
}),
|
|
3908
|
+
payloadPanelConfig: h
|
|
3909
|
+
}), f = Zl(m, l), E = new Map(m.map((u) => [u.id, u])), k = sc({
|
|
3916
3910
|
menuSchema: s,
|
|
3917
3911
|
slashCommandConfig: l
|
|
3918
3912
|
}), I = (u) => {
|
|
@@ -3921,30 +3915,30 @@ const An = {
|
|
|
3921
3915
|
c instanceof ee && (c.spliceText(u.startOffset, u.endOffset - u.startOffset, ""), c.select(u.startOffset, u.startOffset));
|
|
3922
3916
|
});
|
|
3923
3917
|
};
|
|
3924
|
-
return
|
|
3918
|
+
return On({
|
|
3925
3919
|
editorRoot: e,
|
|
3926
3920
|
contentElement: t,
|
|
3927
3921
|
editor: n,
|
|
3928
3922
|
isReadonly: r,
|
|
3929
|
-
menu:
|
|
3930
|
-
anchor:
|
|
3923
|
+
menu: b,
|
|
3924
|
+
anchor: y,
|
|
3931
3925
|
itemSelector: ".bridgerte__slash-command-item",
|
|
3932
3926
|
getCurrentTrigger: ic,
|
|
3933
|
-
getTriggerRect: (u) =>
|
|
3927
|
+
getTriggerRect: (u) => Xt(n, u),
|
|
3934
3928
|
resolveItems: async (u) => {
|
|
3935
|
-
const c =
|
|
3929
|
+
const c = k || !T ? rc(f, u) : [];
|
|
3936
3930
|
try {
|
|
3937
|
-
const
|
|
3938
|
-
return [...c, ...
|
|
3939
|
-
} catch (
|
|
3931
|
+
const p = await oc(u, T);
|
|
3932
|
+
return [...c, ...p];
|
|
3933
|
+
} catch (p) {
|
|
3940
3934
|
if (c.length > 0) return c;
|
|
3941
|
-
throw
|
|
3935
|
+
throw p;
|
|
3942
3936
|
}
|
|
3943
3937
|
},
|
|
3944
|
-
renderItem: (u, c,
|
|
3938
|
+
renderItem: (u, c, p) => dc(
|
|
3945
3939
|
u,
|
|
3946
3940
|
c,
|
|
3947
|
-
|
|
3941
|
+
p,
|
|
3948
3942
|
M,
|
|
3949
3943
|
d
|
|
3950
3944
|
),
|
|
@@ -3959,34 +3953,34 @@ const An = {
|
|
|
3959
3953
|
items: u.items,
|
|
3960
3954
|
config: M,
|
|
3961
3955
|
readonly: r(),
|
|
3962
|
-
anchorRect:
|
|
3956
|
+
anchorRect: Jt(c.anchorRect),
|
|
3963
3957
|
...u.error ? { error: u.error } : {},
|
|
3964
|
-
submit: (
|
|
3958
|
+
submit: (p) => c.selectItem(ac(p)),
|
|
3965
3959
|
cancel: c.close
|
|
3966
3960
|
}) : void 0,
|
|
3967
3961
|
onSelect: (u, c) => {
|
|
3968
3962
|
I(c);
|
|
3969
|
-
const
|
|
3970
|
-
if (
|
|
3971
|
-
const g =
|
|
3963
|
+
const p = u.source === "schema" ? E.get(u.id) : void 0;
|
|
3964
|
+
if (p != null && p.payloadPanel) {
|
|
3965
|
+
const g = Xt(n, c);
|
|
3972
3966
|
a({
|
|
3973
|
-
menuId:
|
|
3974
|
-
command:
|
|
3975
|
-
panel:
|
|
3976
|
-
anchorRect:
|
|
3967
|
+
menuId: p.id,
|
|
3968
|
+
command: p.command,
|
|
3969
|
+
panel: p.payloadPanel,
|
|
3970
|
+
anchorRect: Jt(g ?? void 0)
|
|
3977
3971
|
});
|
|
3978
3972
|
return;
|
|
3979
3973
|
}
|
|
3980
3974
|
o(u.command);
|
|
3981
3975
|
}
|
|
3982
3976
|
}).destroy;
|
|
3983
|
-
},
|
|
3977
|
+
}, Yt = 32, He = (e) => {
|
|
3984
3978
|
var t;
|
|
3985
3979
|
return e instanceof HTMLElement && e.getAttribute("role") === "checkbox" && ((t = e.parentElement) == null ? void 0 : t.classList.contains("bridgerte__list--todo")) === !0;
|
|
3986
|
-
},
|
|
3980
|
+
}, $e = (e) => e instanceof HTMLElement ? e.closest('[role="checkbox"]') : null, hc = (e) => mr(e), Qt = (e) => e.button === 0, Fe = (e, t) => {
|
|
3987
3981
|
const n = t.getBoundingClientRect();
|
|
3988
|
-
return t.dir === "rtl" ? e.clientX >= n.right -
|
|
3989
|
-
},
|
|
3982
|
+
return t.dir === "rtl" ? e.clientX >= n.right - Yt && e.clientX <= n.right : e.clientX >= n.left && e.clientX <= n.left + Yt;
|
|
3983
|
+
}, Zt = (e) => {
|
|
3990
3984
|
e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
|
|
3991
3985
|
}, pc = ({
|
|
3992
3986
|
contentElement: e,
|
|
@@ -3995,27 +3989,27 @@ const An = {
|
|
|
3995
3989
|
}) => {
|
|
3996
3990
|
let r = 0;
|
|
3997
3991
|
const o = (d) => {
|
|
3998
|
-
if (n() || !
|
|
3999
|
-
const i =
|
|
4000
|
-
!i || !
|
|
3992
|
+
if (n() || !Qt(d)) return;
|
|
3993
|
+
const i = $e(d.target);
|
|
3994
|
+
!i || !He(i) || Fe(d, i) && Zt(d);
|
|
4001
3995
|
}, a = (d, i) => {
|
|
4002
|
-
|
|
4003
|
-
const
|
|
4004
|
-
|
|
3996
|
+
Zt(d), t.update(() => {
|
|
3997
|
+
const h = hc(i);
|
|
3998
|
+
Ir(h) && h.toggleChecked();
|
|
4005
3999
|
});
|
|
4006
4000
|
}, s = (d) => {
|
|
4007
|
-
if (n() || !
|
|
4008
|
-
const i =
|
|
4009
|
-
!i || !
|
|
4001
|
+
if (n() || !Qt(d) || Date.now() - r < 700) return;
|
|
4002
|
+
const i = $e(d.target);
|
|
4003
|
+
!i || !He(i) || Fe(d, i) && a(d, i);
|
|
4010
4004
|
}, l = (d) => {
|
|
4011
4005
|
if (n() || d.pointerType !== "touch") return;
|
|
4012
|
-
const i =
|
|
4013
|
-
!i || !
|
|
4006
|
+
const i = $e(d.target);
|
|
4007
|
+
!i || !He(i) || Fe(d, i) && (r = Date.now(), a(d, i));
|
|
4014
4008
|
};
|
|
4015
4009
|
return e.addEventListener("pointerdown", o, !0), e.addEventListener("pointerup", l, !0), e.addEventListener("click", s, !0), () => {
|
|
4016
4010
|
e.removeEventListener("pointerdown", o, !0), e.removeEventListener("pointerup", l, !0), e.removeEventListener("click", s, !0);
|
|
4017
4011
|
};
|
|
4018
|
-
},
|
|
4012
|
+
}, ze = (e, t) => {
|
|
4019
4013
|
var n;
|
|
4020
4014
|
return ((n = e.floatingMenus) == null ? void 0 : n[t]) !== !1;
|
|
4021
4015
|
}, fc = ({
|
|
@@ -4029,14 +4023,14 @@ const An = {
|
|
|
4029
4023
|
requestPayloadPanel: l,
|
|
4030
4024
|
uploadMediaFile: d,
|
|
4031
4025
|
canUploadMedia: i,
|
|
4032
|
-
syncAfterEditorUpdate:
|
|
4026
|
+
syncAfterEditorUpdate: h,
|
|
4033
4027
|
refreshCommandStates: w,
|
|
4034
4028
|
getCommandStates: C,
|
|
4035
|
-
setCanUndo:
|
|
4036
|
-
setCanRedo:
|
|
4037
|
-
enableKeyboardShortcuts:
|
|
4029
|
+
setCanUndo: T,
|
|
4030
|
+
setCanRedo: b,
|
|
4031
|
+
enableKeyboardShortcuts: y
|
|
4038
4032
|
}) => {
|
|
4039
|
-
const M =
|
|
4033
|
+
const M = ze(e, "mention"), m = ze(e, "slash"), f = ze(e, "hoverbar"), E = an(
|
|
4040
4034
|
/*
|
|
4041
4035
|
* 业务自定义 paste hook 最先看到原始剪贴板摘要;返回 undefined 时完全不拦截,
|
|
4042
4036
|
* 继续走 BridgeRTE 内置媒体、URL 和 HTML 清洗链路。
|
|
@@ -4064,7 +4058,7 @@ const An = {
|
|
|
4064
4058
|
* URL 粘贴是 BridgeRTE 的高意图快捷路径,必须先于 Lexical 默认 paste 监听注册。
|
|
4065
4059
|
* 否则 Lexical 会先把 URL 当普通文本插入,后续就失去“选区变链接”的语义。
|
|
4066
4060
|
*/
|
|
4067
|
-
|
|
4061
|
+
Wl({
|
|
4068
4062
|
target: r,
|
|
4069
4063
|
isReadonly: a,
|
|
4070
4064
|
executeCommand: s
|
|
@@ -4082,15 +4076,15 @@ const An = {
|
|
|
4082
4076
|
target: r,
|
|
4083
4077
|
isReadonly: a
|
|
4084
4078
|
}),
|
|
4085
|
-
|
|
4079
|
+
Cr(t),
|
|
4086
4080
|
/*
|
|
4087
4081
|
* 代码块高亮一刀切使用 Lexical 官方 Shiki 管线。BridgeRTE tokenizer 只保留稳定 class,
|
|
4088
4082
|
* 不把 Shiki theme 的 inline style 写进内容 HTML。
|
|
4089
4083
|
*/
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
Ir(t),
|
|
4084
|
+
go(t, $a),
|
|
4085
|
+
eo(t, o, wa),
|
|
4093
4086
|
Rr(t),
|
|
4087
|
+
Ar(t),
|
|
4094
4088
|
pc({
|
|
4095
4089
|
contentElement: r,
|
|
4096
4090
|
editor: t,
|
|
@@ -4107,7 +4101,7 @@ const An = {
|
|
|
4107
4101
|
onMentionMenuRequest: e.onMentionMenuRequest
|
|
4108
4102
|
}) : () => {
|
|
4109
4103
|
},
|
|
4110
|
-
|
|
4104
|
+
f ? Ti({
|
|
4111
4105
|
editorRoot: n,
|
|
4112
4106
|
contentElement: r,
|
|
4113
4107
|
editor: t,
|
|
@@ -4122,9 +4116,9 @@ const An = {
|
|
|
4122
4116
|
payloadPanelConfig: e.payloadPanelConfig
|
|
4123
4117
|
}) : () => {
|
|
4124
4118
|
},
|
|
4125
|
-
|
|
4119
|
+
jr(t),
|
|
4126
4120
|
gi({ editor: t }),
|
|
4127
|
-
|
|
4121
|
+
m ? gc({
|
|
4128
4122
|
editorRoot: n,
|
|
4129
4123
|
contentElement: r,
|
|
4130
4124
|
editor: t,
|
|
@@ -4141,103 +4135,103 @@ const An = {
|
|
|
4141
4135
|
slashCommandProvider: e.slashCommandProvider
|
|
4142
4136
|
}) : () => {
|
|
4143
4137
|
},
|
|
4144
|
-
|
|
4138
|
+
Do({
|
|
4145
4139
|
editor: t,
|
|
4146
4140
|
contentElement: r,
|
|
4147
4141
|
isReadonly: a
|
|
4148
4142
|
}),
|
|
4149
|
-
|
|
4143
|
+
y ? Ri({
|
|
4150
4144
|
target: r,
|
|
4151
4145
|
isReadonly: a,
|
|
4152
4146
|
executeCommand: s
|
|
4153
4147
|
}) : () => {
|
|
4154
4148
|
},
|
|
4155
4149
|
t.registerUpdateListener(() => {
|
|
4156
|
-
|
|
4150
|
+
h(), w();
|
|
4157
4151
|
}),
|
|
4158
4152
|
t.registerCommand(
|
|
4159
|
-
|
|
4153
|
+
rn,
|
|
4160
4154
|
() => (w(), !1),
|
|
4161
4155
|
U
|
|
4162
4156
|
),
|
|
4163
4157
|
t.registerCommand(
|
|
4164
|
-
|
|
4165
|
-
(
|
|
4158
|
+
gr,
|
|
4159
|
+
(k) => (T(k), !1),
|
|
4166
4160
|
U
|
|
4167
4161
|
),
|
|
4168
4162
|
t.registerCommand(
|
|
4169
|
-
|
|
4170
|
-
(
|
|
4163
|
+
hr,
|
|
4164
|
+
(k) => (b(k), !1),
|
|
4171
4165
|
U
|
|
4172
4166
|
)
|
|
4173
4167
|
);
|
|
4174
4168
|
return {
|
|
4175
4169
|
destroy() {
|
|
4176
|
-
|
|
4170
|
+
E();
|
|
4177
4171
|
}
|
|
4178
4172
|
};
|
|
4179
4173
|
};
|
|
4180
4174
|
function bc(e, t = {}) {
|
|
4181
|
-
const n =
|
|
4182
|
-
placeholder: t.placeholder ??
|
|
4175
|
+
const n = to(), r = t.mediaDefaultWidthPercent ?? 50, { contentElement: o } = li(e, {
|
|
4176
|
+
placeholder: t.placeholder ?? Ro
|
|
4183
4177
|
}), a = t.keyboardShortcuts === !0;
|
|
4184
|
-
let s = t.readonly ?? !1, l = !1, d =
|
|
4185
|
-
const i =
|
|
4186
|
-
namespace:
|
|
4178
|
+
let s = t.readonly ?? !1, l = !1, d = je(t.value);
|
|
4179
|
+
const i = pr({
|
|
4180
|
+
namespace: Ca,
|
|
4187
4181
|
editable: !s,
|
|
4188
4182
|
nodes: [
|
|
4189
|
-
Cr,
|
|
4190
4183
|
_r,
|
|
4191
|
-
|
|
4192
|
-
Mr,
|
|
4184
|
+
kr,
|
|
4193
4185
|
sn,
|
|
4194
|
-
|
|
4186
|
+
Tr,
|
|
4187
|
+
ln,
|
|
4188
|
+
Br,
|
|
4195
4189
|
We,
|
|
4196
|
-
jr,
|
|
4197
4190
|
qr,
|
|
4198
|
-
|
|
4191
|
+
Kr,
|
|
4199
4192
|
Qr,
|
|
4193
|
+
Zr,
|
|
4200
4194
|
ge,
|
|
4201
4195
|
se,
|
|
4202
4196
|
pe
|
|
4203
4197
|
],
|
|
4204
|
-
theme:
|
|
4198
|
+
theme: sa,
|
|
4205
4199
|
onError: (u) => {
|
|
4206
4200
|
j(t, "lexical.runtime", "Lexical runtime error.", u);
|
|
4207
4201
|
}
|
|
4208
4202
|
});
|
|
4209
|
-
|
|
4210
|
-
const
|
|
4211
|
-
|
|
4212
|
-
},
|
|
4203
|
+
Gr(i, !0);
|
|
4204
|
+
const h = () => l, w = () => s, C = () => {
|
|
4205
|
+
h() || Bo({ editor: i, contentElement: o });
|
|
4206
|
+
}, T = ci({ editor: i }), b = _a({
|
|
4213
4207
|
lexicalEditor: i,
|
|
4214
4208
|
options: t,
|
|
4215
|
-
isDestroyed:
|
|
4209
|
+
isDestroyed: h,
|
|
4216
4210
|
setContent: (u) => {
|
|
4217
4211
|
d = u;
|
|
4218
4212
|
},
|
|
4219
4213
|
syncPlaceholder: C
|
|
4220
|
-
}),
|
|
4214
|
+
}), y = ea({
|
|
4221
4215
|
lexicalEditor: i,
|
|
4222
4216
|
options: t,
|
|
4223
|
-
isDestroyed:
|
|
4217
|
+
isDestroyed: h,
|
|
4224
4218
|
canUploadMedia: () => t.uploadAdapter !== void 0,
|
|
4225
4219
|
isReadonly: w
|
|
4226
|
-
}), M =
|
|
4220
|
+
}), M = va({
|
|
4227
4221
|
container: e,
|
|
4228
4222
|
lexicalEditor: i,
|
|
4229
4223
|
options: t,
|
|
4230
|
-
isDestroyed:
|
|
4224
|
+
isDestroyed: h,
|
|
4231
4225
|
isReadonly: w,
|
|
4232
4226
|
reportError: j
|
|
4233
|
-
}),
|
|
4227
|
+
}), m = () => {
|
|
4234
4228
|
o.contentEditable = String(!s), i.setEditable(!s);
|
|
4235
|
-
},
|
|
4229
|
+
}, E = ii({
|
|
4236
4230
|
editorRoot: e,
|
|
4237
4231
|
lexicalEditor: i,
|
|
4238
4232
|
isReadonly: w,
|
|
4239
4233
|
restoreEditorFocus: (u) => {
|
|
4240
|
-
|
|
4234
|
+
T.restore(), i.focus(u);
|
|
4241
4235
|
},
|
|
4242
4236
|
executeCommand: M,
|
|
4243
4237
|
getClearCommand: (u) => {
|
|
@@ -4258,10 +4252,10 @@ function bc(e, t = {}) {
|
|
|
4258
4252
|
menuLabels: t.menuLabels,
|
|
4259
4253
|
onRequest: t.onPayloadPanelRequest,
|
|
4260
4254
|
defaultMediaWidthPercent: r
|
|
4261
|
-
}),
|
|
4262
|
-
|
|
4255
|
+
}), k = () => Yo(t), I = () => Qo(t), R = (u) => {
|
|
4256
|
+
h() || (T.capture(), E.payloadPanelController.open(u));
|
|
4263
4257
|
};
|
|
4264
|
-
e.dataset.readonly = String(s), e.addEventListener("focusin",
|
|
4258
|
+
e.dataset.readonly = String(s), e.addEventListener("focusin", k), e.addEventListener("focusout", I), e.style.setProperty(
|
|
4265
4259
|
"--bridgerte-media-display-width",
|
|
4266
4260
|
`${r}%`
|
|
4267
4261
|
);
|
|
@@ -4276,48 +4270,48 @@ function bc(e, t = {}) {
|
|
|
4276
4270
|
requestPayloadPanel: R,
|
|
4277
4271
|
uploadMediaFile: M.uploadMediaFile,
|
|
4278
4272
|
canUploadMedia: () => t.uploadAdapter !== void 0,
|
|
4279
|
-
syncAfterEditorUpdate:
|
|
4280
|
-
refreshCommandStates:
|
|
4281
|
-
getCommandStates:
|
|
4282
|
-
setCanUndo:
|
|
4283
|
-
setCanRedo:
|
|
4273
|
+
syncAfterEditorUpdate: b.syncAfterEditorUpdate,
|
|
4274
|
+
refreshCommandStates: y.refreshCommandStates,
|
|
4275
|
+
getCommandStates: y.getCommandStates,
|
|
4276
|
+
setCanUndo: y.setCanUndo,
|
|
4277
|
+
setCanRedo: y.setCanRedo,
|
|
4284
4278
|
enableKeyboardShortcuts: a
|
|
4285
4279
|
});
|
|
4286
|
-
i.setRootElement(o),
|
|
4280
|
+
i.setRootElement(o), b.suppressNextChange(), d = So(i, t.value), m();
|
|
4287
4281
|
const _ = {
|
|
4288
4282
|
getContent() {
|
|
4289
|
-
return
|
|
4283
|
+
return h() || (b.clearContentChangeTimer(), b.syncContent(!1)), d;
|
|
4290
4284
|
},
|
|
4291
4285
|
setContent(u) {
|
|
4292
|
-
|
|
4286
|
+
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
4287
|
},
|
|
4294
4288
|
executeCommand(u) {
|
|
4295
4289
|
M(u);
|
|
4296
4290
|
},
|
|
4297
4291
|
requestPayloadPanel: R,
|
|
4298
|
-
getCommandStates:
|
|
4299
|
-
subscribeCommandStateChange:
|
|
4292
|
+
getCommandStates: y.getCommandStates,
|
|
4293
|
+
subscribeCommandStateChange: y.subscribeCommandStateChange,
|
|
4300
4294
|
setReadonly(u) {
|
|
4301
|
-
|
|
4295
|
+
h() || (s = u, e.dataset.readonly = String(s), m(), y.refreshCommandStates());
|
|
4302
4296
|
},
|
|
4303
4297
|
focus() {
|
|
4304
|
-
|
|
4298
|
+
h() || i.focus();
|
|
4305
4299
|
},
|
|
4306
4300
|
blur() {
|
|
4307
|
-
|
|
4301
|
+
h() || o.blur();
|
|
4308
4302
|
},
|
|
4309
4303
|
destroy() {
|
|
4310
|
-
|
|
4304
|
+
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
4305
|
}
|
|
4312
4306
|
};
|
|
4313
|
-
return
|
|
4307
|
+
return b.syncContent(!1), C(), y.refreshCommandStates(), Zo(t, _), _;
|
|
4314
4308
|
}
|
|
4315
|
-
const yc = (e) => !
|
|
4309
|
+
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
4310
|
id: e,
|
|
4317
4311
|
type: "editor.ready",
|
|
4318
4312
|
payload: {
|
|
4319
4313
|
menuSchema: Ne,
|
|
4320
|
-
eventTiming:
|
|
4314
|
+
eventTiming: Jn,
|
|
4321
4315
|
version: Le
|
|
4322
4316
|
}
|
|
4323
4317
|
}), wc = (e) => `native-upload:${e}:${Date.now()}:${Math.random().toString(36).slice(2)}`, Hc = ({
|
|
@@ -4326,7 +4320,7 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4326
4320
|
}) => {
|
|
4327
4321
|
var L;
|
|
4328
4322
|
let n = null, r = !1, o = null, a = null, s = null, l = 0;
|
|
4329
|
-
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(),
|
|
4323
|
+
const d = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), h = (_) => {
|
|
4330
4324
|
r || t.postMessage(_);
|
|
4331
4325
|
}, w = () => {
|
|
4332
4326
|
s && (clearTimeout(s), s = null);
|
|
@@ -4334,24 +4328,24 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4334
4328
|
w(), s = setTimeout(() => {
|
|
4335
4329
|
if (r) return;
|
|
4336
4330
|
const _ = Math.ceil(e.getBoundingClientRect().height);
|
|
4337
|
-
_ !== l && (l = _,
|
|
4331
|
+
_ !== l && (l = _, h({
|
|
4338
4332
|
type: "editor.heightChange",
|
|
4339
4333
|
payload: { height: _ }
|
|
4340
4334
|
}));
|
|
4341
|
-
},
|
|
4342
|
-
},
|
|
4335
|
+
}, Xn);
|
|
4336
|
+
}, T = (_) => {
|
|
4343
4337
|
if (!n) return;
|
|
4344
4338
|
const u = n.getContent();
|
|
4345
|
-
|
|
4339
|
+
h({
|
|
4346
4340
|
id: _,
|
|
4347
4341
|
type: "editor.content",
|
|
4348
4342
|
payload: u
|
|
4349
|
-
}),
|
|
4343
|
+
}), h({
|
|
4350
4344
|
id: _,
|
|
4351
4345
|
type: "editor.contentChange",
|
|
4352
4346
|
payload: u
|
|
4353
4347
|
});
|
|
4354
|
-
},
|
|
4348
|
+
}, b = (_) => {
|
|
4355
4349
|
const u = _.payload, c = d.get(u.assetId);
|
|
4356
4350
|
if (c) {
|
|
4357
4351
|
if (d.delete(u.assetId), c.source === "uploadAdapter") {
|
|
@@ -4368,14 +4362,14 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4368
4362
|
assetId: u.assetId
|
|
4369
4363
|
});
|
|
4370
4364
|
}
|
|
4371
|
-
},
|
|
4365
|
+
}, y = (_) => {
|
|
4372
4366
|
const u = _.payload, c = d.get(u.assetId);
|
|
4373
4367
|
if (c) {
|
|
4374
4368
|
if (d.delete(u.assetId), c.source === "uploadAdapter") {
|
|
4375
4369
|
c.reject(new Error(u.message));
|
|
4376
4370
|
return;
|
|
4377
4371
|
}
|
|
4378
|
-
|
|
4372
|
+
h({
|
|
4379
4373
|
id: _.id,
|
|
4380
4374
|
type: "editor.error",
|
|
4381
4375
|
payload: {
|
|
@@ -4384,14 +4378,14 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4384
4378
|
}
|
|
4385
4379
|
});
|
|
4386
4380
|
}
|
|
4387
|
-
}, M = (_, u) => new Promise((c,
|
|
4381
|
+
}, M = (_, u) => new Promise((c, p) => {
|
|
4388
4382
|
d.set(u, {
|
|
4389
4383
|
type: _,
|
|
4390
4384
|
assetId: u,
|
|
4391
4385
|
source: "uploadAdapter",
|
|
4392
4386
|
resolve: c,
|
|
4393
|
-
reject:
|
|
4394
|
-
}),
|
|
4387
|
+
reject: p
|
|
4388
|
+
}), h({
|
|
4395
4389
|
type: "editor.uploadRequest",
|
|
4396
4390
|
payload: {
|
|
4397
4391
|
assetId: u,
|
|
@@ -4399,13 +4393,13 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4399
4393
|
accept: _ === "image" ? "image/*" : "video/*"
|
|
4400
4394
|
}
|
|
4401
4395
|
});
|
|
4402
|
-
}),
|
|
4396
|
+
}), m = (_) => {
|
|
4403
4397
|
const u = wc(_);
|
|
4404
4398
|
d.set(u, {
|
|
4405
4399
|
type: _,
|
|
4406
4400
|
assetId: u,
|
|
4407
4401
|
source: "nativePicker"
|
|
4408
|
-
}),
|
|
4402
|
+
}), h({
|
|
4409
4403
|
type: "editor.uploadRequest",
|
|
4410
4404
|
payload: {
|
|
4411
4405
|
assetId: u,
|
|
@@ -4413,36 +4407,36 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4413
4407
|
accept: _ === "image" ? "image/*" : "video/*"
|
|
4414
4408
|
}
|
|
4415
4409
|
});
|
|
4416
|
-
},
|
|
4410
|
+
}, f = (_) => {
|
|
4417
4411
|
const u = i.get(_.payload.requestId);
|
|
4418
4412
|
u && (i.delete(_.payload.requestId), u.request.submit(_.payload.values));
|
|
4419
|
-
},
|
|
4413
|
+
}, E = (_) => {
|
|
4420
4414
|
const u = i.get(_.payload.requestId);
|
|
4421
4415
|
u && (i.delete(_.payload.requestId), u.request.cancel());
|
|
4422
|
-
},
|
|
4416
|
+
}, k = (_, u) => {
|
|
4423
4417
|
n == null || n.destroy(), o == null || o(), d.clear(), i.clear(), n = bc(e, {
|
|
4424
4418
|
...u,
|
|
4425
4419
|
uploadAdapter: {
|
|
4426
|
-
uploadImage(c,
|
|
4427
|
-
return M("image",
|
|
4420
|
+
uploadImage(c, p) {
|
|
4421
|
+
return M("image", p.assetId);
|
|
4428
4422
|
},
|
|
4429
|
-
uploadVideo(c,
|
|
4430
|
-
return M("video",
|
|
4423
|
+
uploadVideo(c, p) {
|
|
4424
|
+
return M("video", p.assetId);
|
|
4431
4425
|
}
|
|
4432
4426
|
},
|
|
4433
4427
|
onContentChange: (c) => {
|
|
4434
|
-
|
|
4428
|
+
h({
|
|
4435
4429
|
type: "editor.contentChange",
|
|
4436
4430
|
payload: c
|
|
4437
4431
|
}), C();
|
|
4438
4432
|
},
|
|
4439
4433
|
onCommandStateChange: (c) => {
|
|
4440
|
-
|
|
4434
|
+
h({
|
|
4441
4435
|
type: "editor.commandStateChange",
|
|
4442
4436
|
payload: c
|
|
4443
4437
|
});
|
|
4444
4438
|
},
|
|
4445
|
-
onPayloadPanelRequest: (c) => (i.set(c.id, { request: c }),
|
|
4439
|
+
onPayloadPanelRequest: (c) => (i.set(c.id, { request: c }), h({
|
|
4446
4440
|
type: "editor.payloadPanelRequest",
|
|
4447
4441
|
payload: {
|
|
4448
4442
|
menuId: c.menuId,
|
|
@@ -4455,24 +4449,24 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4455
4449
|
}
|
|
4456
4450
|
}), !0),
|
|
4457
4451
|
onError: (c) => {
|
|
4458
|
-
|
|
4452
|
+
h({
|
|
4459
4453
|
type: "editor.error",
|
|
4460
4454
|
payload: c
|
|
4461
4455
|
});
|
|
4462
4456
|
}
|
|
4463
4457
|
}), o = n.subscribeCommandStateChange((c) => {
|
|
4464
|
-
|
|
4458
|
+
h({
|
|
4465
4459
|
type: "editor.commandStateChange",
|
|
4466
4460
|
payload: c
|
|
4467
4461
|
});
|
|
4468
|
-
}),
|
|
4462
|
+
}), h(vc(_)), C();
|
|
4469
4463
|
}, I = (_) => {
|
|
4470
4464
|
if (_.type === "media.pickImage") {
|
|
4471
|
-
|
|
4465
|
+
m("image");
|
|
4472
4466
|
return;
|
|
4473
4467
|
}
|
|
4474
4468
|
if (_.type === "media.pickVideo") {
|
|
4475
|
-
|
|
4469
|
+
m("video");
|
|
4476
4470
|
return;
|
|
4477
4471
|
}
|
|
4478
4472
|
n == null || n.executeCommand(_);
|
|
@@ -4480,7 +4474,7 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4480
4474
|
if (!(r || !yc(_)))
|
|
4481
4475
|
switch (_.type) {
|
|
4482
4476
|
case "editor.init":
|
|
4483
|
-
|
|
4477
|
+
k(_.id, _.payload);
|
|
4484
4478
|
return;
|
|
4485
4479
|
case "editor.executeCommand":
|
|
4486
4480
|
I(_.payload);
|
|
@@ -4492,19 +4486,19 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4492
4486
|
n == null || n.setReadonly(_.payload.readonly);
|
|
4493
4487
|
return;
|
|
4494
4488
|
case "editor.requestContent":
|
|
4495
|
-
|
|
4489
|
+
T(_.id);
|
|
4496
4490
|
return;
|
|
4497
4491
|
case "editor.payloadPanelResolved":
|
|
4498
|
-
|
|
4492
|
+
f(_);
|
|
4499
4493
|
return;
|
|
4500
4494
|
case "editor.payloadPanelCanceled":
|
|
4501
|
-
|
|
4495
|
+
E(_);
|
|
4502
4496
|
return;
|
|
4503
4497
|
case "editor.uploadResolved":
|
|
4504
|
-
|
|
4498
|
+
b(_);
|
|
4505
4499
|
return;
|
|
4506
4500
|
case "editor.uploadRejected":
|
|
4507
|
-
|
|
4501
|
+
y(_);
|
|
4508
4502
|
return;
|
|
4509
4503
|
}
|
|
4510
4504
|
};
|
|
@@ -4518,12 +4512,12 @@ const yc = (e) => !Kn(e) || !("id" in e) ? !1 : e.type === "editor.init" || e.ty
|
|
|
4518
4512
|
export {
|
|
4519
4513
|
bc as a,
|
|
4520
4514
|
Hc as b,
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4515
|
+
An as c,
|
|
4516
|
+
Bn as d,
|
|
4517
|
+
Dn as e,
|
|
4518
|
+
W as f,
|
|
4519
|
+
os as g,
|
|
4520
|
+
rs as h,
|
|
4521
|
+
ot as r
|
|
4528
4522
|
};
|
|
4529
|
-
//# sourceMappingURL=index-
|
|
4523
|
+
//# sourceMappingURL=index-DyCMSFrm.js.map
|