@baishuyun/ui-mobile 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AMap/index.js +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/Calendar/{Calendar-Cf81JVOC.js → Calendar-Bs1aP8-o.js} +1 -1
- package/dist/Calendar/index.js +3 -3
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/Editor/{Editor-CZ4Tz-N2.js → Editor-DacCT187.js} +621 -433
- package/dist/Editor/index.js +2 -2
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/{Segmented-CxQ3Pd05.js → Segmented-PwHjDHry.js} +9 -9
- package/dist/Segmented/index.js +2 -2
- package/dist/components/Editor/Thinking.d.ts +1 -3
- package/dist/components/Editor/hooks/useAiPreviewHtml.d.ts +7 -0
- package/dist/components/Editor/hooks/useAutoScroll.d.ts +9 -0
- package/dist/components/Editor/hooks/useEditorAiSession.d.ts +1 -5
- package/dist/components/Editor/interface.d.ts +2 -0
- package/dist/components/Editor/popups/AiResultPopup.d.ts +2 -1
- package/dist/components/Editor/utils/applyAiPolish.d.ts +0 -1
- package/dist/components/Editor/utils/applyAiTypeset.d.ts +4 -0
- package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +3 -1
- package/dist/components/Editor/utils/prepareTypesetProposed.d.ts +1 -0
- package/dist/components/Editor/utils/readEditorAiSnapshot.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/vendors/{version-CMSvw03J.js → version-CTRMhnVV.js} +1 -1
- package/package.json +3 -2
|
@@ -8,10 +8,10 @@ import { useEventListener as h } from "ahooks";
|
|
|
8
8
|
import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
|
|
9
9
|
import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as b, LinkNode as x } from "@lexical/link";
|
|
10
10
|
import { $isListItemNode as S, $isListNode as C, INSERT_ORDERED_LIST_COMMAND as w, INSERT_UNORDERED_LIST_COMMAND as T, ListItemNode as E, ListNode as D, REMOVE_LIST_COMMAND as O } from "@lexical/list";
|
|
11
|
-
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode as j, $plainifyCodeContent as ee, CodeHighlightNode as
|
|
11
|
+
import { $createCodeHighlightNode as k, $isCodeHighlightNode as A, $isCodeNode as j, $plainifyCodeContent as ee, CodeHighlightNode as M, CodeNode as te, registerCodeIndentation as ne } from "@lexical/code-core";
|
|
12
12
|
import { $createHeadingNode as re, $isHeadingNode as ie, HeadingNode as ae } from "@lexical/rich-text";
|
|
13
13
|
import { $findCellNode as oe, $isTableCellNode as se, $isTableNode as N, $isTableRowNode as ce, TableCellNode as le, TableNode as ue, TableRowNode as de, registerTableCellUnmergeTransform as fe, registerTablePlugin as pe, registerTableSelectionObserver as me, setScrollableTablesActive as he } from "@lexical/table";
|
|
14
|
-
import { $applyNodeReplacement as ge, $createLineBreakNode as _e, $createParagraphNode as P, $createTabNode as ve, $createTextNode as ye, $getNodeByKey as
|
|
14
|
+
import { $applyNodeReplacement as ge, $createLineBreakNode as _e, $createParagraphNode as P, $createTabNode as ve, $createTextNode as ye, $getNodeByKey as F, $getRoot as I, $getSelection as L, $insertNodes as be, $isElementNode as xe, $isLineBreakNode as Se, $isRangeSelection as R, $isRootOrShadowRoot as Ce, $isTabNode as we, $isTextNode as Te, $nodesOfType as Ee, $onUpdate as De, $setSelection as Oe, BLUR_COMMAND as ke, COMMAND_PRIORITY_HIGH as Ae, COMMAND_PRIORITY_LOW as je, DROP_COMMAND as Me, DecoratorNode as Ne, FOCUS_COMMAND as Pe, FORMAT_ELEMENT_COMMAND as Fe, FORMAT_TEXT_COMMAND as Ie, HISTORY_MERGE_TAG as Le, INDENT_CONTENT_COMMAND as Re, KEY_ENTER_COMMAND as ze, KEY_TAB_COMMAND as Be, OUTDENT_CONTENT_COMMAND as Ve, PASTE_COMMAND as He, PASTE_TAG as Ue, TextNode as We, isHTMLElement as Ge, mergeRegister as Ke } from "lexical";
|
|
15
15
|
import { ContentEditable as qe } from "@lexical/react/LexicalContentEditable";
|
|
16
16
|
import { HistoryPlugin as Je } from "@lexical/react/LexicalHistoryPlugin";
|
|
17
17
|
import { LinkPlugin as Ye } from "@lexical/react/LexicalLinkPlugin";
|
|
@@ -219,18 +219,123 @@ var st = [
|
|
|
219
219
|
"bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_mpjz5_826",
|
|
220
220
|
"bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_mpjz5_831",
|
|
221
221
|
"bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_mpjz5_853"
|
|
222
|
-
}, _t =
|
|
222
|
+
}, _t = {
|
|
223
|
+
typeset: [
|
|
224
|
+
"你是一名专业的 HTML 文档排版引擎。输入已是 HTML 片段。",
|
|
225
|
+
"任务:在不改内容层(措辞、语序、修辞、情感色彩)的前提下,做形式层 + 视觉层优化,充分利用富文本能力(标题、列表、加粗、字色、背景色、缩进、对齐)。",
|
|
226
|
+
"",
|
|
227
|
+
"【核心原则】",
|
|
228
|
+
"1. 清洁:物理勘误(OCR 误触)、空格/标点治理。",
|
|
229
|
+
"2. 结构:语义化标签(p / h1 / h2 / h3 / ul / ol / 联系方式分行)。",
|
|
230
|
+
"3. 视觉:为标题、小节名、关键词、联系方式、并列项增加加粗、颜色、浅底、缩进。可以新增强调,不要求原文先有引号或加粗。",
|
|
231
|
+
"绝对禁止:重写句子、替换同义词、删改口语词/语气词(如「哈哈」「傻死了」)、调整叙事顺序。",
|
|
232
|
+
"",
|
|
233
|
+
"【允许的排版操作】",
|
|
234
|
+
"1. 断句与分段:",
|
|
235
|
+
" - 无标点连写长句按语义切成短句,切分处可补「。」或「,」。",
|
|
236
|
+
" - 每个独立语义块用 <p> 包裹。",
|
|
237
|
+
" - 不得调换语义块先后顺序;允许同一语义流内断句分段。",
|
|
238
|
+
"2. 标点规范化:",
|
|
239
|
+
" - 「!!!!」→「!」,「。。。」→「。」,「,,,」→「,」。",
|
|
240
|
+
" - 中文语境下「,」→「,」、「.」→「。」;英文缩写、小数、网址、邮箱中的「.」「,」不改。",
|
|
241
|
+
"3. 空格治理:",
|
|
242
|
+
" - 删除汉字之间无意义空格;保留英文词间空格。",
|
|
243
|
+
" - 中英混排时,英文单词前后各留一个半角空格。",
|
|
244
|
+
"4. 物理勘误:",
|
|
245
|
+
" - 仅当上下文能唯一判定时,修正 0/O、1/l/I 等误触。",
|
|
246
|
+
" - 不修正拼写(「监介」必须保留)。",
|
|
247
|
+
"5. 结构标签化:",
|
|
248
|
+
" - 篇名/主标题用 <h1>,小节用 <h2>,更小的小标题用 <h3>。正文用 <p>。一篇里主标题通常只有一个 h1。",
|
|
249
|
+
" - 并列项用 <ul>/<ol> + <li>。",
|
|
250
|
+
" - 联系方式(电话/邮箱/地址)用 <p> 分行,除勘误外不改字符。",
|
|
251
|
+
" - 已有 a / img / table / strong / em / u / s / span 必须保留语义,可调整包裹层级。",
|
|
252
|
+
" - 表格单元格可以排版,不得删改实质内容。",
|
|
253
|
+
"6. 视觉增强(鼓励,且必须用内联 style;禁止 markdown):",
|
|
254
|
+
" - 小节名、分类标签、原文已强调的词:<strong>。禁止 **加粗**、## 标题、- 列表、[text](url)、围栏。",
|
|
255
|
+
" - 标题、关键数字、电话/邮箱:可给 span 加 color。",
|
|
256
|
+
" - 需要扫读的关键词:给 span 加 background-color 浅底。对:<span style=\"background-color:#fff4cd\">关键词</span>。错:<p style=\"background-color:#f0f6ff\">整段</p>。",
|
|
257
|
+
" - 背景色只能写在 span 上(短语级),禁止写在 p / h1-h3 / ul / ol / li。",
|
|
258
|
+
" - 段落/标题缩进只用 padding-inline-start,且必须是 40px 的倍数(与编辑器「增加缩进」一致)。",
|
|
259
|
+
" - 列表缩进只写在 ul/ol 的 padding-inline-start(通常 24px),不要写到 p/li 的 padding。",
|
|
260
|
+
" - 颜色用任意合法 CSS 色值即可(#RGB、#RRGGBB、rgb())。同一篇里主色不超过 2 种强调色,正文保持深色可读。",
|
|
261
|
+
" - span 仅可用于 color / font-size / background-color。",
|
|
262
|
+
" - p / h1-h3 仅可用于 text-align / padding-inline-start。",
|
|
263
|
+
" - 禁止 padding(四边)、padding-top/right/bottom/left、border-radius、margin、box-shadow、border(td/th 除外)。编辑器不能给段落设内边距、圆角或背景色。",
|
|
264
|
+
"",
|
|
265
|
+
"【绝对红线】",
|
|
266
|
+
"- 不得增删实质性单词、数字、年份、名称。",
|
|
267
|
+
"- 不得删除括号、注释、语气词。",
|
|
268
|
+
"- 不得把口语改成书面语。",
|
|
269
|
+
"- 必须原样保留所有 <!--bsy-code-N-->;禁止新增、删除或改写 pre、code、data-language。",
|
|
270
|
+
"- 禁止编造或改写 img 的 src。",
|
|
271
|
+
"",
|
|
272
|
+
"【输出格式】",
|
|
273
|
+
"只输出纯净 HTML 片段。禁止 markdown 围栏(``` / ```html)、xml 声明、解释性前后文。",
|
|
274
|
+
"加粗用 <strong>,主标题用 <h1>,小节用 <h2>/<h3>,列表用 <ul>/<ol>。",
|
|
275
|
+
"允许标签:p, br, h1, h2, h3, ul, ol, li, strong, em, b, i, u, s, span, a, img, table, thead, tbody, tr, td, th, sub, sup。"
|
|
276
|
+
],
|
|
277
|
+
polishSystem: /* @__PURE__ */ "你是多语言语义层编辑引擎,只管「意」,不管「版式」(缩进、字体样式、HTML 标签)。,输入是按块切开的纯文本,可能包含任意语言(中文、英文、日文、代码注释、混合文本)。独立代码块不会出现在输入里。,输出仅润色后的纯文本,不加引号、标签或解释。,,【块结构(必须遵守)】,- 输入用 <!--bsy-block--> 分成若干块。一块对应编辑器里的一个标题或段落,顺序就是阅读顺序。,- 输出必须块数相同、顺序相同,并原样保留 <!--bsy-block-->。,- 禁止把两块合成一块,也禁止把一块拆成两块。,- 整块都是套话:该块输出为空,不要把文字并进前后块。,- 断句、加标点、删字只允许发生在块内。,- 不要跨块交换事实(电话、地址、日期、金额不要挪到别的块)。,- <!--bsy-block--> 不是版式,必须原样保留;分隔符周围的空行也不要删。,,【语言自适应处理】,- 自动识别输入文本的主语言(或混合语言比例)。,- 润色时,仅对该语言的语法、措辞、语气进行优化,绝对不跨语言串改(例如:不要把英文短句改成中文中式英语)。,- 专有名词(人名、地名、品牌名)、年份、固定术语保留原语言原字符,不进行翻译或音译。,,【受保护内容隔离区(绝对红线)】,以下内容不做语序或措辞调整;允许明显的 OCR/键盘字符级勘误(如 0 与 O、1 与 l),不要改空格布局。,1. 数学公式与符号:包括但不限于 = + - * / ^ _ { } ( ) [ ],以及 LaTeX 片段(如 E=mc^2、\\frac{a}{b})。,2. 计量单位与数值:如 10kg、$99.99、2026-08-26、99.9%。,3. 混在正文里的路径、命令、行内代码(如 /usr/bin/python)。独立代码块不在输入中。,4. 邮箱地址、网址(URL)、IP 地址:不要改域名或结构。,5. 化学式(H₂O)、物理量符号(λ、Δ)。,,【标点与断句(特殊允许)】,- 根据检测到的语言使用对应的标准标点(中文用中文标点,英文用英文标点)。,- 允许在块内添加/修改句号、逗号、感叹号、问号,用于断句和表达语气。,- 合并连续重复标点(如「!!!!」→「!」或「!!!!」→「!」)。,,【废话分级删除规则】,- 无意义套话(如「如有雷同纯属巧合」「最终解释权归本公司所有」)→ 直接删除。,- 无具体主体的万能版权模板(如单独一行 All rights reserved)可删;带年份或公司名的版权行保留。,- 冗余语气缓冲词(如「说实话」「我个人觉得」「I think」)→ 仅当语气为 formal / literary 时删除;为 colloquial / lively 时保留。,,【勘误优先级(必读)】,- 第一步:物理勘误(仅限明显的 OCR/键盘误触:如数字 0 写成字母 O、数字 1 写成 l/I,全角英文数字改成半角),直接修正。,- 第二步:措辞润色,但绝不修改第一步修正后的数字、年份、公式符号。,,【风格一致性约束】,- 全篇人称/敬语必须统一(中文:你/您;英文:you 与对应敬语;日文:です/ます调)。,- 禁止改变原文的事实性数据(数字、日期、金额、单位)。".split(","),
|
|
278
|
+
polish: {
|
|
279
|
+
quick: "语气:轻微改通顺,保持原意和人称。\n规则:尽量不改词,仅补充标点和必要连词;保护区原样保留。",
|
|
280
|
+
formal: "语气:更正式、书面(适配任意语言的标准书面体)。\n规则:删除口语词(啊/哦/啦/yeah/well),替换为客观陈述;数字原则上保持阿拉伯数字,不拼写为单词。",
|
|
281
|
+
colloquial: "语气:更口语、自然(适配日常聊天、社交媒体)。\n规则:保留语气词、感叹词,允许短句和不完整句,保留重复强调词(哈哈/haha/すごい)。",
|
|
282
|
+
lively: "语气:更生动、有画面感。\n规则:适当添加形容词和程度副词,但禁止虚构事实数据。",
|
|
283
|
+
literary: "语气:更书面、文学感(适配小说、散文、高级文案)。\n规则:若主语言为中文,允许四字格;若为英文,允许复杂从句和排比;不改变原风格基调。",
|
|
284
|
+
retro: "语气:带一点复古书面色彩,仍保持现代可读。\n规则:仅当主语言为中文时生效:仿民国白话风(之/其/乃);其他语言自动降级为 literary。"
|
|
285
|
+
}
|
|
286
|
+
}, vt = _t.typeset.join("\n"), yt = _t.polishSystem.join("\n"), bt = (e) => `${yt}\n\n【本轮风格】\n${_t.polish[e] ?? _t.polish.quick}`, xt = (e) => {
|
|
287
|
+
if (!e.trim()) return {
|
|
288
|
+
html: e,
|
|
289
|
+
blocks: []
|
|
290
|
+
};
|
|
291
|
+
let t = new DOMParser().parseFromString(e, "text/html"), n = [], r = Array.from(t.body.querySelectorAll("pre"));
|
|
292
|
+
for (let e of r) {
|
|
293
|
+
n.push(e.outerHTML);
|
|
294
|
+
let r = t.createComment(`bsy-code-${n.length - 1}`);
|
|
295
|
+
e.replaceWith(r);
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
html: t.body.innerHTML,
|
|
299
|
+
blocks: n
|
|
300
|
+
};
|
|
301
|
+
}, St = "<!--bsy-block-->", Ct = /<!--bsy-code-(\d+)-->/g, wt = "bsy-html-root", Tt = (e) => new DOMParser().parseFromString(`<${wt}>${e}</${wt}>`, "text/html").body.querySelector(wt), Et = (e, t) => {
|
|
302
|
+
if (!t.length) return e;
|
|
303
|
+
let n = /* @__PURE__ */ new Set(), r = e.replace(Ct, (e, r) => {
|
|
304
|
+
let i = Number(r), a = t[i];
|
|
305
|
+
return a === void 0 ? "" : (n.add(i), a);
|
|
306
|
+
}), i = t.filter((e, t) => !n.has(t)).join("");
|
|
307
|
+
return i ? `${r}${i}` : r;
|
|
308
|
+
}, Dt = (e) => {
|
|
309
|
+
if (!/<pre[\s>/]/i.test(e)) return e;
|
|
310
|
+
let t = Tt(e);
|
|
311
|
+
if (!t) return e;
|
|
312
|
+
let n = t.ownerDocument;
|
|
313
|
+
for (let e of Array.from(t.querySelectorAll("pre"))) {
|
|
314
|
+
let t = n.createComment("bsy-code-dropped");
|
|
315
|
+
e.replaceWith(t);
|
|
316
|
+
}
|
|
317
|
+
return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
|
|
318
|
+
}, Ot = (e, t) => Et(Dt(e), t), kt = "p, h1, h2, h3, li", At = /background(-color)?\s*:/i, jt = (e) => {
|
|
319
|
+
if (!e.trim() || !At.test(e)) return e;
|
|
320
|
+
let t = Tt(e);
|
|
321
|
+
if (!t) return e;
|
|
322
|
+
for (let e of Array.from(t.querySelectorAll(kt))) {
|
|
323
|
+
let t = e;
|
|
324
|
+
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
325
|
+
}
|
|
326
|
+
return t.innerHTML;
|
|
327
|
+
}, Mt = [
|
|
223
328
|
"color",
|
|
224
329
|
"background-color",
|
|
225
330
|
"font-size",
|
|
226
331
|
"font-family",
|
|
227
332
|
"font-weight",
|
|
228
333
|
"text-decoration"
|
|
229
|
-
],
|
|
334
|
+
], Nt = (e) => {
|
|
230
335
|
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
231
336
|
for (let n of Array.from(t)) {
|
|
232
337
|
let t = n, r = [];
|
|
233
|
-
for (let e of
|
|
338
|
+
for (let e of Mt) {
|
|
234
339
|
let n = t.style.getPropertyValue(e);
|
|
235
340
|
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
236
341
|
}
|
|
@@ -248,32 +353,34 @@ var st = [
|
|
|
248
353
|
}
|
|
249
354
|
}
|
|
250
355
|
}
|
|
251
|
-
},
|
|
252
|
-
let n =
|
|
356
|
+
}, Pt = (e, t) => {
|
|
357
|
+
let n = I();
|
|
253
358
|
if (n.clear(), t.trim()) {
|
|
254
359
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
255
|
-
|
|
360
|
+
Nt(r);
|
|
256
361
|
let i = tt(e, r);
|
|
257
362
|
if (i.length) {
|
|
258
|
-
n.select(),
|
|
363
|
+
n.select(), be(i), Oe(null);
|
|
259
364
|
return;
|
|
260
365
|
}
|
|
261
366
|
}
|
|
262
367
|
let r = P();
|
|
263
|
-
n.append(r),
|
|
264
|
-
},
|
|
368
|
+
n.append(r), Oe(null);
|
|
369
|
+
}, Ft = (e) => {
|
|
265
370
|
if (e) {
|
|
266
|
-
|
|
371
|
+
I().selectStart();
|
|
267
372
|
return;
|
|
268
373
|
}
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
|
|
374
|
+
Oe(null);
|
|
375
|
+
}, It = (e) => {
|
|
376
|
+
e && Oe(e.clone());
|
|
377
|
+
}, Lt = () => {
|
|
378
|
+
L() === null && I().selectStart();
|
|
272
379
|
}, H = (e) => {
|
|
273
380
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
274
|
-
|
|
381
|
+
Lt();
|
|
275
382
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
276
|
-
},
|
|
383
|
+
}, Rt = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), zt = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), Bt = [
|
|
277
384
|
"href",
|
|
278
385
|
"src",
|
|
279
386
|
"alt",
|
|
@@ -289,12 +396,12 @@ var st = [
|
|
|
289
396
|
"style",
|
|
290
397
|
"width",
|
|
291
398
|
"height"
|
|
292
|
-
],
|
|
399
|
+
], Vt = new Set(/* @__PURE__ */ "color.background-color.font-size.font-family.font-weight.font-style.text-decoration.text-align.max-width.display.vertical-align.width.height.border.margin.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.position.top.bottom.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), Ht = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, Ut = new Set([
|
|
293
400
|
"pre",
|
|
294
401
|
"code",
|
|
295
402
|
"td",
|
|
296
403
|
"th"
|
|
297
|
-
]),
|
|
404
|
+
]), Wt = new Set(["pre", "code"]), Gt = new Set(["sup", "sub"]), Kt = (e, t) => Vt.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? Ut.has(t) : e === "border-radius" ? Wt.has(t) : e === "position" || e === "top" || e === "bottom" ? Gt.has(t) : !0 : !1, qt = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
298
405
|
let n = e.indexOf(":");
|
|
299
406
|
if (n === -1) return null;
|
|
300
407
|
let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
|
|
@@ -302,30 +409,30 @@ var st = [
|
|
|
302
409
|
if (/url\s*\(/i.test(i)) return null;
|
|
303
410
|
r = "background-color";
|
|
304
411
|
}
|
|
305
|
-
return !
|
|
306
|
-
}).filter((e) => e !== null).join("; "),
|
|
307
|
-
|
|
412
|
+
return !Kt(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
413
|
+
}).filter((e) => e !== null).join("; "), Jt = !1, Yt = () => {
|
|
414
|
+
Jt ||= (nt.addHook("uponSanitizeAttribute", (e, t) => {
|
|
308
415
|
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
309
416
|
t.keepAttr = !1;
|
|
310
417
|
return;
|
|
311
418
|
}
|
|
312
|
-
t.attrName === "style" && (t.attrValue =
|
|
419
|
+
t.attrName === "style" && (t.attrValue = qt(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
|
|
313
420
|
}), !0);
|
|
314
|
-
}, U = (e) => e ? (
|
|
315
|
-
ALLOWED_TAGS:
|
|
316
|
-
ALLOWED_ATTR:
|
|
421
|
+
}, U = (e) => e ? (Yt(), nt.sanitize(e, {
|
|
422
|
+
ALLOWED_TAGS: zt,
|
|
423
|
+
ALLOWED_ATTR: Bt,
|
|
317
424
|
ALLOW_DATA_ATTR: !1,
|
|
318
425
|
ADD_ATTR: [
|
|
319
426
|
"data-language",
|
|
320
427
|
"data-id",
|
|
321
428
|
"data-src"
|
|
322
429
|
],
|
|
323
|
-
ALLOWED_URI_REGEXP:
|
|
430
|
+
ALLOWED_URI_REGEXP: Ht
|
|
324
431
|
})) : "", W = {
|
|
325
432
|
margin: "0.6em 0 0.4em",
|
|
326
433
|
"font-weight": "600",
|
|
327
434
|
"line-height": "1.35"
|
|
328
|
-
},
|
|
435
|
+
}, Xt = {
|
|
329
436
|
h1: {
|
|
330
437
|
...W,
|
|
331
438
|
"font-size": "2em"
|
|
@@ -350,24 +457,24 @@ var st = [
|
|
|
350
457
|
...W,
|
|
351
458
|
"font-size": "0.875em"
|
|
352
459
|
}
|
|
353
|
-
},
|
|
460
|
+
}, Zt = {
|
|
354
461
|
color: "#0269ff",
|
|
355
462
|
cursor: "pointer"
|
|
356
|
-
},
|
|
463
|
+
}, Qt = {
|
|
357
464
|
margin: "0",
|
|
358
465
|
"padding-inline-start": "24px",
|
|
359
466
|
"list-style-position": "outside"
|
|
360
|
-
},
|
|
467
|
+
}, $t = [
|
|
361
468
|
"disc",
|
|
362
469
|
"circle",
|
|
363
470
|
"square"
|
|
364
|
-
],
|
|
471
|
+
], en = {
|
|
365
472
|
margin: "0",
|
|
366
473
|
"list-style": "inherit"
|
|
367
|
-
},
|
|
474
|
+
}, tn = {
|
|
368
475
|
margin: "0",
|
|
369
476
|
"list-style-type": "none"
|
|
370
|
-
},
|
|
477
|
+
}, nn = {
|
|
371
478
|
display: "block",
|
|
372
479
|
"box-sizing": "border-box",
|
|
373
480
|
"max-width": "100%",
|
|
@@ -382,23 +489,23 @@ var st = [
|
|
|
382
489
|
"border-radius": "4px",
|
|
383
490
|
"background-color": "rgb(240, 242, 245)",
|
|
384
491
|
color: "#1f2328"
|
|
385
|
-
},
|
|
492
|
+
}, rn = {
|
|
386
493
|
"border-collapse": "collapse",
|
|
387
494
|
"table-layout": "fixed",
|
|
388
495
|
width: "100%",
|
|
389
496
|
"overflow-x": "auto",
|
|
390
497
|
margin: "8px 0"
|
|
391
|
-
},
|
|
498
|
+
}, an = {
|
|
392
499
|
"box-sizing": "border-box",
|
|
393
500
|
"min-width": "75px",
|
|
394
501
|
"min-height": "32px",
|
|
395
502
|
padding: "4px 8px",
|
|
396
503
|
border: "1px solid #d9d9d9",
|
|
397
504
|
"vertical-align": "top"
|
|
398
|
-
},
|
|
505
|
+
}, on = {
|
|
399
506
|
"font-weight": "600",
|
|
400
507
|
"background-color": "#f2f3f5"
|
|
401
|
-
},
|
|
508
|
+
}, sn = {
|
|
402
509
|
display: "inline-block",
|
|
403
510
|
position: "static",
|
|
404
511
|
top: "auto",
|
|
@@ -407,38 +514,38 @@ var st = [
|
|
|
407
514
|
"line-height": "1"
|
|
408
515
|
}, G = (e, t) => {
|
|
409
516
|
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
410
|
-
},
|
|
517
|
+
}, cn = (e) => {
|
|
411
518
|
let t = 0, n = e;
|
|
412
519
|
for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
|
|
413
520
|
return t;
|
|
414
|
-
},
|
|
521
|
+
}, ln = (e) => {
|
|
415
522
|
for (let t of Array.from(e.querySelectorAll("*"))) {
|
|
416
523
|
if (!(t instanceof HTMLElement)) continue;
|
|
417
|
-
let e = t.tagName.toLowerCase(), n =
|
|
418
|
-
if (n && G(t, n), e === "a" && G(t,
|
|
419
|
-
let e = Math.min(Math.max(
|
|
524
|
+
let e = t.tagName.toLowerCase(), n = Xt[e];
|
|
525
|
+
if (n && G(t, n), e === "a" && G(t, Zt), e === "ul") {
|
|
526
|
+
let e = Math.min(Math.max(cn(t), 1), $t.length);
|
|
420
527
|
G(t, {
|
|
421
|
-
...
|
|
422
|
-
"list-style-type":
|
|
528
|
+
...Qt,
|
|
529
|
+
"list-style-type": $t[e - 1]
|
|
423
530
|
});
|
|
424
531
|
}
|
|
425
532
|
e === "ol" && G(t, {
|
|
426
|
-
...
|
|
533
|
+
...Qt,
|
|
427
534
|
"list-style-type": "decimal"
|
|
428
|
-
}), e === "li" && G(t, t.classList.contains("editor-nested-listitem") ?
|
|
429
|
-
...
|
|
535
|
+
}), e === "li" && G(t, t.classList.contains("editor-nested-listitem") ? tn : en), e === "pre" && G(t, nn), (e === "sup" || e === "sub") && G(t, {
|
|
536
|
+
...sn,
|
|
430
537
|
"vertical-align": e === "sup" ? "super" : "sub"
|
|
431
|
-
}), e === "table" && G(t,
|
|
538
|
+
}), e === "table" && G(t, rn), (e === "td" || e === "th") && (G(t, an), (e === "th" || t.classList.contains("editor-table-cell-header")) && G(t, on)), t.classList.contains("editor-text-underline-strikethrough") ? G(t, { "text-decoration": "underline line-through" }) : t.classList.contains("editor-text-underline") ? G(t, { "text-decoration": "underline" }) : t.classList.contains("editor-text-strikethrough") && G(t, { "text-decoration": "line-through" });
|
|
432
539
|
for (let e of Array.from(t.classList)) e.startsWith("editor-") && t.classList.remove(e);
|
|
433
540
|
t.classList.length === 0 && t.removeAttribute("class");
|
|
434
541
|
}
|
|
435
|
-
},
|
|
542
|
+
}, un = (e) => {
|
|
436
543
|
let t = e.parentNode;
|
|
437
544
|
if (t) {
|
|
438
545
|
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
439
546
|
t.removeChild(e);
|
|
440
547
|
}
|
|
441
|
-
},
|
|
548
|
+
}, dn = (e) => {
|
|
442
549
|
let t = !0;
|
|
443
550
|
for (; t;) {
|
|
444
551
|
t = !1;
|
|
@@ -446,21 +553,21 @@ var st = [
|
|
|
446
553
|
if (n.attributes.length > 0) continue;
|
|
447
554
|
let e = n.tagName.toLowerCase();
|
|
448
555
|
if (e === "span") {
|
|
449
|
-
|
|
556
|
+
un(n), t = !0;
|
|
450
557
|
continue;
|
|
451
558
|
}
|
|
452
559
|
if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
|
|
453
560
|
let r = n.firstElementChild;
|
|
454
|
-
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (
|
|
561
|
+
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (un(n), t = !0);
|
|
455
562
|
}
|
|
456
563
|
}
|
|
457
|
-
},
|
|
564
|
+
}, fn = (e) => {
|
|
458
565
|
if (!e.trim()) return e;
|
|
459
566
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
460
|
-
|
|
567
|
+
ln(t.body), dn(t.body);
|
|
461
568
|
for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
|
|
462
569
|
return t.body.innerHTML;
|
|
463
|
-
},
|
|
570
|
+
}, pn = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", mn = (e) => e.includes("<!--bsy-block-->") ? e.split(St).map((e) => e.trim()) : [e], hn = (e) => e.split(St).join("").trim().length > 0, gn = (e, t) => {
|
|
464
571
|
let n = e.map(() => "");
|
|
465
572
|
if (e.length === 0) return n;
|
|
466
573
|
let r = [], i = [];
|
|
@@ -473,7 +580,7 @@ var st = [
|
|
|
473
580
|
for (; u < s && d < c;) a[u] === o[d] ? (f = r[u], n[f] += o[d], u += 1, d += 1) : l[u + 1][d] >= l[u][d + 1] ? (f = r[u], u += 1) : (n[f] += o[d], d += 1);
|
|
474
581
|
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
475
582
|
return n;
|
|
476
|
-
},
|
|
583
|
+
}, _n = new Set([
|
|
477
584
|
"TABLE",
|
|
478
585
|
"THEAD",
|
|
479
586
|
"TBODY",
|
|
@@ -482,7 +589,7 @@ var st = [
|
|
|
482
589
|
"TH",
|
|
483
590
|
"IMG",
|
|
484
591
|
"BR"
|
|
485
|
-
]),
|
|
592
|
+
]), vn = (e) => {
|
|
486
593
|
let t = [], n = (e) => {
|
|
487
594
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
488
595
|
if (e.tagName === "PRE") return;
|
|
@@ -492,25 +599,25 @@ var st = [
|
|
|
492
599
|
e.nodeType === Node.TEXT_NODE && t.push(e);
|
|
493
600
|
};
|
|
494
601
|
return n(e), t;
|
|
495
|
-
},
|
|
602
|
+
}, yn = (e, t) => {
|
|
496
603
|
let n = e;
|
|
497
|
-
for (; n && n !== t && !
|
|
604
|
+
for (; n && n !== t && !_n.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, table, br");) {
|
|
498
605
|
let e = n.parentElement;
|
|
499
606
|
n.remove(), n = e;
|
|
500
607
|
}
|
|
501
|
-
},
|
|
608
|
+
}, bn = (e) => {
|
|
502
609
|
let t = e.tagName;
|
|
503
610
|
return t === "IMG" || t === "TABLE" || t === "PRE";
|
|
504
|
-
},
|
|
505
|
-
let t =
|
|
506
|
-
return t ? Array.from(t.children).filter((e) => !
|
|
507
|
-
},
|
|
508
|
-
let n =
|
|
611
|
+
}, xn = (e) => {
|
|
612
|
+
let t = Tt(e);
|
|
613
|
+
return t ? Array.from(t.children).filter((e) => !bn(e)).map((e) => e.textContent ?? "") : [];
|
|
614
|
+
}, Sn = (e) => e.includes("<!--bsy-block-->") ? e : pn(e) || e, Cn = (e, t) => {
|
|
615
|
+
let n = vn(e);
|
|
509
616
|
if (n.length === 0) {
|
|
510
617
|
t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
|
|
511
618
|
return;
|
|
512
619
|
}
|
|
513
|
-
let r =
|
|
620
|
+
let r = gn(n.map((e) => e.textContent ?? ""), t);
|
|
514
621
|
for (let t = 0; t < n.length; t++) {
|
|
515
622
|
let i = r[t], a = n[t];
|
|
516
623
|
if (i) {
|
|
@@ -518,60 +625,51 @@ var st = [
|
|
|
518
625
|
continue;
|
|
519
626
|
}
|
|
520
627
|
let o = a.parentElement;
|
|
521
|
-
a.remove(),
|
|
628
|
+
a.remove(), yn(o, e);
|
|
522
629
|
}
|
|
523
|
-
},
|
|
524
|
-
let n =
|
|
525
|
-
if (!
|
|
526
|
-
let r =
|
|
630
|
+
}, wn = (e, t) => {
|
|
631
|
+
let n = Sn(t);
|
|
632
|
+
if (!hn(n) || !e.trim()) return "";
|
|
633
|
+
let r = Tt(e);
|
|
527
634
|
if (!r) return "";
|
|
528
|
-
let i = Array.from(r.children).filter((e) => !
|
|
635
|
+
let i = Array.from(r.children).filter((e) => !bn(e));
|
|
529
636
|
if (i.length === 0) return "";
|
|
530
|
-
let a =
|
|
531
|
-
for (let e = 0; e < i.length; e++)
|
|
637
|
+
let a = mn(n), o = a.length === i.length ? a : gn(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
638
|
+
for (let e = 0; e < i.length; e++) Cn(i[e], o[e] ?? "");
|
|
532
639
|
return r.innerHTML;
|
|
533
|
-
},
|
|
640
|
+
}, Tn = (e, t) => {
|
|
534
641
|
let n = "";
|
|
535
642
|
e.getEditorState().read(() => {
|
|
536
|
-
n =
|
|
643
|
+
n = fn(U(et(e, null)));
|
|
537
644
|
}, { editor: e });
|
|
538
|
-
let r = U(
|
|
539
|
-
return !r.trim() ||
|
|
540
|
-
|
|
645
|
+
let r = U(wn(n, t));
|
|
646
|
+
return !r.trim() || Rt(r, pn(r)) ? !1 : (e.update(() => {
|
|
647
|
+
Pt(e, r), Ft(!0);
|
|
541
648
|
}, { discrete: !0 }), !0);
|
|
542
|
-
},
|
|
543
|
-
let t = "", n = "", r = "";
|
|
544
|
-
return e.getEditorState().read(() => {
|
|
545
|
-
n = F().getTextContent(), t = Yt(U(et(e, null))), r = cn(t).join(`\n\n${Xt}\n\n`);
|
|
546
|
-
}, { editor: e }), {
|
|
547
|
-
html: t,
|
|
548
|
-
text: n,
|
|
549
|
-
polishText: r
|
|
550
|
-
};
|
|
551
|
-
}, mn = /^\uFEFF/, hn = /^ {0,3}`{1,3}[A-Za-z]*$/, gn = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, _n = /^ {0,3}```[ \t]*$/, vn = /<\/?[a-zA-Z]/, yn = /<[a-zA-Z!]/, bn = (e) => yn.test(e), xn = (e) => vn.test(e), Sn = (e) => e.replace(mn, "").replace(/\r\n/g, "\n"), Cn = (e) => {
|
|
649
|
+
}, En = /^\uFEFF/, Dn = /^ {0,3}`{1,3}[A-Za-z]*$/, On = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, kn = /^ {0,3}```[ \t]*$/, An = /<\/?[a-zA-Z]/, jn = /<[a-zA-Z!]/, Mn = (e) => jn.test(e), Nn = (e) => An.test(e), Pn = (e) => e.replace(En, "").replace(/\r\n/g, "\n"), Fn = (e) => {
|
|
552
650
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
553
|
-
return
|
|
651
|
+
return Dn.test(r) ? {
|
|
554
652
|
text: n === -1 ? "" : t.slice(0, n),
|
|
555
653
|
withheld: !0
|
|
556
654
|
} : {
|
|
557
655
|
text: e,
|
|
558
656
|
withheld: !1
|
|
559
657
|
};
|
|
560
|
-
},
|
|
561
|
-
let t =
|
|
658
|
+
}, In = (e) => {
|
|
659
|
+
let t = On.exec(e);
|
|
562
660
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
563
|
-
},
|
|
661
|
+
}, Ln = (e) => {
|
|
564
662
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
565
663
|
return t === e ? e : t;
|
|
566
|
-
},
|
|
664
|
+
}, Rn = (e) => Mn(e) ? e.replace(/^\n/, "") : "", zn = (e) => {
|
|
567
665
|
let t = e.split("\n"), n = [], r = 0;
|
|
568
666
|
for (; r < t.length;) {
|
|
569
|
-
let e = t[r], i =
|
|
667
|
+
let e = t[r], i = In(e);
|
|
570
668
|
if (i) {
|
|
571
669
|
let e = i.sameLineBody;
|
|
572
|
-
if (e !==
|
|
573
|
-
e =
|
|
574
|
-
let i =
|
|
670
|
+
if (e !== Ln(e)) {
|
|
671
|
+
e = Ln(e);
|
|
672
|
+
let i = Rn(t.slice(r + 1).join("\n"));
|
|
575
673
|
return [
|
|
576
674
|
...n,
|
|
577
675
|
e,
|
|
@@ -579,61 +677,92 @@ var st = [
|
|
|
579
677
|
].filter(Boolean).join("\n");
|
|
580
678
|
}
|
|
581
679
|
let a = [];
|
|
582
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
583
|
-
let o = r < t.length ?
|
|
680
|
+
for (e && a.push(e), r += 1; r < t.length && !kn.test(t[r]);) a.push(t[r]), r += 1;
|
|
681
|
+
let o = r < t.length ? Rn(t.slice(r + 1).join("\n")) : "";
|
|
584
682
|
return [
|
|
585
683
|
...n,
|
|
586
684
|
a.join("\n"),
|
|
587
685
|
o
|
|
588
686
|
].filter(Boolean).join("\n");
|
|
589
687
|
}
|
|
590
|
-
if (
|
|
591
|
-
|
|
688
|
+
if (Nn(e)) return Bn([...n, ...t.slice(r)].join("\n"));
|
|
689
|
+
Mn(e) && n.push(e), r += 1;
|
|
592
690
|
}
|
|
593
691
|
return n.length ? n.join("\n") : null;
|
|
594
|
-
},
|
|
692
|
+
}, Bn = (e) => {
|
|
595
693
|
let t = e.split("\n");
|
|
596
694
|
if (!t.length) return e;
|
|
597
|
-
let n =
|
|
598
|
-
return n && !
|
|
599
|
-
},
|
|
695
|
+
let n = In(t[0]);
|
|
696
|
+
return n && !Nn(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Ln(n.sameLineBody))), t.length && kn.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
697
|
+
}, Vn = (e) => {
|
|
600
698
|
if (!e) return {
|
|
601
699
|
html: "",
|
|
602
700
|
pending: !1
|
|
603
701
|
};
|
|
604
|
-
let { text: t, withheld: n } =
|
|
702
|
+
let { text: t, withheld: n } = Fn(Pn(e));
|
|
605
703
|
if (!t.trim()) return {
|
|
606
704
|
html: "",
|
|
607
|
-
pending: n ||
|
|
705
|
+
pending: n || Dn.test(Pn(e).trim())
|
|
608
706
|
};
|
|
609
|
-
let r =
|
|
707
|
+
let r = zn(t) ?? t, i = zn(r);
|
|
610
708
|
i !== null && i !== r && (r = i);
|
|
611
709
|
let a = r.trim();
|
|
612
|
-
return
|
|
710
|
+
return Mn(a) ? {
|
|
613
711
|
html: a,
|
|
614
712
|
pending: !1
|
|
615
713
|
} : {
|
|
616
714
|
html: "",
|
|
617
715
|
pending: !0
|
|
618
716
|
};
|
|
619
|
-
},
|
|
717
|
+
}, Hn = (e, t) => {
|
|
718
|
+
let { html: n } = Vn(e);
|
|
719
|
+
return n ? jt(Ot(n, t)) : "";
|
|
720
|
+
};
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region src/components/Editor/utils/applyAiTypeset.ts
|
|
723
|
+
function Un(e, t, n) {
|
|
724
|
+
let r = U(Hn(t, n));
|
|
725
|
+
return !r.trim() || Rt(r, "") ? { applied: !1 } : (e.update(() => {
|
|
726
|
+
Pt(e, r), Ft(!0);
|
|
727
|
+
}, { discrete: !0 }), { applied: !0 });
|
|
728
|
+
}
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/components/Editor/utils/readEditorAiSnapshot.ts
|
|
731
|
+
var Wn = (e) => {
|
|
732
|
+
let t = "", n = "", r = "";
|
|
733
|
+
e.getEditorState().read(() => {
|
|
734
|
+
n = I().getTextContent(), t = fn(U(et(e, null))), r = xn(t).join(`\n\n${St}\n\n`);
|
|
735
|
+
}, { editor: e });
|
|
736
|
+
let i = xt(t);
|
|
737
|
+
return {
|
|
738
|
+
html: t,
|
|
739
|
+
text: n,
|
|
740
|
+
polishText: r,
|
|
741
|
+
htmlWithoutCode: i.html,
|
|
742
|
+
codeBlocks: i.blocks
|
|
743
|
+
};
|
|
744
|
+
}, Gn = ({ editor: e, ai: t }) => {
|
|
620
745
|
let n = u(t);
|
|
621
746
|
n.current = t;
|
|
622
747
|
let [r, i] = d(null), [a, o] = d({
|
|
623
748
|
html: "",
|
|
624
749
|
text: "",
|
|
625
|
-
polishText: ""
|
|
750
|
+
polishText: "",
|
|
751
|
+
htmlWithoutCode: "",
|
|
752
|
+
codeBlocks: []
|
|
626
753
|
}), [s, c] = d("quick"), l = () => {
|
|
627
|
-
let t =
|
|
754
|
+
let t = Wn(e);
|
|
628
755
|
o(t), i("typeset"), n.current?.typeset?.({
|
|
629
|
-
html: t.
|
|
630
|
-
text: t.text
|
|
756
|
+
html: t.htmlWithoutCode,
|
|
757
|
+
text: t.text,
|
|
758
|
+
prompt: vt
|
|
631
759
|
});
|
|
632
760
|
}, f = (t) => {
|
|
633
|
-
let r =
|
|
761
|
+
let r = Wn(e);
|
|
634
762
|
o(r), c(t), i("polish"), n.current?.stop?.(), n.current?.polish?.({
|
|
635
763
|
text: r.polishText,
|
|
636
|
-
preset: t
|
|
764
|
+
preset: t,
|
|
765
|
+
prompt: bt(t)
|
|
637
766
|
});
|
|
638
767
|
}, p = () => {
|
|
639
768
|
n.current?.stop?.(), i(null);
|
|
@@ -647,18 +776,11 @@ var st = [
|
|
|
647
776
|
close: p,
|
|
648
777
|
apply: () => {
|
|
649
778
|
let t = n.current?.text ?? "";
|
|
650
|
-
|
|
651
|
-
let n = U(kn(t).html);
|
|
652
|
-
if (!n.trim()) return;
|
|
653
|
-
e.update(() => {
|
|
654
|
-
yt(e, n), bt(!0);
|
|
655
|
-
});
|
|
656
|
-
} else r === "polish" && fn(e, t);
|
|
657
|
-
p();
|
|
779
|
+
r === "typeset" ? Un(e, t, a.codeBlocks) : r === "polish" && Tn(e, t), p();
|
|
658
780
|
}
|
|
659
781
|
};
|
|
660
|
-
},
|
|
661
|
-
let a = o(
|
|
782
|
+
}, Kn = i({}), K = 36, qn = 14, Jn = 2 * Math.PI * qn, Yn = ({ nodeKey: e, src: t, altText: n, dataId: r, dataSrc: i }) => {
|
|
783
|
+
let a = o(Kn), s = e in a, c = a[e];
|
|
662
784
|
return /* @__PURE__ */ m("span", {
|
|
663
785
|
className: V["bsy-mobile-editor__image"],
|
|
664
786
|
children: [/* @__PURE__ */ p("img", {
|
|
@@ -682,26 +804,26 @@ var st = [
|
|
|
682
804
|
children: [/* @__PURE__ */ p("circle", {
|
|
683
805
|
cx: K / 2,
|
|
684
806
|
cy: K / 2,
|
|
685
|
-
r:
|
|
807
|
+
r: qn,
|
|
686
808
|
fill: "none",
|
|
687
809
|
stroke: "rgba(255,255,255,0.35)",
|
|
688
810
|
strokeWidth: "3"
|
|
689
811
|
}), /* @__PURE__ */ p("circle", {
|
|
690
812
|
cx: K / 2,
|
|
691
813
|
cy: K / 2,
|
|
692
|
-
r:
|
|
814
|
+
r: qn,
|
|
693
815
|
fill: "none",
|
|
694
816
|
stroke: "#fff",
|
|
695
817
|
strokeWidth: "3",
|
|
696
818
|
strokeLinecap: "round",
|
|
697
|
-
strokeDasharray: c === void 0 ? `${
|
|
698
|
-
strokeDashoffset: c === void 0 ? 0 :
|
|
819
|
+
strokeDasharray: c === void 0 ? `${Jn * .25} ${Jn}` : Jn,
|
|
820
|
+
strokeDashoffset: c === void 0 ? 0 : Jn * (1 - c / 100),
|
|
699
821
|
transform: `rotate(-90 ${K / 2} ${K / 2})`
|
|
700
822
|
})]
|
|
701
823
|
})
|
|
702
824
|
}) : null]
|
|
703
825
|
});
|
|
704
|
-
},
|
|
826
|
+
}, Xn = class e extends Ne {
|
|
705
827
|
__src;
|
|
706
828
|
__altText;
|
|
707
829
|
__width;
|
|
@@ -741,13 +863,13 @@ var st = [
|
|
|
741
863
|
}
|
|
742
864
|
static importDOM() {
|
|
743
865
|
return { img: () => ({
|
|
744
|
-
conversion:
|
|
866
|
+
conversion: $n,
|
|
745
867
|
priority: 0
|
|
746
868
|
}) };
|
|
747
869
|
}
|
|
748
870
|
static importJSON(e) {
|
|
749
871
|
let { src: t, altText: n, width: r, height: i, dataId: a, dataSrc: o } = e;
|
|
750
|
-
return
|
|
872
|
+
return Qn({
|
|
751
873
|
src: t,
|
|
752
874
|
altText: n,
|
|
753
875
|
width: r,
|
|
@@ -772,7 +894,7 @@ var st = [
|
|
|
772
894
|
return !0;
|
|
773
895
|
}
|
|
774
896
|
decorate() {
|
|
775
|
-
return /* @__PURE__ */ p(
|
|
897
|
+
return /* @__PURE__ */ p(Yn, {
|
|
776
898
|
nodeKey: this.getKey(),
|
|
777
899
|
src: this.__src,
|
|
778
900
|
altText: this.__altText,
|
|
@@ -780,7 +902,7 @@ var st = [
|
|
|
780
902
|
dataSrc: this.__dataSrc
|
|
781
903
|
});
|
|
782
904
|
}
|
|
783
|
-
},
|
|
905
|
+
}, Zn = (e) => e instanceof Xn, Qn = ({ src: e, altText: t, width: n, height: r, dataId: i, dataSrc: a, key: o }) => new Xn(e, t, n, r, o, i, a), $n = (e) => {
|
|
784
906
|
if (!(e instanceof HTMLImageElement)) return null;
|
|
785
907
|
let { src: t, alt: n, style: r } = e, i, a;
|
|
786
908
|
if (r.width) {
|
|
@@ -791,7 +913,7 @@ var st = [
|
|
|
791
913
|
let e = parseInt(r.height, 10);
|
|
792
914
|
Number.isNaN(e) || (a = e);
|
|
793
915
|
}
|
|
794
|
-
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node:
|
|
916
|
+
return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: Qn({
|
|
795
917
|
src: t,
|
|
796
918
|
altText: n,
|
|
797
919
|
width: i,
|
|
@@ -799,7 +921,7 @@ var st = [
|
|
|
799
921
|
dataId: e.getAttribute("data-id") || void 0,
|
|
800
922
|
dataSrc: e.getAttribute("data-src") || void 0
|
|
801
923
|
}) };
|
|
802
|
-
},
|
|
924
|
+
}, er = (e) => mt.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), tr = (e) => er(e) ? e.size > 5242880 ? "size" : null : "type", nr = ({ editor: e, upload: t, savedSelectionRef: n, attachmentsBySrc: r }) => {
|
|
803
925
|
let i = u(null), o = u(null), c = u(!0), [l, f] = d({}), p = a(() => {
|
|
804
926
|
o.current?.abort(), o.current = null;
|
|
805
927
|
}, []);
|
|
@@ -809,15 +931,14 @@ var st = [
|
|
|
809
931
|
let m = a((t, r, i) => {
|
|
810
932
|
let a = "";
|
|
811
933
|
return e.update(() => {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
let o = Ln({
|
|
934
|
+
It(n.current), L() === null && I().selectEnd();
|
|
935
|
+
let e = Qn({
|
|
815
936
|
src: t,
|
|
816
937
|
altText: r,
|
|
817
938
|
dataSrc: i
|
|
818
939
|
});
|
|
819
|
-
a =
|
|
820
|
-
for (let
|
|
940
|
+
a = e.getKey(), be([e]);
|
|
941
|
+
for (let t of e.getParent()?.getChildren() ?? []) Te(t) && t.getTextContentSize() === 0 && t.remove();
|
|
821
942
|
}), a;
|
|
822
943
|
}, [e, n]);
|
|
823
944
|
return {
|
|
@@ -826,7 +947,7 @@ var st = [
|
|
|
826
947
|
insertImage: m,
|
|
827
948
|
onFileChange: a(async (n) => {
|
|
828
949
|
let i = n.target.files?.[0];
|
|
829
|
-
if (n.target.value = "", !i ||
|
|
950
|
+
if (n.target.value = "", !i || tr(i)) return;
|
|
830
951
|
p();
|
|
831
952
|
let a = new AbortController();
|
|
832
953
|
if (o.current = a, !t?.customRequest) {
|
|
@@ -851,7 +972,7 @@ var st = [
|
|
|
851
972
|
}));
|
|
852
973
|
let u = !1, d = (t) => {
|
|
853
974
|
u || (u = !0, URL.revokeObjectURL(s), t || e.update(() => {
|
|
854
|
-
|
|
975
|
+
F(l)?.remove();
|
|
855
976
|
}, c.current ? void 0 : { discrete: !0 }), c.current && f((e) => {
|
|
856
977
|
let t = { ...e };
|
|
857
978
|
return delete t[l], t;
|
|
@@ -880,8 +1001,8 @@ var st = [
|
|
|
880
1001
|
return;
|
|
881
1002
|
}
|
|
882
1003
|
e.update(() => {
|
|
883
|
-
let e =
|
|
884
|
-
|
|
1004
|
+
let e = F(l);
|
|
1005
|
+
Zn(e) && (e.setSrc(o), s && e.setDataId(s));
|
|
885
1006
|
}), d(!0);
|
|
886
1007
|
} catch {
|
|
887
1008
|
d(!1);
|
|
@@ -895,13 +1016,13 @@ var st = [
|
|
|
895
1016
|
]),
|
|
896
1017
|
abortUpload: p
|
|
897
1018
|
};
|
|
898
|
-
},
|
|
1019
|
+
}, rr = ({ editor: e, savedSelectionRef: t, captureSelection: n }) => {
|
|
899
1020
|
let [r, i] = d(null);
|
|
900
1021
|
return {
|
|
901
1022
|
linkForm: r,
|
|
902
1023
|
openLink: () => {
|
|
903
1024
|
n(), e.getEditorState().read(() => {
|
|
904
|
-
let e =
|
|
1025
|
+
let e = L(), t = R(e) ? e.anchor.getNode() : null, n = t ? B(t, v) : null;
|
|
905
1026
|
if (n) {
|
|
906
1027
|
i({
|
|
907
1028
|
url: n.getURL(),
|
|
@@ -912,7 +1033,7 @@ var st = [
|
|
|
912
1033
|
}
|
|
913
1034
|
i({
|
|
914
1035
|
url: "",
|
|
915
|
-
text:
|
|
1036
|
+
text: R(e) ? e.getTextContent() : "",
|
|
916
1037
|
newBlank: !0
|
|
917
1038
|
});
|
|
918
1039
|
});
|
|
@@ -922,42 +1043,41 @@ var st = [
|
|
|
922
1043
|
if (!r) return;
|
|
923
1044
|
let a = r.startsWith("@") || /^https?:\/\//.test(r) ? r : `http://${r}`;
|
|
924
1045
|
e.update(() => {
|
|
925
|
-
|
|
926
|
-
e
|
|
927
|
-
let r = I(), i = n.newBlank ? {
|
|
1046
|
+
It(t.current);
|
|
1047
|
+
let e = L(), r = n.newBlank ? {
|
|
928
1048
|
target: "_blank",
|
|
929
1049
|
rel: "noopener noreferrer",
|
|
930
1050
|
title: n.url
|
|
931
1051
|
} : { title: n.url };
|
|
932
|
-
if (
|
|
933
|
-
let
|
|
934
|
-
if (
|
|
1052
|
+
if (R(e)) {
|
|
1053
|
+
let t = n.text.trim() || n.url;
|
|
1054
|
+
if (e.getTextContent()) y(a, r);
|
|
935
1055
|
else {
|
|
936
|
-
let
|
|
937
|
-
|
|
1056
|
+
let n = ye(t), i = _(a, r);
|
|
1057
|
+
i.append(n), e.insertNodes([i]);
|
|
938
1058
|
}
|
|
939
1059
|
} else {
|
|
940
|
-
let e = ye(n.text.trim() || n.url), t = _(a,
|
|
1060
|
+
let e = ye(n.text.trim() || n.url), t = _(a, r);
|
|
941
1061
|
t.append(e);
|
|
942
|
-
let
|
|
943
|
-
if (
|
|
1062
|
+
let i = I(), o = i.getLastChild();
|
|
1063
|
+
if (xe(o)) o.append(t);
|
|
944
1064
|
else {
|
|
945
1065
|
let e = P();
|
|
946
|
-
e.append(t),
|
|
1066
|
+
e.append(t), i.append(e);
|
|
947
1067
|
}
|
|
948
1068
|
}
|
|
949
1069
|
}), i(null);
|
|
950
1070
|
},
|
|
951
1071
|
closeLink: () => i(null)
|
|
952
1072
|
};
|
|
953
|
-
},
|
|
1073
|
+
}, ir = ({ editor: e, value: t, onChange: n, attachmentsBySrc: r }) => {
|
|
954
1074
|
let i = u(null), o = u(n);
|
|
955
1075
|
o.current = n;
|
|
956
1076
|
let c = a((t) => {
|
|
957
1077
|
t.read(() => {
|
|
958
|
-
let n =
|
|
1078
|
+
let n = I().getTextContent(), a = fn(U(et(e, null))), s = Rt(a, n) ? null : a;
|
|
959
1079
|
i.current = s;
|
|
960
|
-
let c =
|
|
1080
|
+
let c = Ee(Xn).map((e) => r.get(e.getSrc())).filter((e) => e !== void 0);
|
|
961
1081
|
o.current({
|
|
962
1082
|
text: n,
|
|
963
1083
|
html: s,
|
|
@@ -967,7 +1087,7 @@ var st = [
|
|
|
967
1087
|
}, [r, e]);
|
|
968
1088
|
return s(() => {
|
|
969
1089
|
t === void 0 || t === i.current || (i.current = t ?? null, e.update(() => {
|
|
970
|
-
|
|
1090
|
+
Pt(e, t?.trim() ? U(t) : ""), Ft(!!e.getRootElement()?.contains(document.activeElement));
|
|
971
1091
|
}, { onUpdate: () => {
|
|
972
1092
|
e.getRootElement() || c(e.getEditorState());
|
|
973
1093
|
} }));
|
|
@@ -976,13 +1096,13 @@ var st = [
|
|
|
976
1096
|
c,
|
|
977
1097
|
t
|
|
978
1098
|
]), c;
|
|
979
|
-
},
|
|
1099
|
+
}, ar = 250, or = () => {
|
|
980
1100
|
let [e] = z(), t = u(0);
|
|
981
1101
|
return s(() => e.registerCommand(ze, (e) => {
|
|
982
1102
|
let n = Date.now(), r = n - t.current;
|
|
983
|
-
if (t.current = n, r <= 0 || r >=
|
|
984
|
-
let i =
|
|
985
|
-
if (!
|
|
1103
|
+
if (t.current = n, r <= 0 || r >= ar) return !1;
|
|
1104
|
+
let i = L();
|
|
1105
|
+
if (!R(i) || !i.isCollapsed()) return !1;
|
|
986
1106
|
let a = i.anchor.getNode();
|
|
987
1107
|
if (B(a, S)) return !1;
|
|
988
1108
|
let o = a.getTopLevelElement();
|
|
@@ -1000,7 +1120,7 @@ var st = [
|
|
|
1000
1120
|
let c = s.getPreviousSibling();
|
|
1001
1121
|
return c?.getTextContent().trim() === "" && c.remove(), e?.preventDefault(), !0;
|
|
1002
1122
|
}, je), [e]), null;
|
|
1003
|
-
},
|
|
1123
|
+
}, sr = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), cr = () => {
|
|
1004
1124
|
let [e] = z();
|
|
1005
1125
|
return s(() => e.registerNodeTransform(ae, (e) => {
|
|
1006
1126
|
let t = e.getTag();
|
|
@@ -1011,7 +1131,7 @@ var st = [
|
|
|
1011
1131
|
for (let t of e.getAllTextNodes()) {
|
|
1012
1132
|
let e = t.getStyle();
|
|
1013
1133
|
if (!e) continue;
|
|
1014
|
-
let n =
|
|
1134
|
+
let n = sr(e, "font-size");
|
|
1015
1135
|
n !== e && t.setStyle(n);
|
|
1016
1136
|
}
|
|
1017
1137
|
}), [e]), null;
|
|
@@ -1053,12 +1173,12 @@ var st = [
|
|
|
1053
1173
|
};
|
|
1054
1174
|
}
|
|
1055
1175
|
static importJSON(e) {
|
|
1056
|
-
return
|
|
1176
|
+
return lr().updateFromJSON(e);
|
|
1057
1177
|
}
|
|
1058
1178
|
isSimpleText() {
|
|
1059
1179
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
1060
1180
|
}
|
|
1061
|
-
},
|
|
1181
|
+
}, lr = (e = "") => ge(new q(e)), J = (e) => (t) => {
|
|
1062
1182
|
let n = e?.(t);
|
|
1063
1183
|
if (!n) return null;
|
|
1064
1184
|
let r = n.conversion(t);
|
|
@@ -1068,7 +1188,7 @@ var st = [
|
|
|
1068
1188
|
...r,
|
|
1069
1189
|
forChild: (e, t) => {
|
|
1070
1190
|
let n = (r?.forChild ?? ((e) => e))(e, t);
|
|
1071
|
-
if (
|
|
1191
|
+
if (Te(n)) {
|
|
1072
1192
|
let e = [
|
|
1073
1193
|
i ? `background-color: ${i}` : null,
|
|
1074
1194
|
a ? `color: ${a}` : null,
|
|
@@ -1082,33 +1202,33 @@ var st = [
|
|
|
1082
1202
|
return n;
|
|
1083
1203
|
}
|
|
1084
1204
|
};
|
|
1085
|
-
},
|
|
1205
|
+
}, ur = () => {
|
|
1086
1206
|
let [e] = z();
|
|
1087
1207
|
return s(() => e.registerNodeTransform(q, (e) => {
|
|
1088
1208
|
if (!B(e, v)) return;
|
|
1089
1209
|
let t = e.getStyle();
|
|
1090
1210
|
if (!t) return;
|
|
1091
|
-
let n =
|
|
1211
|
+
let n = sr(t, "color");
|
|
1092
1212
|
n !== t && e.setStyle(n);
|
|
1093
1213
|
}), [e]), null;
|
|
1094
|
-
},
|
|
1214
|
+
}, dr = /<img\b|<picture\b/i, fr = () => {
|
|
1095
1215
|
let [e] = z();
|
|
1096
1216
|
return s(() => {
|
|
1097
1217
|
let t = (t) => {
|
|
1098
1218
|
let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
|
|
1099
1219
|
if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
|
|
1100
1220
|
let r = n.getData("text/html");
|
|
1101
|
-
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) ||
|
|
1221
|
+
if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || dr.test(r))) return !1;
|
|
1102
1222
|
t.preventDefault();
|
|
1103
1223
|
let i = n.getData("text/plain");
|
|
1104
|
-
return !
|
|
1105
|
-
let t =
|
|
1224
|
+
return !dr.test(r) && !i || e.update(() => {
|
|
1225
|
+
let t = L();
|
|
1106
1226
|
if (t === null) return;
|
|
1107
1227
|
let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
|
|
1108
1228
|
if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
|
|
1109
1229
|
let t = tt(e, n);
|
|
1110
1230
|
if (t.length) {
|
|
1111
|
-
|
|
1231
|
+
be(t);
|
|
1112
1232
|
return;
|
|
1113
1233
|
}
|
|
1114
1234
|
}
|
|
@@ -1117,18 +1237,18 @@ var st = [
|
|
|
1117
1237
|
};
|
|
1118
1238
|
return rt(e.registerCommand(He, t, Ae), e.registerCommand(Me, t, Ae));
|
|
1119
1239
|
}, [e]), null;
|
|
1120
|
-
},
|
|
1240
|
+
}, pr = "data:image/png;base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qMPN9j/lP75g93rAQdGgMSrN6kgGmwO8P/gIZTwGScoUD19QpTajfHtv1KF+50CQTgjyHB8oy/FRZFdKkOJ/rH0XvFcTqxnuXzF1WTBP/g//ryWzQSZJh+J7y/vNAaHwMncIDaOHwedyAHyd5x/3JbvO4bK9/+x81+uH6gGaCzd5oQqhTfJbpa0L6jN9IuR3Z7nmkS+L4MKfykqOH9ToJ1LrZ81YfHJ+KzxUBAg8edtf2std5fDavtbvZPGDBdga508P7dGeVYeaQ5yxcndavPp1cEhjJVHWou5h4YAjbeIinyoPSP2nue/yFlpf9b/euXJ69DujDD/iy+1JkqHjoBeIfOMPtYElswTzq6av2s+//OHWwk4UCe4H5DJUqofpVwONXaEgo8YzOHqsYH4EtlnTgM0+COFl26gyD5hiLPIizPicP2fKkc4whGOcCjwKViIGaRSStOhAAAAAElFTkSuQmCC", hr = (e, t, n) => Math.min(n, Math.max(t, e)), Y = (e) => hr(e, 0, 1), X = (e) => {
|
|
1121
1241
|
let t = e.trim().toLowerCase();
|
|
1122
1242
|
if (t === "" || t === "transparent") return !0;
|
|
1123
1243
|
let n = t.match(/^rgba\([^,]+,[^,]+,[^,]+,\s*([.\d]+)\s*\)$/);
|
|
1124
1244
|
return n !== null && Number(n[1]) === 0;
|
|
1125
|
-
},
|
|
1245
|
+
}, gr = (e) => {
|
|
1126
1246
|
let t = e.trim().replace(/^#/, "");
|
|
1127
1247
|
return /^[0-9a-fA-F]{3}$/.test(t) ? `#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`.toLowerCase() : /^[0-9a-fA-F]{6}$/.test(t) ? `#${t.toLowerCase()}` : null;
|
|
1128
|
-
},
|
|
1248
|
+
}, _r = (e) => {
|
|
1129
1249
|
let t = e.trim();
|
|
1130
1250
|
if (X(t)) return null;
|
|
1131
|
-
let n =
|
|
1251
|
+
let n = gr(t);
|
|
1132
1252
|
if (n) return {
|
|
1133
1253
|
r: Number.parseInt(n.slice(1, 3), 16),
|
|
1134
1254
|
g: Number.parseInt(n.slice(3, 5), 16),
|
|
@@ -1140,59 +1260,59 @@ var st = [
|
|
|
1140
1260
|
g: Number(r[2]),
|
|
1141
1261
|
b: Number(r[3])
|
|
1142
1262
|
} : null;
|
|
1143
|
-
},
|
|
1263
|
+
}, vr = ({ r: e, g: t, b: n }) => `#${[
|
|
1144
1264
|
e,
|
|
1145
1265
|
t,
|
|
1146
1266
|
n
|
|
1147
|
-
].map((e) =>
|
|
1267
|
+
].map((e) => hr(Math.round(e), 0, 255).toString(16).padStart(2, "0")).join("")}`, yr = (e, t) => {
|
|
1148
1268
|
if (X(e) && X(t)) return !0;
|
|
1149
|
-
let n =
|
|
1269
|
+
let n = _r(e), r = _r(t);
|
|
1150
1270
|
return !!(n && r && n.r === r.r && n.g === r.g && n.b === r.b);
|
|
1151
|
-
},
|
|
1271
|
+
}, br = (e) => {
|
|
1152
1272
|
let t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.max(t, n, r), a = Math.min(t, n, r), o = (i + a) / 2, s = i - a, c = 0;
|
|
1153
1273
|
return s !== 0 && (c = i === t ? ((n - r) / s + (n < r ? 6 : 0)) * 60 : i === n ? ((r - t) / s + 2) * 60 : ((t - n) / s + 4) * 60), {
|
|
1154
1274
|
h: c,
|
|
1155
1275
|
s: s === 0 ? 0 : s / (1 - Math.abs(2 * o - 1)),
|
|
1156
1276
|
l: o
|
|
1157
1277
|
};
|
|
1158
|
-
},
|
|
1278
|
+
}, xr = ({ h: e, s: t, l: n }) => {
|
|
1159
1279
|
let r = (e % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(r / 60 % 2 - 1)), o = n - i / 2, s = 0, c = 0, l = 0;
|
|
1160
1280
|
return r < 60 ? (s = i, c = a) : r < 120 ? (s = a, c = i) : r < 180 ? (c = i, l = a) : r < 240 ? (c = a, l = i) : r < 300 ? (s = a, l = i) : (s = i, l = a), {
|
|
1161
1281
|
r: Math.round((s + o) * 255),
|
|
1162
1282
|
g: Math.round((c + o) * 255),
|
|
1163
1283
|
b: Math.round((l + o) * 255)
|
|
1164
1284
|
};
|
|
1165
|
-
},
|
|
1285
|
+
}, Sr = (e) => vr(xr(e)), Cr = (e, t) => ({
|
|
1166
1286
|
h: Y(e) * 360,
|
|
1167
1287
|
s: 1,
|
|
1168
1288
|
l: Y(1 - t)
|
|
1169
|
-
}),
|
|
1289
|
+
}), wr = (e) => ({
|
|
1170
1290
|
x: Y((e.h % 360 + 360) % 360 / 360),
|
|
1171
1291
|
y: Y(1 - e.l)
|
|
1172
|
-
}),
|
|
1292
|
+
}), Tr = (e, t, n) => ({
|
|
1173
1293
|
x: Y(n.width === 0 ? 0 : (e - n.left) / n.width),
|
|
1174
1294
|
y: Y(n.height === 0 ? 0 : (t - n.top) / n.height)
|
|
1175
|
-
}),
|
|
1176
|
-
let r =
|
|
1295
|
+
}), Er = (e, t, n = Infinity) => {
|
|
1296
|
+
let r = _r(t);
|
|
1177
1297
|
if (!r) return e;
|
|
1178
|
-
let i =
|
|
1179
|
-
return [i, ...e.filter((e) => !
|
|
1180
|
-
},
|
|
1298
|
+
let i = vr(r);
|
|
1299
|
+
return [i, ...e.filter((e) => !yr(e, i))].slice(0, n);
|
|
1300
|
+
}, Dr = (e, t = 24, n = 8) => Math.max(0, Math.floor((e + n) / (t + n))), Or = (e, t) => {
|
|
1181
1301
|
let n = t % 11;
|
|
1182
1302
|
return Math.floor(t / 11) === 2 ? e[22] ?? e[t] : e[n] ?? e[t];
|
|
1183
|
-
}, Z = (...e) => e.filter(Boolean).join(" "),
|
|
1184
|
-
let t =
|
|
1303
|
+
}, Z = (...e) => e.filter(Boolean).join(" "), kr = (e) => {
|
|
1304
|
+
let t = _r(e) ?? {
|
|
1185
1305
|
r: 0,
|
|
1186
1306
|
g: 94,
|
|
1187
1307
|
b: 239
|
|
1188
1308
|
};
|
|
1189
1309
|
return {
|
|
1190
|
-
color:
|
|
1191
|
-
point:
|
|
1310
|
+
color: vr(t),
|
|
1311
|
+
point: wr(br(t))
|
|
1192
1312
|
};
|
|
1193
|
-
},
|
|
1194
|
-
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() =>
|
|
1195
|
-
_(
|
|
1313
|
+
}, Ar = ({ mode: t, currentColor: r, customColors: i, onApply: a, onCustomDraftChange: o, onCustomConfirm: c }) => {
|
|
1314
|
+
let { t: l } = e(), [f, h] = d("presets"), [g, _] = d(() => kr(r)), [v, y] = d(!1), [b, x] = d(null), S = u(null), C = u(null), w = u(null), T = (e = r) => {
|
|
1315
|
+
_(kr(e)), y(!1), o(null), h("custom");
|
|
1196
1316
|
};
|
|
1197
1317
|
s(() => {
|
|
1198
1318
|
if (f !== "custom" || typeof ResizeObserver > "u") return;
|
|
@@ -1221,7 +1341,7 @@ var st = [
|
|
|
1221
1341
|
if (!e) return;
|
|
1222
1342
|
let t = () => {
|
|
1223
1343
|
let t = e.getBoundingClientRect().width;
|
|
1224
|
-
t > 0 && x(
|
|
1344
|
+
t > 0 && x(Dr(t));
|
|
1225
1345
|
};
|
|
1226
1346
|
if (t(), typeof ResizeObserver > "u") return;
|
|
1227
1347
|
let n = new ResizeObserver(t);
|
|
@@ -1230,7 +1350,7 @@ var st = [
|
|
|
1230
1350
|
let E = (e) => {
|
|
1231
1351
|
let t = S.current;
|
|
1232
1352
|
if (!t) return;
|
|
1233
|
-
let { x: n, y: r } =
|
|
1353
|
+
let { x: n, y: r } = Tr(e.clientX, e.clientY, t.getBoundingClientRect()), i = Sr(Cr(n, r));
|
|
1234
1354
|
_({
|
|
1235
1355
|
color: i,
|
|
1236
1356
|
point: {
|
|
@@ -1269,7 +1389,7 @@ var st = [
|
|
|
1269
1389
|
role: "listbox",
|
|
1270
1390
|
"aria-label": l("editor.customColors"),
|
|
1271
1391
|
children: i.slice(0, b ?? i.length).map((e) => {
|
|
1272
|
-
let t =
|
|
1392
|
+
let t = yr(r, e);
|
|
1273
1393
|
return /* @__PURE__ */ p("button", {
|
|
1274
1394
|
type: "button",
|
|
1275
1395
|
role: "option",
|
|
@@ -1347,7 +1467,7 @@ var st = [
|
|
|
1347
1467
|
role: "listbox",
|
|
1348
1468
|
"aria-label": l("editor.presetColors"),
|
|
1349
1469
|
children: ut.map((e, t) => {
|
|
1350
|
-
let n =
|
|
1470
|
+
let n = yr(r, e);
|
|
1351
1471
|
return /* @__PURE__ */ p("button", {
|
|
1352
1472
|
type: "button",
|
|
1353
1473
|
role: "option",
|
|
@@ -1356,7 +1476,7 @@ var st = [
|
|
|
1356
1476
|
className: Z(V["bsy-mobile-editor__color-swatch"], n && V["bsy-mobile-editor__color-swatch--selected"]),
|
|
1357
1477
|
style: {
|
|
1358
1478
|
"--swatch-color": e,
|
|
1359
|
-
"--swatch-ring":
|
|
1479
|
+
"--swatch-ring": Or(ut, t)
|
|
1360
1480
|
},
|
|
1361
1481
|
onClick: () => a(e),
|
|
1362
1482
|
children: /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__color-swatch-fill"] })
|
|
@@ -1366,19 +1486,19 @@ var st = [
|
|
|
1366
1486
|
A
|
|
1367
1487
|
]
|
|
1368
1488
|
});
|
|
1369
|
-
},
|
|
1489
|
+
}, jr = (e, t) => {
|
|
1370
1490
|
H(e), e.update(() => {
|
|
1371
|
-
ot(
|
|
1491
|
+
ot(L(), () => t === "paragraph" ? P() : re(t));
|
|
1372
1492
|
});
|
|
1373
|
-
},
|
|
1493
|
+
}, Mr = (e, t, n) => {
|
|
1374
1494
|
H(e), e.update(() => {
|
|
1375
|
-
|
|
1376
|
-
let e =
|
|
1495
|
+
It(n), Lt();
|
|
1496
|
+
let e = L();
|
|
1377
1497
|
e && at(e, t);
|
|
1378
1498
|
});
|
|
1379
|
-
},
|
|
1499
|
+
}, Nr = ({ sheet: i, onClose: a, onTypeset: o, onPolishMenu: s, onPickPreset: c, onPicture: l, savedSelectionRef: h, committedColors: g, onColorCommit: _, canTypeset: v, canPolish: y }) => {
|
|
1380
1500
|
let [b] = z(), { t: x } = e(), [S, C] = d([]), w = u(null), T = i === "fontColor" || i === "fill" ? i : null, E = T === "fill" ? g.fill : T === "fontColor" ? g.fontColor : ct, D = (e, t = !1, n = !0) => {
|
|
1381
|
-
T && (n && (w.current = null),
|
|
1501
|
+
T && (n && (w.current = null), Mr(b, { [T === "fill" ? "background-color" : "color"]: e }, h.current), _(T, e), t && !X(e) && C((t) => Er(t, e)), n && a());
|
|
1382
1502
|
}, O = (e) => {
|
|
1383
1503
|
w.current = null, D(e, !0, !1);
|
|
1384
1504
|
};
|
|
@@ -1441,7 +1561,7 @@ var st = [
|
|
|
1441
1561
|
text: x("editor.heading3")
|
|
1442
1562
|
}
|
|
1443
1563
|
],
|
|
1444
|
-
onAction: (e) =>
|
|
1564
|
+
onAction: (e) => jr(b, e.key)
|
|
1445
1565
|
}),
|
|
1446
1566
|
/* @__PURE__ */ p(r, {
|
|
1447
1567
|
mode: "menu",
|
|
@@ -1452,7 +1572,7 @@ var st = [
|
|
|
1452
1572
|
key: e.value,
|
|
1453
1573
|
text: e.label
|
|
1454
1574
|
})),
|
|
1455
|
-
onAction: (e) =>
|
|
1575
|
+
onAction: (e) => Mr(b, { "font-size": e.key })
|
|
1456
1576
|
}),
|
|
1457
1577
|
/* @__PURE__ */ p(t, {
|
|
1458
1578
|
open: T !== null,
|
|
@@ -1461,7 +1581,7 @@ var st = [
|
|
|
1461
1581
|
e && O(e), a();
|
|
1462
1582
|
},
|
|
1463
1583
|
position: "bottom",
|
|
1464
|
-
children: T ? /* @__PURE__ */ p(
|
|
1584
|
+
children: T ? /* @__PURE__ */ p(Ar, {
|
|
1465
1585
|
mode: T,
|
|
1466
1586
|
currentColor: E,
|
|
1467
1587
|
customColors: S,
|
|
@@ -1481,7 +1601,7 @@ var st = [
|
|
|
1481
1601
|
text: x("editor.aiTypeset"),
|
|
1482
1602
|
disabled: !v,
|
|
1483
1603
|
icon: /* @__PURE__ */ p("img", {
|
|
1484
|
-
src:
|
|
1604
|
+
src: pr,
|
|
1485
1605
|
alt: "",
|
|
1486
1606
|
width: 16,
|
|
1487
1607
|
height: 16,
|
|
@@ -1493,7 +1613,7 @@ var st = [
|
|
|
1493
1613
|
text: x("editor.aiPolish"),
|
|
1494
1614
|
disabled: !y,
|
|
1495
1615
|
icon: /* @__PURE__ */ p("img", {
|
|
1496
|
-
src:
|
|
1616
|
+
src: mr,
|
|
1497
1617
|
alt: "",
|
|
1498
1618
|
width: 16,
|
|
1499
1619
|
height: 16,
|
|
@@ -1543,7 +1663,7 @@ var st = [
|
|
|
1543
1663
|
onAction: (e) => l(e.key)
|
|
1544
1664
|
})
|
|
1545
1665
|
] });
|
|
1546
|
-
},
|
|
1666
|
+
}, Pr = ({ open: r, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
|
|
1547
1667
|
let { t: l } = e();
|
|
1548
1668
|
return /* @__PURE__ */ p(t, {
|
|
1549
1669
|
open: r,
|
|
@@ -1588,11 +1708,11 @@ var st = [
|
|
|
1588
1708
|
]
|
|
1589
1709
|
})
|
|
1590
1710
|
});
|
|
1591
|
-
},
|
|
1711
|
+
}, Fr = ({ open: t, seed: r, onClose: i, onConfirm: a }) => {
|
|
1592
1712
|
let { t: o } = e(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
|
|
1593
1713
|
return s(() => {
|
|
1594
1714
|
!t || !r || (l(r.url), f(r.text), g(r.newBlank));
|
|
1595
|
-
}, [t, r]), /* @__PURE__ */ m(
|
|
1715
|
+
}, [t, r]), /* @__PURE__ */ m(Pr, {
|
|
1596
1716
|
open: t,
|
|
1597
1717
|
title: o("editor.link"),
|
|
1598
1718
|
bodyClassName: V["bsy-mobile-editor__sheet-body--stack"],
|
|
@@ -1654,13 +1774,13 @@ var st = [
|
|
|
1654
1774
|
})
|
|
1655
1775
|
]
|
|
1656
1776
|
});
|
|
1657
|
-
},
|
|
1777
|
+
}, Ir = /^https?:\/\/.+/i, Lr = ({ open: t, onClose: n, onConfirm: r }) => {
|
|
1658
1778
|
let { t: i } = e(), [o, c] = d(""), [l, u] = d(null), f = a((e) => {
|
|
1659
1779
|
e?.focus();
|
|
1660
1780
|
}, []);
|
|
1661
1781
|
return s(() => {
|
|
1662
1782
|
t && (c(""), u(null));
|
|
1663
|
-
}, [t]), /* @__PURE__ */ p(
|
|
1783
|
+
}, [t]), /* @__PURE__ */ p(Pr, {
|
|
1664
1784
|
open: t,
|
|
1665
1785
|
title: i("editor.imageUrl"),
|
|
1666
1786
|
onClose: n,
|
|
@@ -1670,7 +1790,7 @@ var st = [
|
|
|
1670
1790
|
u(i("editor.imageUrlRequired"));
|
|
1671
1791
|
return;
|
|
1672
1792
|
}
|
|
1673
|
-
if (!
|
|
1793
|
+
if (!Ir.test(e)) {
|
|
1674
1794
|
u(i("editor.imageUrlInvalid"));
|
|
1675
1795
|
return;
|
|
1676
1796
|
}
|
|
@@ -1703,7 +1823,7 @@ var st = [
|
|
|
1703
1823
|
]
|
|
1704
1824
|
})
|
|
1705
1825
|
});
|
|
1706
|
-
},
|
|
1826
|
+
}, Rr = "\n:host {\n all: initial;\n display: block;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n}\n.bsy-editor-html-preview__body {\n color: #030303;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;\n font-size: 15px;\n line-height: 1.6;\n word-break: break-word;\n}\n.bsy-editor-html-preview__body p {\n margin: 0;\n}\n.bsy-editor-html-preview__body .editor-text-bold {\n font-weight: 700;\n}\n.bsy-editor-html-preview__body .editor-text-italic {\n font-style: italic;\n}\n.bsy-editor-html-preview__body .editor-text-underline {\n text-decoration: underline;\n}\n.bsy-editor-html-preview__body .editor-text-strikethrough {\n text-decoration: line-through;\n}\n.bsy-editor-html-preview__body .editor-text-underline-strikethrough {\n text-decoration: underline line-through;\n}\n.bsy-editor-html-preview__body sup,\n.bsy-editor-html-preview__body sub {\n display: inline-block;\n position: static;\n top: auto;\n bottom: auto;\n font-size: 0.75em;\n line-height: 1;\n}\n.bsy-editor-html-preview__body sup {\n vertical-align: super;\n}\n.bsy-editor-html-preview__body sub {\n vertical-align: sub;\n}\n.bsy-editor-html-preview__body .editor-heading-h1,\n.bsy-editor-html-preview__body .editor-heading-h2,\n.bsy-editor-html-preview__body .editor-heading-h3 {\n margin: 0.6em 0 0.4em;\n font-weight: 600;\n line-height: 1.35;\n}\n.bsy-editor-html-preview__body .editor-heading-h1 {\n font-size: 2em;\n}\n.bsy-editor-html-preview__body .editor-heading-h2 {\n font-size: 1.5em;\n}\n.bsy-editor-html-preview__body .editor-heading-h3 {\n font-size: 1.25em;\n}\n.bsy-editor-html-preview__body .editor-list-ul,\n.bsy-editor-html-preview__body .editor-list-ol {\n margin: 0;\n padding-inline-start: 24px;\n list-style-position: outside;\n}\n.bsy-editor-html-preview__body .editor-list-ul {\n list-style-type: disc;\n}\n.bsy-editor-html-preview__body .editor-list-ol {\n list-style-type: decimal;\n}\n.bsy-editor-html-preview__body .editor-listitem {\n margin: 0;\n list-style: inherit;\n}\n.bsy-editor-html-preview__body .editor-nested-listitem {\n list-style-type: none;\n}\n.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul {\n list-style-type: circle;\n}\n.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul .editor-list-ul {\n list-style-type: square;\n}\n.bsy-editor-html-preview__body .editor-link,\n.bsy-editor-html-preview__body .editor-link:link,\n.bsy-editor-html-preview__body .editor-link:visited,\n.bsy-editor-html-preview__body .editor-link:hover,\n.bsy-editor-html-preview__body .editor-link:active,\n.bsy-editor-html-preview__body .editor-link:focus {\n color: #0269ff;\n cursor: pointer;\n}\n.bsy-editor-html-preview__body .editor-link * {\n color: #0269ff !important;\n}\n.bsy-editor-html-preview__body pre {\n display: block;\n box-sizing: border-box;\n max-width: 100%;\n margin: 8px 0;\n padding: 8px 12px;\n overflow-x: auto;\n border-radius: 4px;\n background: rgb(240, 242, 245);\n color: #1f2328;\n font-family: Menlo, Consolas, Monaco, monospace;\n font-size: 13px;\n line-height: 1.53;\n tab-size: 2;\n white-space: pre;\n}\n.bsy-editor-html-preview__body .editor-table-scrollable-wrapper {\n max-width: 100%;\n margin: 8px 0;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n}\n.bsy-editor-html-preview__body table {\n width: max-content;\n min-width: 100%;\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.bsy-editor-html-preview__body td,\n.bsy-editor-html-preview__body th {\n box-sizing: border-box;\n min-width: 75px;\n min-height: 32px;\n padding: 4px 8px;\n border: 1px solid #d9d9d9;\n vertical-align: top;\n}\n.bsy-editor-html-preview__body th {\n background: #f2f3f5;\n font-weight: 600;\n}\n.bsy-editor-html-preview__body img {\n max-width: 100%;\n height: auto;\n vertical-align: baseline;\n}\n", zr = ({ html: e }) => {
|
|
1707
1827
|
let t = u(null);
|
|
1708
1828
|
return l(() => {
|
|
1709
1829
|
let n = t.current;
|
|
@@ -1717,12 +1837,12 @@ var st = [
|
|
|
1717
1837
|
}
|
|
1718
1838
|
r.replaceChildren();
|
|
1719
1839
|
let a = document.createElement("style");
|
|
1720
|
-
a.textContent =
|
|
1840
|
+
a.textContent = Rr, r.append(a, i);
|
|
1721
1841
|
}, [e]), /* @__PURE__ */ p("div", {
|
|
1722
1842
|
ref: t,
|
|
1723
1843
|
className: "bsy-editor-html-preview"
|
|
1724
1844
|
});
|
|
1725
|
-
},
|
|
1845
|
+
}, Br = () => {
|
|
1726
1846
|
let e = `${c().replace(/:/g, "")}g`;
|
|
1727
1847
|
return /* @__PURE__ */ p("span", {
|
|
1728
1848
|
className: V["bsy-mobile-editor__ai-think-icon"],
|
|
@@ -1761,57 +1881,32 @@ var st = [
|
|
|
1761
1881
|
}) })]
|
|
1762
1882
|
})
|
|
1763
1883
|
});
|
|
1764
|
-
},
|
|
1765
|
-
let { t:
|
|
1884
|
+
}, Vr = (t, n) => {
|
|
1885
|
+
let { t: r } = e(), i = t.status === "loading" && !n, [a, o] = d(!0), [c, l] = d(0), f = u(Date.now()), p = u(null), m = t.reasoning ?? "";
|
|
1766
1886
|
return s(() => {
|
|
1767
|
-
if (!
|
|
1768
|
-
|
|
1887
|
+
if (!i) {
|
|
1888
|
+
p.current === null && (p.current = Math.max(1, Math.round((Date.now() - f.current) / 1e3)), l(p.current)), o(!1);
|
|
1769
1889
|
return;
|
|
1770
1890
|
}
|
|
1771
|
-
|
|
1891
|
+
f.current = Date.now(), p.current = null, o(!0);
|
|
1772
1892
|
let e = window.setInterval(() => {
|
|
1773
|
-
|
|
1893
|
+
l(Math.max(1, Math.round((Date.now() - f.current) / 1e3)));
|
|
1774
1894
|
}, 500);
|
|
1775
1895
|
return () => window.clearInterval(e);
|
|
1776
|
-
}, [
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
let e = r.current;
|
|
1784
|
-
!e || !v.current || (v.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (_.current = !0));
|
|
1785
|
-
}, {
|
|
1786
|
-
target: b,
|
|
1787
|
-
passive: !0,
|
|
1788
|
-
enable: o
|
|
1789
|
-
}), s(() => {
|
|
1790
|
-
if (!o || _.current || !r.current) return;
|
|
1791
|
-
let e = window.requestAnimationFrame(() => {
|
|
1792
|
-
if (_.current) return;
|
|
1793
|
-
let e = r.current;
|
|
1794
|
-
e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
|
|
1795
|
-
});
|
|
1796
|
-
return () => window.cancelAnimationFrame(e);
|
|
1797
|
-
}, [
|
|
1798
|
-
y,
|
|
1799
|
-
r,
|
|
1800
|
-
o
|
|
1801
|
-
]), {
|
|
1802
|
-
visible: (o || !!y) && !(t.status === "error" && !y),
|
|
1803
|
-
thinking: o,
|
|
1804
|
-
open: o || c,
|
|
1805
|
-
label: o ? i("editor.aiThinking") : i("editor.aiThoughtSeconds", { seconds: f }),
|
|
1806
|
-
reasoning: y,
|
|
1807
|
-
toggle: () => l((e) => !e)
|
|
1896
|
+
}, [i]), {
|
|
1897
|
+
visible: (i || !!m) && !(t.status === "error" && !m),
|
|
1898
|
+
thinking: i,
|
|
1899
|
+
open: i || a,
|
|
1900
|
+
label: i ? r("editor.aiThinking") : r("editor.aiThoughtSeconds", { seconds: c }),
|
|
1901
|
+
reasoning: m,
|
|
1902
|
+
toggle: () => o((e) => !e)
|
|
1808
1903
|
};
|
|
1809
|
-
},
|
|
1904
|
+
}, Hr = ({ model: e }) => /* @__PURE__ */ m("button", {
|
|
1810
1905
|
type: "button",
|
|
1811
1906
|
className: V["bsy-mobile-editor__ai-think-head"],
|
|
1812
1907
|
disabled: e.thinking,
|
|
1813
1908
|
onClick: e.toggle,
|
|
1814
|
-
children: [e.thinking ? /* @__PURE__ */ p(
|
|
1909
|
+
children: [e.thinking ? /* @__PURE__ */ p(Br, {}) : /* @__PURE__ */ p(n, {
|
|
1815
1910
|
name: "arrow-down",
|
|
1816
1911
|
size: 12,
|
|
1817
1912
|
className: [V["bsy-mobile-editor__ai-think-arrow"], e.open ? V["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
|
|
@@ -1819,17 +1914,108 @@ var st = [
|
|
|
1819
1914
|
className: e.thinking ? `${V["bsy-mobile-editor__ai-think-label"]} ${V["bsy-mobile-editor__ai-think-label--shimmer"]}` : V["bsy-mobile-editor__ai-think-label"],
|
|
1820
1915
|
children: e.label
|
|
1821
1916
|
})]
|
|
1822
|
-
}),
|
|
1917
|
+
}), Ur = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
|
|
1823
1918
|
className: V["bsy-mobile-editor__ai-think-body"],
|
|
1824
1919
|
children: e.reasoning
|
|
1825
|
-
}),
|
|
1826
|
-
let
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1920
|
+
}), Wr = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
1921
|
+
let [i, a] = d(""), o = u(r);
|
|
1922
|
+
o.current = r;
|
|
1923
|
+
let c = u(null);
|
|
1924
|
+
return l(() => {
|
|
1925
|
+
let n = () => {
|
|
1926
|
+
c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
|
|
1927
|
+
};
|
|
1928
|
+
if (!e) {
|
|
1929
|
+
n(), a("");
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
let r = () => {
|
|
1933
|
+
c.current = null, a(o.current());
|
|
1934
|
+
};
|
|
1935
|
+
if (t === "ready" || t === "error") {
|
|
1936
|
+
n(), r();
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
c.current === null && (c.current = requestAnimationFrame(r));
|
|
1940
|
+
}, [
|
|
1941
|
+
e,
|
|
1942
|
+
n,
|
|
1943
|
+
t
|
|
1944
|
+
]), s(() => () => {
|
|
1945
|
+
c.current !== null && cancelAnimationFrame(c.current);
|
|
1946
|
+
}, []), i;
|
|
1947
|
+
}, Gr = 32, Kr = .25, qr = 2, Jr = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
1948
|
+
let r = u(!0), i = u(!1), o = u(0), c = a(() => e.current ?? void 0, [e]), l = a(() => {
|
|
1949
|
+
o.current = 0;
|
|
1950
|
+
let t = e.current;
|
|
1951
|
+
if (!t || !r.current) return;
|
|
1952
|
+
let n = Math.max(0, t.scrollHeight - t.clientHeight), i = n - t.scrollTop;
|
|
1953
|
+
if (i <= 1) {
|
|
1954
|
+
t.scrollTop = n;
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
t.scrollTop += Math.max(i * Kr, Math.min(i, qr)), o.current = requestAnimationFrame(l);
|
|
1958
|
+
}, [e]), d = a(() => {
|
|
1959
|
+
!o.current && r.current && (o.current = requestAnimationFrame(l));
|
|
1960
|
+
}, [l]);
|
|
1961
|
+
s(() => {
|
|
1962
|
+
if (!t) {
|
|
1963
|
+
r.current = !0, i.current = !1, cancelAnimationFrame(o.current), o.current = 0;
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
d();
|
|
1967
|
+
}, [
|
|
1968
|
+
t,
|
|
1969
|
+
n,
|
|
1970
|
+
d
|
|
1971
|
+
]), s(() => {
|
|
1972
|
+
let n = e.current;
|
|
1973
|
+
if (!t || !n || typeof ResizeObserver > "u") return;
|
|
1974
|
+
let r = new ResizeObserver(d);
|
|
1975
|
+
return r.observe(n), n.firstElementChild && r.observe(n.firstElementChild), () => r.disconnect();
|
|
1976
|
+
}, [
|
|
1977
|
+
t,
|
|
1978
|
+
d,
|
|
1979
|
+
e
|
|
1980
|
+
]), s(() => () => cancelAnimationFrame(o.current), []);
|
|
1981
|
+
let f = () => {
|
|
1982
|
+
let t = e.current;
|
|
1983
|
+
if (!t) return;
|
|
1984
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= Gr;
|
|
1985
|
+
i.current ? (i.current = !1, r.current = n, !n && o.current && (cancelAnimationFrame(o.current), o.current = 0)) : n && (r.current = !0);
|
|
1986
|
+
}, p = () => {
|
|
1987
|
+
i.current = !0;
|
|
1988
|
+
};
|
|
1989
|
+
return h("wheel", p, {
|
|
1990
|
+
target: c,
|
|
1991
|
+
passive: !0,
|
|
1992
|
+
enable: t
|
|
1993
|
+
}), h("touchstart", p, {
|
|
1994
|
+
target: c,
|
|
1995
|
+
passive: !0,
|
|
1996
|
+
enable: t
|
|
1997
|
+
}), h("scroll", f, {
|
|
1998
|
+
target: c,
|
|
1999
|
+
passive: !0,
|
|
2000
|
+
enable: t
|
|
2001
|
+
}), { onScroll: f };
|
|
2002
|
+
}, Yr = ({ open: i, mode: a, originalHtml: o, codeBlocks: s = [], ai: c, polishPreset: l, onClose: h, onApply: g, onPickPreset: _ }) => {
|
|
2003
|
+
let { t: v } = e(), y = u(null), [b, x] = d(!1), S = c?.status ?? "idle", C = c?.text ?? "", w = Wr({
|
|
2004
|
+
enabled: i && !!a,
|
|
2005
|
+
status: S,
|
|
2006
|
+
revision: C,
|
|
2007
|
+
compute: () => a === "polish" ? U(wn(o, C)) : Hn(C, s)
|
|
2008
|
+
}), T = !!w.trim(), E = Vr({
|
|
2009
|
+
status: S,
|
|
2010
|
+
reasoning: c?.reasoning
|
|
2011
|
+
}, T), D = Jr({
|
|
2012
|
+
viewportRef: y,
|
|
2013
|
+
enabled: i && S === "loading",
|
|
2014
|
+
revision: `${c?.reasoning ?? ""}\0${w}`
|
|
2015
|
+
}), O = S === "ready" && T;
|
|
1830
2016
|
return /* @__PURE__ */ m(t, {
|
|
1831
2017
|
open: i,
|
|
1832
|
-
onClose:
|
|
2018
|
+
onClose: h,
|
|
1833
2019
|
position: "bottom",
|
|
1834
2020
|
closeOnClickOverlay: !1,
|
|
1835
2021
|
children: [/* @__PURE__ */ m("div", {
|
|
@@ -1840,12 +2026,12 @@ var st = [
|
|
|
1840
2026
|
className: V["bsy-mobile-editor__header"],
|
|
1841
2027
|
children: [/* @__PURE__ */ p("div", {
|
|
1842
2028
|
className: V["bsy-mobile-editor__title"],
|
|
1843
|
-
children:
|
|
2029
|
+
children: v(a === "polish" ? "editor.aiPolish" : "editor.aiTypeset")
|
|
1844
2030
|
}), /* @__PURE__ */ p("button", {
|
|
1845
2031
|
type: "button",
|
|
1846
2032
|
className: V["bsy-mobile-editor__close"],
|
|
1847
|
-
"aria-label":
|
|
1848
|
-
onClick:
|
|
2033
|
+
"aria-label": v("popup.close"),
|
|
2034
|
+
onClick: h,
|
|
1849
2035
|
children: /* @__PURE__ */ p(n, {
|
|
1850
2036
|
name: "close",
|
|
1851
2037
|
size: 18
|
|
@@ -1862,28 +2048,29 @@ var st = [
|
|
|
1862
2048
|
className: V["bsy-mobile-editor__ai-section-head"],
|
|
1863
2049
|
children: [/* @__PURE__ */ m("div", {
|
|
1864
2050
|
className: `${V["bsy-mobile-editor__ai-label"]} ${V["bsy-mobile-editor__ai-label--after"]}`,
|
|
1865
|
-
children: [/* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__ai-dot"] }),
|
|
2051
|
+
children: [/* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__ai-dot"] }), v("editor.aiOptimized")]
|
|
1866
2052
|
}), a === "polish" ? /* @__PURE__ */ m("button", {
|
|
1867
2053
|
type: "button",
|
|
1868
2054
|
className: V["bsy-mobile-editor__ai-preset"],
|
|
1869
|
-
onClick: () =>
|
|
1870
|
-
children: [
|
|
2055
|
+
onClick: () => x(!0),
|
|
2056
|
+
children: [v(ft[l]), /* @__PURE__ */ p(n, {
|
|
1871
2057
|
name: "arrow-down",
|
|
1872
2058
|
size: 16
|
|
1873
2059
|
})]
|
|
1874
2060
|
}) : null]
|
|
1875
2061
|
}),
|
|
1876
|
-
|
|
2062
|
+
E.visible ? /* @__PURE__ */ p("div", {
|
|
1877
2063
|
className: V["bsy-mobile-editor__ai-think-pin"],
|
|
1878
|
-
children: /* @__PURE__ */ p(
|
|
2064
|
+
children: /* @__PURE__ */ p(Hr, { model: E })
|
|
1879
2065
|
}) : null,
|
|
1880
2066
|
/* @__PURE__ */ p("div", {
|
|
1881
|
-
ref:
|
|
2067
|
+
ref: y,
|
|
1882
2068
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
1883
|
-
|
|
2069
|
+
onScroll: D.onScroll,
|
|
2070
|
+
children: S === "error" ? /* @__PURE__ */ p("p", {
|
|
1884
2071
|
className: V["bsy-mobile-editor__ai-error"],
|
|
1885
|
-
children:
|
|
1886
|
-
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
2072
|
+
children: c?.errorMessage || v("editor.aiError")
|
|
2073
|
+
}) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Ur, { model: E }), T ? /* @__PURE__ */ p(zr, { html: w }) : null] })
|
|
1887
2074
|
})
|
|
1888
2075
|
]
|
|
1889
2076
|
}),
|
|
@@ -1894,11 +2081,11 @@ var st = [
|
|
|
1894
2081
|
className: V["bsy-mobile-editor__ai-section-head"],
|
|
1895
2082
|
children: /* @__PURE__ */ m("div", {
|
|
1896
2083
|
className: `${V["bsy-mobile-editor__ai-label"]} ${V["bsy-mobile-editor__ai-label--before"]}`,
|
|
1897
|
-
children: [/* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__ai-dot"] }),
|
|
2084
|
+
children: [/* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__ai-dot"] }), v("editor.aiOriginal")]
|
|
1898
2085
|
})
|
|
1899
2086
|
}), /* @__PURE__ */ p("div", {
|
|
1900
2087
|
className: V["bsy-mobile-editor__ai-section-scroll"],
|
|
1901
|
-
children: /* @__PURE__ */ p(
|
|
2088
|
+
children: /* @__PURE__ */ p(zr, { html: o })
|
|
1902
2089
|
})]
|
|
1903
2090
|
})
|
|
1904
2091
|
]
|
|
@@ -1907,51 +2094,51 @@ var st = [
|
|
|
1907
2094
|
className: V["bsy-mobile-editor__ai-footer"],
|
|
1908
2095
|
children: [/* @__PURE__ */ p("button", {
|
|
1909
2096
|
type: "button",
|
|
1910
|
-
onClick:
|
|
1911
|
-
children:
|
|
2097
|
+
onClick: h,
|
|
2098
|
+
children: v("editor.aiAbandon")
|
|
1912
2099
|
}), /* @__PURE__ */ p("button", {
|
|
1913
2100
|
type: "button",
|
|
1914
2101
|
className: V["bsy-mobile-editor__ai-footer-ok"],
|
|
1915
|
-
disabled: !
|
|
1916
|
-
onClick:
|
|
1917
|
-
children:
|
|
2102
|
+
disabled: !O,
|
|
2103
|
+
onClick: g,
|
|
2104
|
+
children: v("editor.aiApply")
|
|
1918
2105
|
})]
|
|
1919
2106
|
})
|
|
1920
2107
|
]
|
|
1921
2108
|
}), a === "polish" ? /* @__PURE__ */ p(r, {
|
|
1922
2109
|
mode: "menu",
|
|
1923
|
-
open:
|
|
1924
|
-
title:
|
|
1925
|
-
onClose: () =>
|
|
2110
|
+
open: b,
|
|
2111
|
+
title: v("editor.aiPolish"),
|
|
2112
|
+
onClose: () => x(!1),
|
|
1926
2113
|
actions: dt.map((e) => ({
|
|
1927
2114
|
key: e,
|
|
1928
|
-
text:
|
|
2115
|
+
text: v(ft[e])
|
|
1929
2116
|
})),
|
|
1930
|
-
onAction: (e) =>
|
|
2117
|
+
onAction: (e) => _(e.key)
|
|
1931
2118
|
}) : null]
|
|
1932
2119
|
});
|
|
1933
|
-
},
|
|
2120
|
+
}, Xr = "M896 860.48V960H128v-99.52h768zM578.944 128l251.648 655.936h-115.2l-59.904-164.48H379.904L320 784H204.8L456.384 128h122.56z m-58.944 115.776h-3.712L412.16 531.2h211.072L520 243.84z", Zr = "M766.4 744.32c43.712 0 79.36-36.224 79.36-80.512 0-53.504-79.36-140.8-79.36-140.8s-79.36 87.296-79.36 140.8c0 44.288 35.648 80.512 79.36 80.512z m-377.088-44.16c7.04 7.168 18.56 7.168 25.6 0l256.064-256c7.104-7.04 7.104-18.56 0-25.6l-256-256a16.32 16.32 0 0 0-1.92-1.664L334.72 82.688a9.088 9.088 0 0 0-12.8 0l-48 48a9.088 9.088 0 0 0 0 12.8l67.2 67.2-207.808 207.936c-7.04 7.04-7.04 18.56 0 25.6l255.936 256z m12.864-448.576L581.12 430.528H223.36L402.24 251.52z m501.824 564.416H120a8 8 0 0 0-8 8v80c0 4.416 3.584 8 8 8h784a8 8 0 0 0 8-8v-80a8 8 0 0 0-8-8z", Qr = 860.48, $r = 99.52, ei = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, ti = {
|
|
1934
2121
|
fontColor: {
|
|
1935
|
-
path:
|
|
1936
|
-
clipHeight:
|
|
2122
|
+
path: Xr,
|
|
2123
|
+
clipHeight: Qr,
|
|
1937
2124
|
x: 128,
|
|
1938
2125
|
width: 768,
|
|
1939
2126
|
rx: 0
|
|
1940
2127
|
},
|
|
1941
2128
|
fill: {
|
|
1942
|
-
path:
|
|
2129
|
+
path: Zr,
|
|
1943
2130
|
clipHeight: 816,
|
|
1944
2131
|
x: 112,
|
|
1945
2132
|
width: 800,
|
|
1946
2133
|
rx: 8
|
|
1947
2134
|
}
|
|
1948
|
-
},
|
|
2135
|
+
}, ni = (e, t) => {
|
|
1949
2136
|
let n = t.trim().toLowerCase();
|
|
1950
|
-
if (e === "fill") return !n || n === "transparent" ||
|
|
2137
|
+
if (e === "fill") return !n || n === "transparent" || ei.test(n);
|
|
1951
2138
|
let r = n.replace(/\s+/g, "");
|
|
1952
2139
|
return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
|
|
1953
|
-
},
|
|
1954
|
-
let r = `${c().replace(/:/g, "")}clip`, i =
|
|
2140
|
+
}, ri = ({ variant: e, barColor: t, size: n }) => {
|
|
2141
|
+
let r = `${c().replace(/:/g, "")}clip`, i = ti[e];
|
|
1955
2142
|
return /* @__PURE__ */ m("svg", {
|
|
1956
2143
|
width: n,
|
|
1957
2144
|
height: n,
|
|
@@ -1974,15 +2161,15 @@ var st = [
|
|
|
1974
2161
|
}),
|
|
1975
2162
|
/* @__PURE__ */ p("rect", {
|
|
1976
2163
|
x: i.x,
|
|
1977
|
-
y:
|
|
2164
|
+
y: Qr,
|
|
1978
2165
|
width: i.width,
|
|
1979
|
-
height:
|
|
2166
|
+
height: $r,
|
|
1980
2167
|
rx: i.rx,
|
|
1981
|
-
fill:
|
|
2168
|
+
fill: ni(e, t) ? "currentColor" : t
|
|
1982
2169
|
})
|
|
1983
2170
|
]
|
|
1984
2171
|
});
|
|
1985
|
-
},
|
|
2172
|
+
}, ii = {
|
|
1986
2173
|
bold: !1,
|
|
1987
2174
|
italic: !1,
|
|
1988
2175
|
underline: !1,
|
|
@@ -1995,20 +2182,20 @@ var st = [
|
|
|
1995
2182
|
headingTag: !1,
|
|
1996
2183
|
hasRangeSelection: !1,
|
|
1997
2184
|
hasEditorText: !1
|
|
1998
|
-
},
|
|
1999
|
-
let t = !!
|
|
2000
|
-
...
|
|
2185
|
+
}, ai = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", oi = (e) => {
|
|
2186
|
+
let t = !!I().getTextContent().trim(), n = {
|
|
2187
|
+
...ii,
|
|
2001
2188
|
hasEditorText: t
|
|
2002
2189
|
};
|
|
2003
2190
|
if (!e) return n;
|
|
2004
|
-
let r =
|
|
2005
|
-
if (!
|
|
2191
|
+
let r = L();
|
|
2192
|
+
if (!R(r)) return n;
|
|
2006
2193
|
let i = it(r, "color", ct), a = it(r, "background-color", lt), o = r.anchor.getNode(), s = o.getKey() === "root" ? o : B(o, (e) => {
|
|
2007
2194
|
let t = e.getParent();
|
|
2008
|
-
return t !== null &&
|
|
2195
|
+
return t !== null && Ce(t);
|
|
2009
2196
|
});
|
|
2010
2197
|
s === null && (s = o.getTopLevelElementOrThrow());
|
|
2011
|
-
let c = B(o, S), l = !1, u =
|
|
2198
|
+
let c = B(o, S), l = !1, u = xe(s) ? s.getIndent() : 0;
|
|
2012
2199
|
if (S(c)) {
|
|
2013
2200
|
u = c.getIndent();
|
|
2014
2201
|
let e = c.getParent();
|
|
@@ -2025,28 +2212,28 @@ var st = [
|
|
|
2025
2212
|
strikethrough: r.hasFormat("strikethrough"),
|
|
2026
2213
|
fontColor: i,
|
|
2027
2214
|
backgroundColor: a,
|
|
2028
|
-
align:
|
|
2215
|
+
align: ai(xe(s) ? s.getFormatType() : ""),
|
|
2029
2216
|
listType: l,
|
|
2030
2217
|
canOutdent: u > 0 || l !== !1,
|
|
2031
2218
|
headingTag: f === "h1" || f === "h2" || f === "h3" ? f : !1,
|
|
2032
2219
|
hasRangeSelection: !0,
|
|
2033
2220
|
hasEditorText: t
|
|
2034
2221
|
};
|
|
2035
|
-
},
|
|
2222
|
+
}, si = (e, t) => {
|
|
2036
2223
|
e.isEditable() || e.setEditable(!0), e.update(() => {
|
|
2037
|
-
|
|
2224
|
+
Lt(), t(oi(!0));
|
|
2038
2225
|
}), e.focus(void 0, { defaultSelection: "rootStart" });
|
|
2039
|
-
},
|
|
2040
|
-
let t =
|
|
2041
|
-
return
|
|
2226
|
+
}, ci = (e) => {
|
|
2227
|
+
let t = ii;
|
|
2228
|
+
return si(e, (e) => {
|
|
2042
2229
|
t = e;
|
|
2043
2230
|
}), t;
|
|
2044
|
-
},
|
|
2231
|
+
}, li = (...e) => e.filter(Boolean).join(" "), ui = (e) => e.buttons.map((e) => ({
|
|
2045
2232
|
name: typeof e == "string" ? e : e.name,
|
|
2046
2233
|
disabled: typeof e != "string" && !!e.props?.disabled
|
|
2047
|
-
})), Q = 24,
|
|
2234
|
+
})), Q = 24, di = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
|
|
2048
2235
|
type: "button",
|
|
2049
|
-
className:
|
|
2236
|
+
className: li(V["bsy-mobile-editor__tool"], i && V["bsy-mobile-editor__tool--select"], a && V["bsy-mobile-editor__tool--select-align"], e && V["bsy-mobile-editor__tool--active"]),
|
|
2050
2237
|
"aria-label": r,
|
|
2051
2238
|
"aria-pressed": e,
|
|
2052
2239
|
"aria-expanded": i ? !!n : void 0,
|
|
@@ -2054,11 +2241,11 @@ var st = [
|
|
|
2054
2241
|
onMouseDown: (e) => e.preventDefault(),
|
|
2055
2242
|
onClick: o,
|
|
2056
2243
|
children: s
|
|
2057
|
-
}),
|
|
2244
|
+
}), fi = ({ open: e }) => /* @__PURE__ */ p(n, {
|
|
2058
2245
|
name: "arrow-down",
|
|
2059
|
-
size:
|
|
2060
|
-
className:
|
|
2061
|
-
}),
|
|
2246
|
+
size: di,
|
|
2247
|
+
className: li(V["bsy-mobile-editor__tool-caret"], e && V["bsy-mobile-editor__tool-caret--open"])
|
|
2248
|
+
}), pi = ({ config: t, formats: r, colorValues: i, openSheet: a, onOpenSheet: o, onOpenLink: c }) => {
|
|
2062
2249
|
let [l] = z(), { t: d } = e(), f = u(null), h = u(null), g = u(null), _ = () => {
|
|
2063
2250
|
let e = f.current, t = h.current, n = g.current;
|
|
2064
2251
|
if (!e || !t || !n) return;
|
|
@@ -2149,7 +2336,7 @@ var st = [
|
|
|
2149
2336
|
disabled: t,
|
|
2150
2337
|
label: d("editor.bulletList"),
|
|
2151
2338
|
onClick: () => {
|
|
2152
|
-
let e =
|
|
2339
|
+
let e = ci(l);
|
|
2153
2340
|
l.dispatchCommand(e.listType === "bullet" ? O : T, void 0);
|
|
2154
2341
|
},
|
|
2155
2342
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2162,7 +2349,7 @@ var st = [
|
|
|
2162
2349
|
disabled: t,
|
|
2163
2350
|
label: d("editor.numberList"),
|
|
2164
2351
|
onClick: () => {
|
|
2165
|
-
let e =
|
|
2352
|
+
let e = ci(l);
|
|
2166
2353
|
l.dispatchCommand(e.listType === "number" ? O : w, void 0);
|
|
2167
2354
|
},
|
|
2168
2355
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -2181,7 +2368,7 @@ var st = [
|
|
|
2181
2368
|
children: [/* @__PURE__ */ p(n, {
|
|
2182
2369
|
name: r.align === "center" ? "paragraphmiddle" : r.align === "right" ? "paragraphright" : "paragraph",
|
|
2183
2370
|
size: Q
|
|
2184
|
-
}), /* @__PURE__ */ p(
|
|
2371
|
+
}), /* @__PURE__ */ p(fi, { open: a === "align" })]
|
|
2185
2372
|
}, e);
|
|
2186
2373
|
case "heading": return /* @__PURE__ */ m($, {
|
|
2187
2374
|
select: !0,
|
|
@@ -2194,7 +2381,7 @@ var st = [
|
|
|
2194
2381
|
children: [/* @__PURE__ */ p("span", {
|
|
2195
2382
|
className: V["bsy-mobile-editor__tool-text"],
|
|
2196
2383
|
children: r.headingTag ? r.headingTag.toUpperCase() : d("editor.paragraph")
|
|
2197
|
-
}), /* @__PURE__ */ p(
|
|
2384
|
+
}), /* @__PURE__ */ p(fi, { open: a === "heading" })]
|
|
2198
2385
|
}, e);
|
|
2199
2386
|
case "fontSize": return /* @__PURE__ */ p($, {
|
|
2200
2387
|
active: a === "fontSize",
|
|
@@ -2211,7 +2398,7 @@ var st = [
|
|
|
2211
2398
|
disabled: t,
|
|
2212
2399
|
label: d("editor.fontColor"),
|
|
2213
2400
|
onClick: () => o("fontColor"),
|
|
2214
|
-
children: /* @__PURE__ */ p(
|
|
2401
|
+
children: /* @__PURE__ */ p(ri, {
|
|
2215
2402
|
variant: "fontColor",
|
|
2216
2403
|
barColor: i.fontColor,
|
|
2217
2404
|
size: Q
|
|
@@ -2222,7 +2409,7 @@ var st = [
|
|
|
2222
2409
|
disabled: t,
|
|
2223
2410
|
label: d("editor.fill"),
|
|
2224
2411
|
onClick: () => o("fill"),
|
|
2225
|
-
children: /* @__PURE__ */ p(
|
|
2412
|
+
children: /* @__PURE__ */ p(ri, {
|
|
2226
2413
|
variant: "fill",
|
|
2227
2414
|
barColor: i.fill,
|
|
2228
2415
|
size: Q
|
|
@@ -2238,7 +2425,7 @@ var st = [
|
|
|
2238
2425
|
children: [/* @__PURE__ */ p(n, {
|
|
2239
2426
|
name: "picture",
|
|
2240
2427
|
size: Q
|
|
2241
|
-
}), /* @__PURE__ */ p(
|
|
2428
|
+
}), /* @__PURE__ */ p(fi, { open: a === "picture" })]
|
|
2242
2429
|
}, e);
|
|
2243
2430
|
case "link": return /* @__PURE__ */ p($, {
|
|
2244
2431
|
disabled: t,
|
|
@@ -2259,13 +2446,13 @@ var st = [
|
|
|
2259
2446
|
label: d("editor.ai"),
|
|
2260
2447
|
onClick: () => o("ai"),
|
|
2261
2448
|
children: [/* @__PURE__ */ p("img", {
|
|
2262
|
-
src:
|
|
2449
|
+
src: pr,
|
|
2263
2450
|
alt: "",
|
|
2264
2451
|
width: Q,
|
|
2265
2452
|
height: Q,
|
|
2266
2453
|
className: V["bsy-mobile-editor__ai-icon"],
|
|
2267
2454
|
draggable: !1
|
|
2268
|
-
}), /* @__PURE__ */ p(
|
|
2455
|
+
}), /* @__PURE__ */ p(fi, { open: n })]
|
|
2269
2456
|
}, e);
|
|
2270
2457
|
}
|
|
2271
2458
|
default: return null;
|
|
@@ -2278,7 +2465,7 @@ var st = [
|
|
|
2278
2465
|
className: V["bsy-mobile-editor__toolbar-scroller"],
|
|
2279
2466
|
onScroll: _,
|
|
2280
2467
|
children: t.map((e, t) => {
|
|
2281
|
-
let n =
|
|
2468
|
+
let n = ui(e);
|
|
2282
2469
|
return n.length ? /* @__PURE__ */ m("div", {
|
|
2283
2470
|
className: V["bsy-mobile-editor__toolbar-group"],
|
|
2284
2471
|
children: [t > 0 ? /* @__PURE__ */ p("span", { className: V["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(v)]
|
|
@@ -2295,19 +2482,19 @@ var st = [
|
|
|
2295
2482
|
})
|
|
2296
2483
|
})]
|
|
2297
2484
|
});
|
|
2298
|
-
},
|
|
2485
|
+
}, mi = () => {
|
|
2299
2486
|
let [e] = z(), [t, n] = d(!1);
|
|
2300
2487
|
return s(() => rt(e.registerCommand(Pe, () => (n(!0), !1), je), e.registerCommand(ke, () => (n(!1), !1), je)), [e]), t;
|
|
2301
|
-
},
|
|
2302
|
-
let [e] = z(), t =
|
|
2488
|
+
}, hi = () => {
|
|
2489
|
+
let [e] = z(), t = mi(), [n, r] = d(ii);
|
|
2303
2490
|
return s(() => (e.getEditorState().read(() => {
|
|
2304
|
-
r(
|
|
2491
|
+
r(oi(t));
|
|
2305
2492
|
}, { editor: e }), e.registerUpdateListener(({ editorState: n }) => {
|
|
2306
2493
|
n.read(() => {
|
|
2307
|
-
r(
|
|
2494
|
+
r(oi(t));
|
|
2308
2495
|
}, { editor: e });
|
|
2309
2496
|
})), [e, t]), n;
|
|
2310
|
-
},
|
|
2497
|
+
}, gi = "plaintext", _i = "github-light", vi = new Set([
|
|
2311
2498
|
"plaintext",
|
|
2312
2499
|
"css",
|
|
2313
2500
|
"html",
|
|
@@ -2329,7 +2516,7 @@ var st = [
|
|
|
2329
2516
|
"bash",
|
|
2330
2517
|
"lua",
|
|
2331
2518
|
"markdown"
|
|
2332
|
-
]),
|
|
2519
|
+
]), yi = (e) => e && vi.has(e) ? e : gi, bi = {
|
|
2333
2520
|
css: () => import("@shikijs/langs/css"),
|
|
2334
2521
|
html: () => import("@shikijs/langs/html"),
|
|
2335
2522
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2350,38 +2537,38 @@ var st = [
|
|
|
2350
2537
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2351
2538
|
lua: () => import("@shikijs/langs/lua"),
|
|
2352
2539
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2353
|
-
},
|
|
2540
|
+
}, xi = (e) => e === "bash" ? "shellscript" : e, Si = (e) => e in bi, Ci = null, wi = null, Ti = /* @__PURE__ */ new Map(), Ei = () => (Ci ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2354
2541
|
engine: t(),
|
|
2355
2542
|
langs: [],
|
|
2356
2543
|
themes: []
|
|
2357
2544
|
})).catch((e) => {
|
|
2358
|
-
throw
|
|
2359
|
-
}),
|
|
2360
|
-
let t =
|
|
2361
|
-
return t || (t =
|
|
2362
|
-
let n =
|
|
2545
|
+
throw Ci = null, e;
|
|
2546
|
+
}), Ci), Di = (e, t) => Si(t) && e.getLoadedLanguages().includes(xi(t)), Oi = (e) => {
|
|
2547
|
+
let t = Ti.get(e);
|
|
2548
|
+
return t || (t = Ei().then(async (t) => {
|
|
2549
|
+
let n = xi(e);
|
|
2363
2550
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2364
|
-
let n = await
|
|
2551
|
+
let n = await bi[e]();
|
|
2365
2552
|
await t.loadLanguage(n.default);
|
|
2366
2553
|
}
|
|
2367
2554
|
return t;
|
|
2368
2555
|
}).catch((t) => {
|
|
2369
|
-
throw
|
|
2370
|
-
}),
|
|
2371
|
-
},
|
|
2556
|
+
throw Ti.delete(e), t;
|
|
2557
|
+
}), Ti.set(e, t)), t;
|
|
2558
|
+
}, ki = () => (wi ||= Ei().then(async (e) => {
|
|
2372
2559
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2373
2560
|
let t = await import("@shikijs/themes/github-light");
|
|
2374
2561
|
await e.loadTheme(t.default);
|
|
2375
2562
|
}
|
|
2376
2563
|
return e;
|
|
2377
2564
|
}).catch((e) => {
|
|
2378
|
-
throw
|
|
2379
|
-
}),
|
|
2565
|
+
throw wi = null, e;
|
|
2566
|
+
}), wi), Ai = (e, t, n) => {
|
|
2380
2567
|
let r = e.getTextContent();
|
|
2381
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2568
|
+
if (e.getStyle() && e.setStyle(""), !n || !Di(n, t)) return ee(r);
|
|
2382
2569
|
let i = n.codeToTokens(r, {
|
|
2383
|
-
lang:
|
|
2384
|
-
theme:
|
|
2570
|
+
lang: xi(t),
|
|
2571
|
+
theme: _i
|
|
2385
2572
|
}).tokens, a = [];
|
|
2386
2573
|
return i.forEach((e, t) => {
|
|
2387
2574
|
t && a.push(_e()), e.forEach((e) => {
|
|
@@ -2392,11 +2579,11 @@ var st = [
|
|
|
2392
2579
|
});
|
|
2393
2580
|
});
|
|
2394
2581
|
}), a;
|
|
2395
|
-
},
|
|
2396
|
-
let n =
|
|
2582
|
+
}, ji = (e, t) => {
|
|
2583
|
+
let n = F(e);
|
|
2397
2584
|
if (!j(n) || !n.isAttached()) return;
|
|
2398
|
-
let r =
|
|
2399
|
-
if (!
|
|
2585
|
+
let r = L();
|
|
2586
|
+
if (!R(r)) {
|
|
2400
2587
|
t();
|
|
2401
2588
|
return;
|
|
2402
2589
|
}
|
|
@@ -2405,15 +2592,15 @@ var st = [
|
|
|
2405
2592
|
t();
|
|
2406
2593
|
return;
|
|
2407
2594
|
}
|
|
2408
|
-
let a = i.offset, o = i.type === "element" &&
|
|
2595
|
+
let a = i.offset, o = i.type === "element" && Se(n.getChildAtIndex(i.offset - 1)), s = 0;
|
|
2409
2596
|
if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
|
|
2410
2597
|
if (o) {
|
|
2411
2598
|
i.getNode().select(a, a);
|
|
2412
2599
|
return;
|
|
2413
2600
|
}
|
|
2414
2601
|
n.getChildren().some((e) => {
|
|
2415
|
-
let t =
|
|
2416
|
-
if (t ||
|
|
2602
|
+
let t = Te(e);
|
|
2603
|
+
if (t || Se(e)) {
|
|
2417
2604
|
let n = e.getTextContentSize();
|
|
2418
2605
|
if (t && n >= s) return e.select(s, s), !0;
|
|
2419
2606
|
s -= n;
|
|
@@ -2421,27 +2608,27 @@ var st = [
|
|
|
2421
2608
|
return !1;
|
|
2422
2609
|
});
|
|
2423
2610
|
}
|
|
2424
|
-
},
|
|
2611
|
+
}, Mi = (e, t) => A(e) && A(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || we(e) && we(t) || Se(e) && Se(t), Ni = (e, t) => {
|
|
2425
2612
|
let n = 0;
|
|
2426
|
-
for (; n < e.length &&
|
|
2613
|
+
for (; n < e.length && Mi(e[n], t[n]);) n++;
|
|
2427
2614
|
let r = 0, i = Math.min(e.length, t.length) - n;
|
|
2428
|
-
for (; r < i &&
|
|
2615
|
+
for (; r < i && Mi(e[e.length - r - 1], t[t.length - r - 1]);) r++;
|
|
2429
2616
|
return {
|
|
2430
2617
|
from: n,
|
|
2431
2618
|
to: e.length - r,
|
|
2432
2619
|
replacement: t.slice(n, t.length - r)
|
|
2433
2620
|
};
|
|
2434
|
-
},
|
|
2435
|
-
let a = i.getKey(), o =
|
|
2621
|
+
}, Pi = (e, t, n, r, i) => {
|
|
2622
|
+
let a = i.getKey(), o = yi(i.getLanguage());
|
|
2436
2623
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2437
2624
|
else {
|
|
2438
|
-
i.getTheme() !== "github-light" && i.setTheme(
|
|
2439
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2625
|
+
i.getTheme() !== "github-light" && i.setTheme(_i);
|
|
2626
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? Si(o) && !Di(t, o) ? Oi(o) : null : ki() : Ei();
|
|
2440
2627
|
if (s) {
|
|
2441
2628
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2442
2629
|
r(t);
|
|
2443
2630
|
let i = [...n.pendingKeys];
|
|
2444
|
-
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) =>
|
|
2631
|
+
n.pendingKeys.clear(), n.loading = null, e.update(() => i.forEach((e) => F(e)?.markDirty()), { tag: Le });
|
|
2445
2632
|
}, () => {
|
|
2446
2633
|
n.pendingKeys.clear(), n.loading = null;
|
|
2447
2634
|
}));
|
|
@@ -2449,38 +2636,38 @@ var st = [
|
|
|
2449
2636
|
}
|
|
2450
2637
|
i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
|
|
2451
2638
|
}
|
|
2452
|
-
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0,
|
|
2639
|
+
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, De(() => {
|
|
2453
2640
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2454
|
-
})),
|
|
2455
|
-
let e =
|
|
2641
|
+
})), ji(a, () => {
|
|
2642
|
+
let e = F(a);
|
|
2456
2643
|
if (!j(e) || !e.isAttached()) return !1;
|
|
2457
|
-
let n =
|
|
2644
|
+
let n = Ai(e, yi(e.getLanguage()), t), { from: r, to: i, replacement: o } = Ni(e.getChildren(), n);
|
|
2458
2645
|
return r === i && o.length === 0 ? !1 : (e.splice(r, i - r, o), !0);
|
|
2459
2646
|
}));
|
|
2460
|
-
},
|
|
2647
|
+
}, Fi = () => {
|
|
2461
2648
|
let [e] = z();
|
|
2462
2649
|
return s(() => {
|
|
2463
|
-
if (!e.hasNodes([
|
|
2650
|
+
if (!e.hasNodes([te, M])) throw Error("CodeHighlightPlugin: code nodes are not registered");
|
|
2464
2651
|
let t = null, n = {
|
|
2465
2652
|
didTransform: !1,
|
|
2466
2653
|
nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
|
|
2467
2654
|
pendingKeys: /* @__PURE__ */ new Set(),
|
|
2468
2655
|
loading: null
|
|
2469
|
-
}, r = (r) =>
|
|
2656
|
+
}, r = (r) => Pi(e, t, n, (e) => {
|
|
2470
2657
|
t = e;
|
|
2471
2658
|
}, r), i = (e) => {
|
|
2472
2659
|
let t = e.getParent();
|
|
2473
2660
|
j(t) ? r(t) : A(e) && e.replace(ye(e.__text));
|
|
2474
2661
|
};
|
|
2475
|
-
return Ke(ne(e), e.registerNodeTransform(
|
|
2662
|
+
return Ke(ne(e), e.registerNodeTransform(te, r), e.registerNodeTransform(We, i), e.registerNodeTransform(M, i));
|
|
2476
2663
|
}, [e]), null;
|
|
2477
|
-
},
|
|
2664
|
+
}, Ii = () => {
|
|
2478
2665
|
let [e] = z();
|
|
2479
2666
|
return s(() => (he(e, !0), rt(pe(e), me(e, !1), fe(e), e.registerNodeTransform(le, (e) => {
|
|
2480
2667
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
2481
2668
|
}), e.registerCommand(Be, (e) => {
|
|
2482
|
-
let t =
|
|
2483
|
-
if (!
|
|
2669
|
+
let t = L();
|
|
2670
|
+
if (!R(t) || !t.isCollapsed()) return !1;
|
|
2484
2671
|
let n = oe(t.anchor.getNode());
|
|
2485
2672
|
if (n === null) return !1;
|
|
2486
2673
|
let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
|
|
@@ -2505,31 +2692,31 @@ var st = [
|
|
|
2505
2692
|
}
|
|
2506
2693
|
return !0;
|
|
2507
2694
|
}, Ae))), [e]), null;
|
|
2508
|
-
},
|
|
2509
|
-
let [f] = z(), { t: h } = e(), g =
|
|
2695
|
+
}, Li = ({ value: n, onChange: r, open: i, onOpenChange: a, toolbar: o, upload: c, ai: l }) => {
|
|
2696
|
+
let [f] = z(), { t: h } = e(), g = hi(), [_, v] = d(!1), y = i ?? _, b = (e) => {
|
|
2510
2697
|
a?.(e), i === void 0 && v(e);
|
|
2511
2698
|
}, [x, S] = d(null), [C, w] = d(() => ({
|
|
2512
2699
|
fontColor: g.fontColor,
|
|
2513
2700
|
fill: g.backgroundColor
|
|
2514
2701
|
})), T = u(!1), [E, D] = d(!1), O = u(null), k = () => {
|
|
2515
2702
|
f.getEditorState().read(() => {
|
|
2516
|
-
O.current =
|
|
2703
|
+
O.current = L()?.clone() ?? null;
|
|
2517
2704
|
});
|
|
2518
|
-
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink:
|
|
2705
|
+
}, { linkForm: A, openLink: j, confirmLink: ee, closeLink: M } = rr({
|
|
2519
2706
|
editor: f,
|
|
2520
2707
|
savedSelectionRef: O,
|
|
2521
2708
|
captureSelection: k
|
|
2522
|
-
}), [
|
|
2709
|
+
}), [te] = d(() => /* @__PURE__ */ new Map()), { fileInputRef: ne, uploadProgress: re, insertImage: ie, onFileChange: ae, abortUpload: oe } = nr({
|
|
2523
2710
|
editor: f,
|
|
2524
2711
|
upload: c,
|
|
2525
2712
|
savedSelectionRef: O,
|
|
2526
|
-
attachmentsBySrc:
|
|
2527
|
-
}), se =
|
|
2713
|
+
attachmentsBySrc: te
|
|
2714
|
+
}), se = ir({
|
|
2528
2715
|
editor: f,
|
|
2529
2716
|
value: n,
|
|
2530
2717
|
onChange: r,
|
|
2531
|
-
attachmentsBySrc:
|
|
2532
|
-
}), N =
|
|
2718
|
+
attachmentsBySrc: te
|
|
2719
|
+
}), N = Gn({
|
|
2533
2720
|
editor: f,
|
|
2534
2721
|
ai: l
|
|
2535
2722
|
}), [ce, le] = d(0), ue = o?.config ?? pt;
|
|
@@ -2545,7 +2732,7 @@ var st = [
|
|
|
2545
2732
|
g.hasRangeSelection
|
|
2546
2733
|
]);
|
|
2547
2734
|
let de = () => {
|
|
2548
|
-
oe(), N.close(), S(null),
|
|
2735
|
+
oe(), N.close(), S(null), M(), D(!1), b(!1);
|
|
2549
2736
|
};
|
|
2550
2737
|
s(() => {
|
|
2551
2738
|
if (!y) return;
|
|
@@ -2574,7 +2761,7 @@ var st = [
|
|
|
2574
2761
|
onClose: de,
|
|
2575
2762
|
position: "bottom",
|
|
2576
2763
|
closeOnClickOverlay: !0,
|
|
2577
|
-
children: /* @__PURE__ */ p(
|
|
2764
|
+
children: /* @__PURE__ */ p(Kn.Provider, {
|
|
2578
2765
|
value: re,
|
|
2579
2766
|
children: /* @__PURE__ */ m("div", {
|
|
2580
2767
|
className: V["bsy-mobile-editor"],
|
|
@@ -2598,7 +2785,7 @@ var st = [
|
|
|
2598
2785
|
ErrorBoundary: $e
|
|
2599
2786
|
})
|
|
2600
2787
|
}),
|
|
2601
|
-
ue.length > 0 ? /* @__PURE__ */ p(
|
|
2788
|
+
ue.length > 0 ? /* @__PURE__ */ p(pi, {
|
|
2602
2789
|
config: ue,
|
|
2603
2790
|
formats: g,
|
|
2604
2791
|
colorValues: C,
|
|
@@ -2617,12 +2804,12 @@ var st = [
|
|
|
2617
2804
|
/* @__PURE__ */ p(Je, {}),
|
|
2618
2805
|
/* @__PURE__ */ p(Xe, {}),
|
|
2619
2806
|
/* @__PURE__ */ p(Ye, {}),
|
|
2620
|
-
/* @__PURE__ */ p(
|
|
2621
|
-
/* @__PURE__ */ p(
|
|
2622
|
-
/* @__PURE__ */ p(
|
|
2623
|
-
/* @__PURE__ */ p(
|
|
2624
|
-
/* @__PURE__ */ p(
|
|
2625
|
-
/* @__PURE__ */ p(
|
|
2807
|
+
/* @__PURE__ */ p(or, {}),
|
|
2808
|
+
/* @__PURE__ */ p(fr, {}),
|
|
2809
|
+
/* @__PURE__ */ p(cr, {}),
|
|
2810
|
+
/* @__PURE__ */ p(ur, {}),
|
|
2811
|
+
/* @__PURE__ */ p(Fi, {}),
|
|
2812
|
+
/* @__PURE__ */ p(Ii, {}),
|
|
2626
2813
|
/* @__PURE__ */ p(Ze, {
|
|
2627
2814
|
onChange: se,
|
|
2628
2815
|
ignoreSelectionChange: !0
|
|
@@ -2634,7 +2821,7 @@ var st = [
|
|
|
2634
2821
|
hidden: !0,
|
|
2635
2822
|
onChange: ae
|
|
2636
2823
|
}),
|
|
2637
|
-
/* @__PURE__ */ p(
|
|
2824
|
+
/* @__PURE__ */ p(Nr, {
|
|
2638
2825
|
sheet: x,
|
|
2639
2826
|
onClose: () => {
|
|
2640
2827
|
if (T.current) {
|
|
@@ -2664,23 +2851,24 @@ var st = [
|
|
|
2664
2851
|
canTypeset: !!l?.typeset,
|
|
2665
2852
|
canPolish: !!l?.polish
|
|
2666
2853
|
}),
|
|
2667
|
-
/* @__PURE__ */ p(
|
|
2854
|
+
/* @__PURE__ */ p(Fr, {
|
|
2668
2855
|
open: A !== null,
|
|
2669
2856
|
seed: A,
|
|
2670
|
-
onClose:
|
|
2857
|
+
onClose: M,
|
|
2671
2858
|
onConfirm: ee
|
|
2672
2859
|
}),
|
|
2673
|
-
/* @__PURE__ */ p(
|
|
2860
|
+
/* @__PURE__ */ p(Lr, {
|
|
2674
2861
|
open: E,
|
|
2675
2862
|
onClose: () => D(!1),
|
|
2676
2863
|
onConfirm: (e) => {
|
|
2677
2864
|
ie(e, "", e), D(!1);
|
|
2678
2865
|
}
|
|
2679
2866
|
}),
|
|
2680
|
-
/* @__PURE__ */ p(
|
|
2867
|
+
/* @__PURE__ */ p(Yr, {
|
|
2681
2868
|
open: N.mode !== null,
|
|
2682
2869
|
mode: N.mode,
|
|
2683
2870
|
originalHtml: N.snapshot.html,
|
|
2871
|
+
codeBlocks: N.snapshot.codeBlocks,
|
|
2684
2872
|
ai: l,
|
|
2685
2873
|
polishPreset: N.preset,
|
|
2686
2874
|
onClose: N.close,
|
|
@@ -2691,10 +2879,10 @@ var st = [
|
|
|
2691
2879
|
})
|
|
2692
2880
|
})
|
|
2693
2881
|
});
|
|
2694
|
-
},
|
|
2882
|
+
}, Ri = "1px solid #d9d9d9", zi = { export: new Map([[le, (e, t) => {
|
|
2695
2883
|
let n = t.exportDOM(e);
|
|
2696
|
-
return Ge(n.element) && (n.element.style.border =
|
|
2697
|
-
}]]) },
|
|
2884
|
+
return Ge(n.element) && (n.element.style.border = Ri), n;
|
|
2885
|
+
}]]) }, Bi = class e extends x {
|
|
2698
2886
|
constructor(e = "", t = {}, n) {
|
|
2699
2887
|
super(e, t, n);
|
|
2700
2888
|
}
|
|
@@ -2709,12 +2897,12 @@ var st = [
|
|
|
2709
2897
|
}, t.__key);
|
|
2710
2898
|
}
|
|
2711
2899
|
static importJSON(e) {
|
|
2712
|
-
return
|
|
2900
|
+
return Vi().updateFromJSON(e);
|
|
2713
2901
|
}
|
|
2714
2902
|
sanitizeUrl(e) {
|
|
2715
2903
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
2716
2904
|
}
|
|
2717
|
-
},
|
|
2905
|
+
}, Vi = (e = "", t = {}) => ge(new Bi(e, t)), Hi = {
|
|
2718
2906
|
namespace: "bsyLexicalEditor",
|
|
2719
2907
|
onError: (e) => {
|
|
2720
2908
|
console.error("Lexical error", e);
|
|
@@ -2747,28 +2935,28 @@ var st = [
|
|
|
2747
2935
|
tableRow: "editor-table-row",
|
|
2748
2936
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
2749
2937
|
},
|
|
2750
|
-
html:
|
|
2938
|
+
html: zi,
|
|
2751
2939
|
nodes: [
|
|
2752
|
-
|
|
2940
|
+
Bi,
|
|
2753
2941
|
{
|
|
2754
2942
|
replace: x,
|
|
2755
|
-
with: (e) => new
|
|
2943
|
+
with: (e) => new Bi(e.__url, {
|
|
2756
2944
|
rel: e.__rel,
|
|
2757
2945
|
target: e.__target,
|
|
2758
2946
|
title: e.__title
|
|
2759
2947
|
}),
|
|
2760
|
-
withKlass:
|
|
2948
|
+
withKlass: Bi
|
|
2761
2949
|
},
|
|
2762
2950
|
b,
|
|
2763
2951
|
D,
|
|
2764
2952
|
E,
|
|
2765
2953
|
ae,
|
|
2766
|
-
M,
|
|
2767
2954
|
te,
|
|
2955
|
+
M,
|
|
2768
2956
|
ue,
|
|
2769
2957
|
de,
|
|
2770
2958
|
le,
|
|
2771
|
-
|
|
2959
|
+
Xn,
|
|
2772
2960
|
q,
|
|
2773
2961
|
{
|
|
2774
2962
|
replace: We,
|
|
@@ -2776,10 +2964,10 @@ var st = [
|
|
|
2776
2964
|
withKlass: q
|
|
2777
2965
|
}
|
|
2778
2966
|
]
|
|
2779
|
-
},
|
|
2780
|
-
initialConfig:
|
|
2781
|
-
children: /* @__PURE__ */ p(
|
|
2967
|
+
}, Ui = (e) => /* @__PURE__ */ p(g, {
|
|
2968
|
+
initialConfig: Hi,
|
|
2969
|
+
children: /* @__PURE__ */ p(Li, { ...e })
|
|
2782
2970
|
});
|
|
2783
|
-
|
|
2971
|
+
Ui.displayName = "BsyMobileEditor";
|
|
2784
2972
|
//#endregion
|
|
2785
|
-
export {
|
|
2973
|
+
export { zr as n, Ui as t };
|