@layers-app/editor 0.5.5-optimization → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +10 -12
- package/dist/layers.0w5S-QQA.js +40 -0
- package/dist/layers.0wI6yvx5.js +39 -0
- package/dist/layers.2923K-vc.js +10 -0
- package/dist/layers.3hYFOwvv.js +8 -0
- package/dist/layers.52famHy6.js +1 -0
- package/dist/layers.5N13frHH.js +6 -0
- package/dist/layers.6IBx-qi5.js +10 -0
- package/dist/layers.7JqFgE4-.js +15 -0
- package/dist/layers.7QozyVZs.js +35 -0
- package/dist/layers.8jNiUB6g.js +1 -0
- package/dist/layers.9THUd_df.js +6 -0
- package/dist/layers.9cmmyava.js +1089 -0
- package/dist/layers.9dEXo7_C.js +13 -0
- package/dist/layers.9o_U5jfj.js +39 -0
- package/dist/layers.9pNaFvaX.js +1 -0
- package/dist/layers.AjDHx6UP.js +37 -0
- package/dist/layers.B-p6VlwR.js +9 -0
- package/dist/layers.B18ZgT9v.js +202 -0
- package/dist/layers.B19hGmey.js +1 -0
- package/dist/layers.B1wHHvE6.js +295 -0
- package/dist/layers.B3D4g2HH.js +1 -0
- package/dist/layers.B7K7JjK6.js +1510 -0
- package/dist/layers.B7dzLgTm.js +9 -0
- package/dist/layers.B8OtSObh.js +5 -0
- package/dist/layers.BAtv1CM7.js +1 -0
- package/dist/layers.BFcGp_Gv.js +220 -0
- package/dist/layers.BGyOsjNd.js +139 -0
- package/dist/layers.BHlsvftZ.js +9 -0
- package/dist/layers.BIWARpmB.js +41 -0
- package/dist/layers.BIeVwYKL.js +1 -0
- package/dist/layers.BJDrjORS.js +244 -0
- package/dist/layers.BKqtCWWZ.js +40 -0
- package/dist/layers.BLTdG0Mr.js +1619 -0
- package/dist/layers.BLd2spTm.js +1 -0
- package/dist/layers.BLuog6Kb.js +1034 -0
- package/dist/layers.BNDDJ_2_.js +9 -0
- package/dist/layers.BOz1yBau.js +2 -0
- package/dist/layers.BPDfSLMf.js +10 -0
- package/dist/layers.BQLM3liS.js +437 -0
- package/dist/layers.BRwzEFNo.js +40 -0
- package/dist/layers.BSTBZrFn.js +1 -0
- package/dist/layers.BTOiiuLQ.js +116 -0
- package/dist/layers.BXh8X6qB.js +10 -0
- package/dist/layers.BYHU1eYE.js +9 -0
- package/dist/layers.BZvD_ufq.js +10 -0
- package/dist/layers.BbCfEXyj.js +55 -0
- package/dist/layers.Bc-lInMK.js +793 -0
- package/dist/layers.BcrGngrS.js +1 -0
- package/dist/layers.BcvHk4_r.js +38 -0
- package/dist/layers.BdQk3Yld.js +802 -0
- package/dist/layers.BgJWoaX0.js +4 -0
- package/dist/layers.BldbIWu1.js +8 -0
- package/dist/layers.BmRLb_KH.js +70 -0
- package/dist/layers.BmXMWXPz.js +189 -0
- package/dist/layers.Bp5rrf5G.js +10 -0
- package/dist/layers.BpilXLfW.js +6 -0
- package/dist/layers.Bq14VT1U.js +40 -0
- package/dist/layers.BqdpPAoB.js +10 -0
- package/dist/layers.BqtKL1Vm.js +1283 -0
- package/dist/layers.BrFrT4aC.js +9 -0
- package/dist/layers.BrJ_0UsE.js +9 -0
- package/dist/layers.Bs0j4fBT.js +1 -0
- package/dist/layers.Bt-00ZMW.js +7 -0
- package/dist/layers.BufenkCO.js +39 -0
- package/dist/layers.BvQnydnN.js +39 -0
- package/dist/layers.Bvgecag6.js +1 -0
- package/dist/layers.Bw1mFZXl.js +11 -0
- package/dist/layers.BwKKYwFD.js +11 -0
- package/dist/layers.BwiupTbi.js +1359 -0
- package/dist/layers.BxDjh9NF.js +1 -0
- package/dist/layers.ByQyHVoi.js +1 -0
- package/dist/layers.BymfnWMg.js +39 -0
- package/dist/layers.ByxHbusl.js +230 -0
- package/dist/layers.BzNb_e9O.js +96 -0
- package/dist/layers.C-wRhDxe.js +6 -0
- package/dist/layers.C09RI0Hd.js +769 -0
- package/dist/layers.C0Lgw_Sx.js +11688 -0
- package/dist/layers.C1-YETKR.js +35 -0
- package/dist/layers.C1KOVN1R.js +268 -0
- package/dist/layers.C3269RRe.js +48146 -0
- package/dist/layers.C5JuEsOS.js +2479 -0
- package/dist/layers.C5PbzZgC.js +8 -0
- package/dist/layers.C7JUGsGr.js +791 -0
- package/dist/layers.C8QG97nQ.js +40 -0
- package/dist/layers.C8_lu5UH.js +23 -0
- package/dist/layers.C9Xny9c1.js +7 -0
- package/dist/layers.C9vKJCjt.js +122 -0
- package/dist/layers.CA0K1Ecr.js +39 -0
- package/dist/layers.CAYtCPJ-.js +3 -0
- package/dist/layers.CBMcoJVX.js +207 -0
- package/dist/layers.CGLureRh.js +282 -0
- package/dist/layers.CGUTAZ4d.js +1 -0
- package/dist/layers.CHZsXQcr.js +1 -0
- package/dist/layers.CIN0toZS.js +41 -0
- package/dist/layers.CJW9IXO2.js +5 -0
- package/dist/layers.CLzT5cMn.js +8 -0
- package/dist/layers.COAN95H3.js +6 -0
- package/dist/layers.CQWT2Mii.js +51 -0
- package/dist/layers.CRgvTT9V.js +40 -0
- package/dist/layers.CSwGb7jy.js +373 -0
- package/dist/layers.CTXOKanI.js +37 -0
- package/dist/layers.CUvrvILv.js +257 -0
- package/dist/layers.CVoblPs8.js +38 -0
- package/dist/layers.CYLKHgxd.js +11 -0
- package/dist/layers.CYVid0EG.js +1 -0
- package/dist/layers.CZUjXb0C.js +2235 -0
- package/dist/layers.CZZTB1Zf.js +1 -0
- package/dist/layers.CZfSnJsL.js +40 -0
- package/dist/layers.C_IvrzZ3.js +7 -0
- package/dist/layers.C_yNmq9N.js +42 -0
- package/dist/layers.CcITvqlZ.js +8 -0
- package/dist/layers.CcOERYl9.js +41 -0
- package/dist/layers.Cedtkbht.js +1 -0
- package/dist/layers.CfOIPoIP.js +960 -0
- package/dist/layers.Cfc57ihF.js +1 -0
- package/dist/layers.Cm_DIS6r.js +1 -0
- package/dist/layers.CnT6veDF.js +6 -0
- package/dist/layers.CqVTtuYm.js +6 -0
- package/dist/layers.Crx6In_3.js +320 -0
- package/dist/layers.CsAIsRSb.js +1126 -0
- package/dist/layers.Ct32pzvN.js +8 -0
- package/dist/layers.CuGuJloE.js +37 -0
- package/dist/layers.CvSFem62.js +1265 -0
- package/dist/layers.Cwlheu8b.js +8 -0
- package/dist/layers.Cxv0DB_2.js +32 -0
- package/dist/layers.CyWzLA6t.js +6 -0
- package/dist/layers.Cy_HIaDA.js +36 -0
- package/dist/layers.Cyzu9PKQ.js +1 -0
- package/dist/layers.CzhdqFIN.js +7 -0
- package/dist/layers.D-4serHw.js +7 -0
- package/dist/layers.D-b32wWh.js +40 -0
- package/dist/layers.D0MPYC0b.js +41 -0
- package/dist/layers.D0zn4_Mx.js +1 -0
- package/dist/layers.D10hg7vI.js +11 -0
- package/dist/layers.D1hV7KX6.js +10 -0
- package/dist/layers.D2ErdcjU.js +38 -0
- package/dist/layers.D3WNiVgt.js +32 -0
- package/dist/layers.D3t8YKFv.js +1 -0
- package/dist/layers.D4T8fTcj.js +1223 -0
- package/dist/layers.D7jGxypv.js +8 -0
- package/dist/layers.D7sSY6DB.js +803 -0
- package/dist/layers.D9BJhiZI.js +42 -0
- package/dist/layers.DAoIveAz.js +186 -0
- package/dist/layers.DB9dq9br.js +1 -0
- package/dist/layers.DFb_R5xT.js +59 -0
- package/dist/layers.DFun-dAk.js +501 -0
- package/dist/layers.DGxdKpV_.js +2 -0
- package/dist/layers.DHHxFvMb.js +5 -0
- package/dist/layers.DIbNVZML.js +8 -0
- package/dist/layers.DIn3k5ZL.js +8 -0
- package/dist/layers.DKcXlOsV.js +9 -0
- package/dist/layers.DL8jwGhD.js +39 -0
- package/dist/layers.DLwuMfdd.js +84 -0
- package/dist/layers.DMOxf396.js +21763 -0
- package/dist/layers.DMkBISW1.js +1 -0
- package/dist/layers.DN9HoVxI.js +18 -0
- package/dist/layers.DNciL9-y.js +1 -0
- package/dist/layers.DNrSuXGz.js +36 -0
- package/dist/layers.DOrgOHBr.js +1 -0
- package/dist/layers.DQSP86ib.js +84 -0
- package/dist/layers.DSCF8EF6.js +33 -0
- package/dist/layers.DSjAbsiI.js +61 -0
- package/dist/layers.DT4LICiJ.js +2 -0
- package/dist/layers.DUD9gnsf.js +1 -0
- package/dist/layers.DUoRCKF0.js +904 -0
- package/dist/layers.DVl3Vhqz.js +1580 -0
- package/dist/layers.DY8pSuUr.js +10 -0
- package/dist/layers.D_d_ismX.js +423 -0
- package/dist/layers.Day8795K.js +931 -0
- package/dist/layers.DbaKVP5e.js +1 -0
- package/dist/layers.DcbHyTt0.js +425 -0
- package/dist/layers.DdET72Yw.js +42 -0
- package/dist/layers.Ddvc5nMM.js +5 -0
- package/dist/layers.De-QCmxS.js +84 -0
- package/dist/layers.DfaNM_-P.js +1 -0
- package/dist/layers.DiArSMcJ.js +41 -0
- package/dist/layers.Did2Ok8I.js +9 -0
- package/dist/layers.DjUOC4st.js +16 -0
- package/dist/layers.Dm2vTHWN.js +10 -0
- package/dist/layers.Dnnqwk-X.js +42 -0
- package/dist/layers.DoXnyJKj.js +39 -0
- package/dist/layers.DtaYwVxW.js +2966 -0
- package/dist/layers.DtiGznGH.js +1 -0
- package/dist/layers.DubbxAyz.js +35 -0
- package/dist/layers.DvSvsOmi.js +19 -0
- package/dist/layers.DxA6ocdw.js +70 -0
- package/dist/layers.Dy1naDTQ.js +14 -0
- package/dist/layers.DyGbCQD1.js +1 -0
- package/dist/layers.Dz51Anc0.js +32 -0
- package/dist/layers.E9yWRmfi.js +4 -0
- package/dist/layers.JWCLFILJ.js +1 -0
- package/dist/layers.JrQOR4SH.js +33 -0
- package/dist/layers.MCj3WEVm.js +36 -0
- package/dist/layers.NMJzuWfA.js +9 -0
- package/dist/layers.O2J31sgD.js +46859 -0
- package/dist/layers.OGt-lv_l.js +1088 -0
- package/dist/layers.OuVKSFg8.js +41 -0
- package/dist/layers.PfvZQj0b.js +52 -0
- package/dist/layers.S9rhoDh3.js +21938 -0
- package/dist/layers.SV9c-xJ4.js +7 -0
- package/dist/layers.TxMpB1Hi.js +9166 -0
- package/dist/layers.UFIAgb9q.js +1 -0
- package/dist/layers.UT_N-vRk.js +1 -0
- package/dist/layers.VBl-Oztn.js +40 -0
- package/dist/layers.VMY9os8P.js +160 -0
- package/dist/layers.VwL8osbr.js +304 -0
- package/dist/layers.WP57UvSl.js +4 -0
- package/dist/layers.Y8QuC6mk.js +1 -0
- package/dist/layers.ZY7cShzc.js +7 -0
- package/dist/layers.b0h5ZBmD.js +61 -0
- package/dist/layers.c3O_eVw7.js +40 -0
- package/dist/layers.ceGsXYNa.js +41 -0
- package/dist/layers.dpXRC-w3.js +34 -0
- package/dist/layers.eJBQATnQ.js +1 -0
- package/dist/layers.ft1FusK9.js +118 -0
- package/dist/layers.gU8QcMnC.js +32 -0
- package/dist/layers.hSbpOWP5.js +42 -0
- package/dist/layers.hweLqW3I.js +261 -0
- package/dist/layers.i3ws09Iv.js +8 -0
- package/dist/layers.i7sPHczK.js +36 -0
- package/dist/layers.iCIkc7_N.js +41 -0
- package/dist/layers.kOvRCr2f.js +7 -0
- package/dist/layers.lA1sY3Ml.js +32 -0
- package/dist/layers.lCpg7dOn.js +21 -0
- package/dist/layers.lK-yASGE.js +139 -0
- package/dist/layers.mOFjA605.js +37 -0
- package/dist/layers.mSTd6mKy.js +5 -0
- package/dist/layers.pK4ABsGq.js +14 -0
- package/dist/layers.ps4Hq2c-.js +65 -0
- package/dist/layers.rt6zsYSf.js +44 -0
- package/dist/layers.sZjUuIto.js +11 -0
- package/dist/layers.tAiRbzBD.js +4 -0
- package/dist/layers.u25KgIS2.js +7 -0
- package/dist/layers.weqd2nEj.js +32 -0
- package/dist/layers.ykNftii-.js +39 -0
- package/dist/layers.zGHylA_8.js +1 -0
- package/package.json +18 -77
- package/dist/layers.B10sB-Vy.js +0 -1
- package/dist/layers.BDsvvINb.js +0 -6774
- package/dist/layers.BFJ7oQiY.js +0 -7723
- package/dist/layers.BwyONivc.js +0 -864
- package/dist/layers.C2lacXcg.js +0 -2511
- package/dist/layers.C69TrYD7.js +0 -7
- package/dist/layers.CEMW9z_P.js +0 -4
- package/dist/layers.Cwao1pOZ.js +0 -6
- package/dist/layers.CzNz0Zya.js +0 -1
- package/dist/layers.D0Z-zLAV.js +0 -530
- package/dist/layers.DNCgFYS7.js +0 -27
- package/dist/layers.EKDSoJm1.js +0 -2227
- package/dist/layers.QjAkD17S.js +0 -3677
- package/dist/layers.ahDFHQXD.js +0 -341
- package/dist/layers.eLiGm-eZ.js +0 -3
- package/dist/layers.hgliNTDV.js +0 -2
package/dist/layers.C2lacXcg.js
DELETED
|
@@ -1,2511 +0,0 @@
|
|
|
1
|
-
import { useLexicalComposerContext as nt } from "@lexical/react/LexicalComposerContext";
|
|
2
|
-
import { jsx as o, jsxs as H, Fragment as E } from "react/jsx-runtime";
|
|
3
|
-
import { useContext as Ae, useState as b, useEffect as Y, useCallback as ye, useRef as ce, Suspense as dn } from "react";
|
|
4
|
-
import { createPortal as Ct } from "react-dom";
|
|
5
|
-
import { useTranslation as _t } from "react-i18next";
|
|
6
|
-
import { eventFiles as wt, $isHeadingNode as dt, $isQuoteNode as Yt } from "@lexical/rich-text";
|
|
7
|
-
import { mergeRegister as Fe, $findMatchingParent as it, $getNearestNodeOfType as fn, $getNearestBlockElementAncestorOrThrow as pn } from "@lexical/utils";
|
|
8
|
-
import { Tooltip as ie, ActionIcon as ze, Menu as $, rem as V, alpha as mn, Transition as gn, Box as We, Paper as hn, Group as bn, CopyButton as yn, Divider as Cn, Input as _n, Loader as Tn } from "@mantine/core";
|
|
9
|
-
import { IconPlus as Vt, IconMinus as Et, IconClipboard as xn, IconCut as kn, IconTrash as ft, IconCopy as Qt, IconArrowsRightLeft as vn, IconPaint as St, IconColumnInsertLeft as In, IconColumnInsertRight as lt, IconGripVertical as wn, IconArrowNarrowLeft as Tt, IconReplace as Sn, IconTextPlus as Mn, IconIndentIncrease as An, IconPlayerPlay as Pn, IconReload as Dn, IconWand as Ln, IconTextSpellcheck as Nn, IconSortAscending as On, IconSortDescending as $n, IconNotes as Rn, IconLanguage as Bn, IconScript as Fn, IconHelpOctagon as zn, IconCheck as Hn, IconSparkles as Mt, IconAi as Kn } from "@tabler/icons-react";
|
|
10
|
-
import { $getNearestNodeFromDOMNode as oe, $createParagraphNode as Pe, $isElementNode as Me, ElementNode as Un, $getSelection as ue, $isRangeSelection as de, COMMAND_PRIORITY_LOW as be, DRAGOVER_COMMAND as Gn, KEY_ARROW_DOWN_COMMAND as Wn, KEY_ARROW_UP_COMMAND as jn, $isTextNode as pt, $getRoot as At, $getNodeByKey as qn, $isParagraphNode as Yn, KEY_DOWN_COMMAND as Vn, $selectAll as En, SELECTION_CHANGE_COMMAND as Xt, FORMAT_TEXT_COMMAND as le, $createTextNode as xt, $isRootNode as Pt, $isRootOrShadowRoot as Qn, COMMAND_PRIORITY_CRITICAL as rt, CAN_UNDO_COMMAND as Xn, CAN_REDO_COMMAND as Jn, KEY_MODIFIER_COMMAND as Zn, COMMAND_PRIORITY_NORMAL as Dt, CLICK_COMMAND as eo } from "lexical";
|
|
11
|
-
import { C as De, g as to } from "./layers.EKDSoJm1.js";
|
|
12
|
-
import { $isCodeHighlightNode as no } from "@lexical/code";
|
|
13
|
-
import "@lexical/hashtag";
|
|
14
|
-
import { $isLinkNode as Re, TOGGLE_LINK_COMMAND as oo } from "@lexical/link";
|
|
15
|
-
import "@lexical/mark";
|
|
16
|
-
import "@lexical/overflow";
|
|
17
|
-
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
18
|
-
import { L as Xe, P as Ee, S as ke, T as ve, U as je, W as Lt, R as so, q as Je, Q as Ze, n as Jt, l as Nt, w as Ot, r as Zt, a3 as Qe, a4 as io, f as mt, u as lo, v as ro } from "./layers.BFJ7oQiY.js";
|
|
19
|
-
import { I as ao, $ as kt, J as co, K as en, O as uo, P as fo, z as po, Q as at, R as tn, U as mo } from "./layers.BDsvvINb.js";
|
|
20
|
-
import { w as et, F as Be, n as go, D as $e, O as ct, R as ho, G as bo, H as gt, J as qe, L as $t, M as yo, i as nn, u as Co, A as vt, B as on, N as Rt, P as Oe, Q as _o, S as To, T as xo, z as ko } from "./layers.D0Z-zLAV.js";
|
|
21
|
-
import { $getSelectionStyleValueForProperty as tt, $patchStyleText as Bt } from "@lexical/selection";
|
|
22
|
-
import { NewColorPicker as ht } from "@layers-app/shared";
|
|
23
|
-
import { C as ut, I as X, A as vo } from "./layers.BwyONivc.js";
|
|
24
|
-
import { l as Io } from "./layers.QjAkD17S.js";
|
|
25
|
-
import { $isDecoratorBlockNode as wo } from "@lexical/react/LexicalDecoratorBlockNode";
|
|
26
|
-
import { useResizeObserver as So, useClickOutside as Mo } from "@mantine/hooks";
|
|
27
|
-
import { I as Ao, f as Po } from "./layers.ahDFHQXD.js";
|
|
28
|
-
const Do = 4, Lo = 2, No = "draggable-block-menu", Oo = 16, Ft = "application/x-lexical-drag-block", It = (e) => e ? e.match(/(\d*\.?\d+)%/g) : [], $o = (e) => e < 0 ? 0 : e > 100 ? 100 : e, sn = (e, t, n) => {
|
|
29
|
-
let i = 0, s = [];
|
|
30
|
-
e.update(() => {
|
|
31
|
-
if (e && t) {
|
|
32
|
-
const c = e.getElementByKey(t.getKey());
|
|
33
|
-
if (c) {
|
|
34
|
-
const d = c.style;
|
|
35
|
-
s = It(
|
|
36
|
-
d.getPropertyValue("grid-template-columns")
|
|
37
|
-
).map((u) => u.slice(0, -1)), i = s ? s.length : 0;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const r = 100 / (i + 1), l = [...s];
|
|
41
|
-
l.splice(n, 0, `${r}%`);
|
|
42
|
-
let a = r / i;
|
|
43
|
-
for (let c = 0; c < l.length; c++)
|
|
44
|
-
if (n !== c) {
|
|
45
|
-
const d = Number(l[c]) - a;
|
|
46
|
-
l[c] = `minmax(100px,${$o(d)}%)`;
|
|
47
|
-
} else
|
|
48
|
-
l[c] = `minmax(100px,${l[c]})`;
|
|
49
|
-
t.setTemplateColumns(l.join(" "));
|
|
50
|
-
});
|
|
51
|
-
}, bt = (e, t, n, i) => {
|
|
52
|
-
e.update(() => {
|
|
53
|
-
const s = e.getElementByKey(t.getKey());
|
|
54
|
-
if (!s) return;
|
|
55
|
-
let r = i;
|
|
56
|
-
n < i && (r = i - 1);
|
|
57
|
-
const a = s.style.getPropertyValue("grid-template-columns").match(/minmax\([^)]*\)|\S+/g) || [], c = a.splice(n, 1)[0];
|
|
58
|
-
a.splice(r, 0, c), t.setTemplateColumns(a.join(" "));
|
|
59
|
-
});
|
|
60
|
-
}, He = (e, t) => (e != null && e.children ? Array.from(e.children) : []).indexOf(t);
|
|
61
|
-
function Ro(e, t, n, i) {
|
|
62
|
-
var c;
|
|
63
|
-
let s = e.getAttribute("data-direction") === "left", r = e.getAttribute("data-direction") === "right", l = e.getAttribute("data-index"), a = e.getAttribute("data-index-start");
|
|
64
|
-
if (s || r || l) {
|
|
65
|
-
let d = (c = n.getParent()) == null ? void 0 : c.getParent();
|
|
66
|
-
if (n instanceof Ee && (d = n), n instanceof Xe || n instanceof Ee) {
|
|
67
|
-
const u = d == null ? void 0 : d.getChildren();
|
|
68
|
-
let C = i instanceof Xe;
|
|
69
|
-
if ((u == null ? void 0 : u.length) >= 4 && !C) return !0;
|
|
70
|
-
t.update(() => {
|
|
71
|
-
var _;
|
|
72
|
-
let f = 0;
|
|
73
|
-
s ? f = 0 : r ? f = ((_ = d == null ? void 0 : d.getChildren()) == null ? void 0 : _.length) - 1 : f = Number(l), C ? bt(
|
|
74
|
-
t,
|
|
75
|
-
d,
|
|
76
|
-
Number(a),
|
|
77
|
-
f
|
|
78
|
-
) : sn(t, d, f);
|
|
79
|
-
let w = null;
|
|
80
|
-
f !== void 0 && t.update(() => {
|
|
81
|
-
if (w = d.getChildren()[f], C)
|
|
82
|
-
n instanceof Ee ? w.insertAfter(i.getParent()) : w.insertBefore(i.getParent());
|
|
83
|
-
else if (r)
|
|
84
|
-
w.insertAfter(
|
|
85
|
-
ke().append(i).append(ve())
|
|
86
|
-
);
|
|
87
|
-
else {
|
|
88
|
-
const k = i.getParent(), P = k == null ? void 0 : k.getParent();
|
|
89
|
-
je(k) && (k == null ? void 0 : k.getChildrenSize()) === 2 && je(k) && Lt(P) && et(t, k, P), w.insertBefore(
|
|
90
|
-
ke().append(i).append(ve())
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
} else
|
|
96
|
-
t.update(() => {
|
|
97
|
-
const u = so(ao);
|
|
98
|
-
let C;
|
|
99
|
-
if (Je(n) || kt(n)) {
|
|
100
|
-
const f = i.getParent(), w = f == null ? void 0 : f.getParent();
|
|
101
|
-
if (je(f) && (f == null ? void 0 : f.getChildrenSize()) === 2 && Lt(w)) {
|
|
102
|
-
const k = w.getParent(), P = k == null ? void 0 : k.getParent(), N = w.getChildren(), I = N.findIndex(
|
|
103
|
-
(O) => O === f
|
|
104
|
-
) === 0 ? 1 : 0, D = N[I];
|
|
105
|
-
if (je(D)) {
|
|
106
|
-
const O = D.getChildren()[0];
|
|
107
|
-
Je(P) && (P.append(O), w.remove(), C = Be(P));
|
|
108
|
-
}
|
|
109
|
-
} else
|
|
110
|
-
C = Be(n, i);
|
|
111
|
-
} else
|
|
112
|
-
C = Be(n);
|
|
113
|
-
C && (s ? (u.append(
|
|
114
|
-
ke().append(i).append(ve())
|
|
115
|
-
), u.append(
|
|
116
|
-
ke().append(C).append(ve())
|
|
117
|
-
)) : (u.append(
|
|
118
|
-
ke().append(C).append(ve())
|
|
119
|
-
), u.append(
|
|
120
|
-
ke().append(i).append(ve())
|
|
121
|
-
)), n.insertAfter(u), n.remove(), C.selectStart());
|
|
122
|
-
});
|
|
123
|
-
return !0;
|
|
124
|
-
}
|
|
125
|
-
return !1;
|
|
126
|
-
}
|
|
127
|
-
function Bo(e, t, n = "right", i = !1) {
|
|
128
|
-
e.update(() => {
|
|
129
|
-
const s = oe(t), r = s == null ? void 0 : s.getParent();
|
|
130
|
-
if (r) {
|
|
131
|
-
if (It(r.__templateColumns).length === 4)
|
|
132
|
-
return;
|
|
133
|
-
let a = He(
|
|
134
|
-
t.parentElement,
|
|
135
|
-
t
|
|
136
|
-
);
|
|
137
|
-
n === "right" && (a = a + 1), sn(e, r, a);
|
|
138
|
-
}
|
|
139
|
-
const l = ke().append(Pe()).append(ve());
|
|
140
|
-
s && (n === "right" ? i ? (s.insertBefore(Be(s)), s.selectStart()) : (s.insertAfter(l), l == null || l.selectStart()) : (s.insertBefore(l), l.selectStart()));
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const Fo = (e, t) => {
|
|
144
|
-
const n = t == null ? void 0 : t.getParent();
|
|
145
|
-
let i = It(
|
|
146
|
-
n == null ? void 0 : n.getTemplateColumns()
|
|
147
|
-
);
|
|
148
|
-
const s = n == null ? void 0 : n.getChildren();
|
|
149
|
-
let r = 0;
|
|
150
|
-
if (s && t) {
|
|
151
|
-
for (let u = 0; u < s.length; u++)
|
|
152
|
-
if (s[u].__key === t.__key) {
|
|
153
|
-
r = u;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
i.splice(r, 1);
|
|
158
|
-
const l = i.map((u) => parseFloat(u)), a = l.reduce((u, C) => u + C, 0), d = l.map((u) => u / a * 100).map((u) => `minmax(50px,${u.toFixed(2)}%)`);
|
|
159
|
-
n == null || n.setTemplateColumns(
|
|
160
|
-
d.join(" ")
|
|
161
|
-
);
|
|
162
|
-
}, zo = (e) => e.className.includes("editor-image") || e.className.includes("video-container") ? e : e.className.includes("editor-excalidraw") ? e.firstChild : null, ln = (e, t) => t != null && t.__key && e !== t.__key ? ln(e, t == null ? void 0 : t.getParent()) : e === (t == null ? void 0 : t.__key), zt = (e, t, n) => {
|
|
163
|
-
e.update(() => {
|
|
164
|
-
var l, a, c;
|
|
165
|
-
const i = (l = t == null ? void 0 : t.getParent()) == null ? void 0 : l.getParent(), s = t == null ? void 0 : t.getParent(), r = n === "right" ? (a = t == null ? void 0 : t.getParent()) == null ? void 0 : a.getNextSibling() : (c = t == null ? void 0 : t.getParent()) == null ? void 0 : c.getPreviousSibling();
|
|
166
|
-
if (s && r && i instanceof Ee) {
|
|
167
|
-
const d = e.getElementByKey(
|
|
168
|
-
s.getKey()
|
|
169
|
-
), u = e.getElementByKey(
|
|
170
|
-
i.getKey()
|
|
171
|
-
), C = He(u, d);
|
|
172
|
-
s && i && r && (n === "right" && (bt(e, i, C + 1, C), r.insertAfter(s)), n === "left" && (bt(e, i, C, C + 1), r.insertBefore(s)));
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
function Ho(e) {
|
|
177
|
-
e && (e.style.display = "none");
|
|
178
|
-
}
|
|
179
|
-
function Ht({
|
|
180
|
-
blockElement: e,
|
|
181
|
-
editor: t,
|
|
182
|
-
isTop: n,
|
|
183
|
-
isClickedBlockRef: i,
|
|
184
|
-
setDraggableBlockElem: s
|
|
185
|
-
}) {
|
|
186
|
-
e && (i.current = !0, t.update(() => {
|
|
187
|
-
const r = oe(e);
|
|
188
|
-
if (r) {
|
|
189
|
-
const l = Pe();
|
|
190
|
-
n ? (r.insertBefore(l), setTimeout(() => {
|
|
191
|
-
s(t.getElementByKey(l.__key)), t.update(() => {
|
|
192
|
-
l.selectStart();
|
|
193
|
-
});
|
|
194
|
-
})) : (r.insertAfter(l), setTimeout(() => {
|
|
195
|
-
s(t.getElementByKey(l.__key)), t.update(() => {
|
|
196
|
-
l.selectEnd();
|
|
197
|
-
});
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
}));
|
|
201
|
-
}
|
|
202
|
-
function Ko(e) {
|
|
203
|
-
const t = (c, d) => c ? parseFloat(window.getComputedStyle(c)[d]) : 0, { marginTop: n, marginBottom: i } = window.getComputedStyle(e), s = t(
|
|
204
|
-
e.previousElementSibling,
|
|
205
|
-
"marginBottom"
|
|
206
|
-
), r = t(
|
|
207
|
-
e.nextElementSibling,
|
|
208
|
-
"marginTop"
|
|
209
|
-
), l = Math.max(
|
|
210
|
-
parseFloat(n),
|
|
211
|
-
s
|
|
212
|
-
);
|
|
213
|
-
return { marginBottom: Math.max(
|
|
214
|
-
parseFloat(i),
|
|
215
|
-
r
|
|
216
|
-
), marginTop: l };
|
|
217
|
-
}
|
|
218
|
-
function Uo(e) {
|
|
219
|
-
return !!e.closest(`.${No}`);
|
|
220
|
-
}
|
|
221
|
-
function Kt(e, t, n, i) {
|
|
222
|
-
if (!e) {
|
|
223
|
-
t.style.opacity = "0";
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
t.style.display = "block";
|
|
227
|
-
let s = null;
|
|
228
|
-
const r = zo(e);
|
|
229
|
-
r && r.style.justifyContent !== "left" && r.firstChild instanceof HTMLElement ? s = r.firstChild.getBoundingClientRect() : s = e.getBoundingClientRect();
|
|
230
|
-
let l = null, a = 0, c = !0, d = 0;
|
|
231
|
-
if (s) {
|
|
232
|
-
let N = e.firstChild instanceof HTMLElement && (e.firstChild.hasAttribute("data-lexical-text") || e.firstChild.tagName === "LI" || e.firstChild.tagName === "A") ? e.firstChild : null;
|
|
233
|
-
if (N && !N.className.includes("editor-image") && e.tagName !== "CODE") {
|
|
234
|
-
const y = window.getComputedStyle(N), I = parseFloat(y.lineHeight), D = parseFloat(y.fontSize);
|
|
235
|
-
d = Math.ceil(D + (I - D) / 2), l = N.getBoundingClientRect();
|
|
236
|
-
} else if (e.firstChild instanceof HTMLElement && e.firstChild.tagName === "BR" && e.tagName !== "CODE") {
|
|
237
|
-
const y = window.getComputedStyle(e, "::before");
|
|
238
|
-
d = parseFloat(y.height) || 30;
|
|
239
|
-
} else e && (e.tagName === "HR" || e.matches(":has(audio)") || e.classList.contains("file-container")) ? d = e.clientHeight : e.firstChild instanceof HTMLElement && e.firstChild.tagName === "SUMMARY" ? d = e.firstChild.clientHeight : (l = s, c = !1);
|
|
240
|
-
}
|
|
241
|
-
const u = n.getBoundingClientRect(), C = (l == null ? void 0 : l.top) || s.top, f = d || a, w = t.clientHeight, _ = f - w;
|
|
242
|
-
let k = !c || !f ? s.top + 7 - u.top : C + _ / 2 - u.top, P = s.left - u.left - w * 2 - 3;
|
|
243
|
-
e.tagName === "LI" && e.getAttribute("role") !== "checkbox" && (P = P - 26, k = k - 1), r && (k = C - u.top + 7, (r.style.justifyContent === "center" || r.style.justifyContent === "right") && (P = P + 10)), e.matches(":has(.resizable-container__handle)") && !e.matches(":has(.hide-padding)") && (k = C - u.top + 27), s.top < 0 && (k = k + -s.top), e.className === "dsd__theme__layoutDivider" && (t.style.display = "none", s.top - t.clientHeight < 0 ? e.style.setProperty(
|
|
244
|
-
"--height-column",
|
|
245
|
-
`${e.clientHeight + s.top - t.clientHeight - 7}px`
|
|
246
|
-
) : e.style.setProperty(
|
|
247
|
-
"--height-column",
|
|
248
|
-
`${e.clientHeight}px`
|
|
249
|
-
)), t.style.opacity = "1", !i && P > -40 && (t.style.transform = `translate(${P}px, ${k}px)`);
|
|
250
|
-
}
|
|
251
|
-
function Ut(e, t) {
|
|
252
|
-
const { transform: n } = t.style;
|
|
253
|
-
t.style.transform = "translateZ(0)", e.setDragImage(t, 0, 0), setTimeout(() => {
|
|
254
|
-
t.style.transform = n;
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
function Go(e, t) {
|
|
258
|
-
const n = document.createElement("div");
|
|
259
|
-
n.style.position = "absolute", n.style.top = "-9999px", n.style.left = "-9999px", t.forEach((i) => {
|
|
260
|
-
const s = i.cloneNode(!0);
|
|
261
|
-
s.style.position = "relative", n.appendChild(s);
|
|
262
|
-
}), document.body.appendChild(n), e.setDragImage(n, 0, 0), setTimeout(() => document.body.removeChild(n), 0);
|
|
263
|
-
}
|
|
264
|
-
function Wo(e, t, n, i, s, r, l) {
|
|
265
|
-
var m;
|
|
266
|
-
const {
|
|
267
|
-
top: a,
|
|
268
|
-
height: c,
|
|
269
|
-
width: d,
|
|
270
|
-
left: u
|
|
271
|
-
} = t.getBoundingClientRect(), {
|
|
272
|
-
top: C,
|
|
273
|
-
left: f,
|
|
274
|
-
width: w
|
|
275
|
-
} = s == null ? void 0 : s.getBoundingClientRect(), { marginTop: _, marginBottom: k } = Ko(t);
|
|
276
|
-
let P = a;
|
|
277
|
-
n >= a ? (l.current.isBottom = !0, P += c + k / 2) : (l.current.isBottom = !1, P -= _ / 2);
|
|
278
|
-
const N = P - C - Lo, y = Oo - Do, D = r.target.closest(
|
|
279
|
-
".dsd__theme__layoutDivider"
|
|
280
|
-
);
|
|
281
|
-
e.setAttribute("data-index", ""), e.style.background = "deepskyblue";
|
|
282
|
-
const O = u - f - y;
|
|
283
|
-
if (i <= u && !D) {
|
|
284
|
-
if (t.closest(".dsd__theme__layoutItem")) return;
|
|
285
|
-
e.style.transform = `translate(${O}px, ${a - C}px)`, e.style.width = "4px", e.style.height = `${c}px`, e.style.opacity = ".4", e.setAttribute("data-direction", "left");
|
|
286
|
-
} else if (i >= w - O && !D && !t.closest(".dsd__theme__layoutItem"))
|
|
287
|
-
t.classList.contains("dsd__theme__layoutContainer") && !e.getAttribute("data-index-start") && t && t.children.length >= 4 && (e.style.background = "red"), e.style.transform = `translate(${w - O}px, ${a - C}px)`, e.style.width = "4px", e.style.height = `${c}px`, e.style.opacity = ".4", e.setAttribute("data-direction", "right");
|
|
288
|
-
else if (D) {
|
|
289
|
-
r.preventDefault();
|
|
290
|
-
const T = (m = D.parentNode) == null ? void 0 : m.parentNode;
|
|
291
|
-
(T == null ? void 0 : T.children.length) === 4 && (e.style.background = "red");
|
|
292
|
-
const v = D.parentNode, S = He(
|
|
293
|
-
T,
|
|
294
|
-
v
|
|
295
|
-
), L = S ? D.getBoundingClientRect().left - f : O + 30;
|
|
296
|
-
e.style.transform = `translate(${L}px, ${a - C}px)`, e.style.width = "4px", e.style.height = `${c}px`, e.style.opacity = ".4", e.setAttribute("data-index", `${S}`);
|
|
297
|
-
} else
|
|
298
|
-
e.style.transform = `translate(${O}px, ${N}px)`, e.style.width = `${d + y}px`, e.style.opacity = ".4", e.style.height = "4px", e.setAttribute("data-direction", "");
|
|
299
|
-
}
|
|
300
|
-
function Gt(e) {
|
|
301
|
-
e && (e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)");
|
|
302
|
-
}
|
|
303
|
-
const jo = ({
|
|
304
|
-
hoveredButton: e,
|
|
305
|
-
insertNewParagraph: t,
|
|
306
|
-
currentDraggableBlockRef: n,
|
|
307
|
-
setHoveredButton: i,
|
|
308
|
-
isClickedBlockRef: s,
|
|
309
|
-
setDraggableBlockElem: r,
|
|
310
|
-
editor: l,
|
|
311
|
-
t: a
|
|
312
|
-
}) => /* @__PURE__ */ o(
|
|
313
|
-
"div",
|
|
314
|
-
{
|
|
315
|
-
className: `icon add-block-menu ${e ? "active" : ""}`,
|
|
316
|
-
onClick: () => {
|
|
317
|
-
t({
|
|
318
|
-
blockElement: n.current.htmlElement,
|
|
319
|
-
editor: l,
|
|
320
|
-
isTop: !1,
|
|
321
|
-
isClickedBlockRef: s,
|
|
322
|
-
setDraggableBlockElem: r
|
|
323
|
-
}), i("both");
|
|
324
|
-
},
|
|
325
|
-
onMouseEnter: () => {
|
|
326
|
-
i("bottom");
|
|
327
|
-
},
|
|
328
|
-
onMouseLeave: () => {
|
|
329
|
-
i("both");
|
|
330
|
-
},
|
|
331
|
-
children: /* @__PURE__ */ o(
|
|
332
|
-
ie,
|
|
333
|
-
{
|
|
334
|
-
openDelay: 300,
|
|
335
|
-
label: a("editor.hoverOptions.addNewBlockAbove"),
|
|
336
|
-
position: "bottom",
|
|
337
|
-
disabled: s.current || !e,
|
|
338
|
-
children: /* @__PURE__ */ o(
|
|
339
|
-
ze,
|
|
340
|
-
{
|
|
341
|
-
radius: "sm",
|
|
342
|
-
color: "gray",
|
|
343
|
-
size: "xs",
|
|
344
|
-
variant: "subtle",
|
|
345
|
-
"aria-label": "Settings",
|
|
346
|
-
children: e === "bottom" ? /* @__PURE__ */ o(Vt, {}) : /* @__PURE__ */ o(Et, {})
|
|
347
|
-
}
|
|
348
|
-
)
|
|
349
|
-
}
|
|
350
|
-
)
|
|
351
|
-
}
|
|
352
|
-
), qo = ({
|
|
353
|
-
hoveredButton: e,
|
|
354
|
-
insertNewParagraph: t,
|
|
355
|
-
currentDraggableBlockRef: n,
|
|
356
|
-
setHoveredButton: i,
|
|
357
|
-
isClickedBlockRef: s,
|
|
358
|
-
setDraggableBlockElem: r,
|
|
359
|
-
editor: l,
|
|
360
|
-
t: a
|
|
361
|
-
}) => /* @__PURE__ */ o(
|
|
362
|
-
"div",
|
|
363
|
-
{
|
|
364
|
-
className: `icon add-block-menu add-block-menu_top ${e ? "active" : ""}`,
|
|
365
|
-
onClick: () => {
|
|
366
|
-
t({
|
|
367
|
-
blockElement: n.current.htmlElement,
|
|
368
|
-
editor: l,
|
|
369
|
-
isTop: !0,
|
|
370
|
-
isClickedBlockRef: s,
|
|
371
|
-
setDraggableBlockElem: r
|
|
372
|
-
}), i("both");
|
|
373
|
-
},
|
|
374
|
-
onMouseEnter: () => {
|
|
375
|
-
i("top");
|
|
376
|
-
},
|
|
377
|
-
onMouseLeave: () => {
|
|
378
|
-
i("both");
|
|
379
|
-
},
|
|
380
|
-
children: /* @__PURE__ */ o(
|
|
381
|
-
ie,
|
|
382
|
-
{
|
|
383
|
-
disabled: s.current || !e,
|
|
384
|
-
openDelay: 300,
|
|
385
|
-
label: a("editor.hoverOptions.addNewBlockBelow"),
|
|
386
|
-
position: "top",
|
|
387
|
-
children: /* @__PURE__ */ o(
|
|
388
|
-
ze,
|
|
389
|
-
{
|
|
390
|
-
radius: "sm",
|
|
391
|
-
color: "gray",
|
|
392
|
-
size: "xs",
|
|
393
|
-
variant: "subtle",
|
|
394
|
-
"aria-label": "Settings",
|
|
395
|
-
children: e === "top" ? /* @__PURE__ */ o(Vt, {}) : /* @__PURE__ */ o(Et, {})
|
|
396
|
-
}
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
)
|
|
400
|
-
}
|
|
401
|
-
);
|
|
402
|
-
function rn(e, t) {
|
|
403
|
-
var r, l;
|
|
404
|
-
const n = (r = t.exportDOM) == null ? void 0 : r.call(t, e), i = (n == null ? void 0 : n.element) ?? null;
|
|
405
|
-
if (Me(t)) {
|
|
406
|
-
const a = i ?? document.createElement("div"), c = ((l = t.getChildren) == null ? void 0 : l.call(t)) ?? [];
|
|
407
|
-
for (const d of c) {
|
|
408
|
-
const u = rn(e, d);
|
|
409
|
-
if (u) a.appendChild(u);
|
|
410
|
-
else {
|
|
411
|
-
const C = typeof d.getTextContent == "function" ? d.getTextContent() : "";
|
|
412
|
-
C && a.appendChild(document.createTextNode(C));
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
return typeof (n == null ? void 0 : n.after) == "function" && n.after(a), a;
|
|
416
|
-
}
|
|
417
|
-
if (i)
|
|
418
|
-
return typeof (n == null ? void 0 : n.after) == "function" && n.after(i), i;
|
|
419
|
-
const s = typeof t.getTextContent == "function" ? t.getTextContent() : "";
|
|
420
|
-
return s ? document.createTextNode(s) : null;
|
|
421
|
-
}
|
|
422
|
-
async function Wt(e, t) {
|
|
423
|
-
const n = e.getRootElement(), i = Array.from(n.querySelectorAll(".selected-block"));
|
|
424
|
-
if (!i.length) return;
|
|
425
|
-
let s = "", r = "";
|
|
426
|
-
e.getEditorState().read(() => {
|
|
427
|
-
e.update(() => {
|
|
428
|
-
let l = i.map((c) => oe(c)).filter((c) => !!c);
|
|
429
|
-
s = l.map(
|
|
430
|
-
(c) => typeof c.getTextContent == "function" ? c.getTextContent() : ""
|
|
431
|
-
).filter(Boolean).join(`
|
|
432
|
-
`);
|
|
433
|
-
const a = document.createElement("div");
|
|
434
|
-
l.forEach((c) => {
|
|
435
|
-
const d = rn(e, c);
|
|
436
|
-
t === "cut" && c.remove(), d && a.appendChild(d);
|
|
437
|
-
}), r = a.innerHTML;
|
|
438
|
-
});
|
|
439
|
-
}), (s || r) && await Yo(s, r);
|
|
440
|
-
}
|
|
441
|
-
async function Yo(e, t) {
|
|
442
|
-
if (navigator.clipboard && "write" in navigator.clipboard && window.ClipboardItem) {
|
|
443
|
-
const n = new ClipboardItem({
|
|
444
|
-
"text/plain": new Blob([e], { type: "text/plain" }),
|
|
445
|
-
...t ? { "text/html": new Blob([t], { type: "text/html" }) } : {}
|
|
446
|
-
});
|
|
447
|
-
await navigator.clipboard.write([n]);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
const jt = (e, t, n, i) => {
|
|
451
|
-
if (n)
|
|
452
|
-
if (i === "layout") {
|
|
453
|
-
const s = n.getParent(), r = s.getParent();
|
|
454
|
-
et(e, s, r), t("delete");
|
|
455
|
-
} else {
|
|
456
|
-
const s = n == null ? void 0 : n.getParent();
|
|
457
|
-
if (s instanceof Ze && s.getChildren().length === 2) {
|
|
458
|
-
const r = s, l = s.getParent();
|
|
459
|
-
if (n.__type === "image") {
|
|
460
|
-
r.append(Pe());
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
et(e, r, l);
|
|
464
|
-
}
|
|
465
|
-
go(e, n), t("delete");
|
|
466
|
-
}
|
|
467
|
-
}, qt = (e) => {
|
|
468
|
-
const t = e._rootElement;
|
|
469
|
-
return Array.from(t.querySelectorAll(".selected-block"));
|
|
470
|
-
}, yt = (e, t, n, i = !1) => {
|
|
471
|
-
t && e.update(() => {
|
|
472
|
-
const s = e.getElementByKey(
|
|
473
|
-
t.getParent().getKey()
|
|
474
|
-
);
|
|
475
|
-
Bo(e, s, n, i);
|
|
476
|
-
});
|
|
477
|
-
}, Vo = (e, t, n, i) => {
|
|
478
|
-
if (i === "layout")
|
|
479
|
-
yt(e, n, "right", !0);
|
|
480
|
-
else {
|
|
481
|
-
const s = e._rootElement, r = Array.from(
|
|
482
|
-
s.querySelectorAll(".selected-block")
|
|
483
|
-
).reverse();
|
|
484
|
-
r.length && (e.update(() => {
|
|
485
|
-
const l = oe(r[0]);
|
|
486
|
-
r.forEach((a) => {
|
|
487
|
-
let c = oe(a);
|
|
488
|
-
c && (l == null || l.insertAfter(Be(c))), co(a);
|
|
489
|
-
});
|
|
490
|
-
}), t());
|
|
491
|
-
}
|
|
492
|
-
}, Eo = ({
|
|
493
|
-
editor: e,
|
|
494
|
-
onChange: t,
|
|
495
|
-
currentEditorNode: n,
|
|
496
|
-
textBlock: i,
|
|
497
|
-
t: s,
|
|
498
|
-
isDisabledAddColumnButton: r,
|
|
499
|
-
disabledMoveColumnButtons: l
|
|
500
|
-
}) => {
|
|
501
|
-
const { fetchUploadMedia: a, excludeNodes: c } = Ae(De), [d, u] = b("inherit"), [C, f] = b("inherit"), [w, _] = b("inherit"), [k, P] = b("");
|
|
502
|
-
Y(() => {
|
|
503
|
-
const m = n == null ? void 0 : n.__type;
|
|
504
|
-
e.read(() => {
|
|
505
|
-
var T;
|
|
506
|
-
((T = n == null ? void 0 : n.getParent()) == null ? void 0 : T.__type) === "layout-item" ? P("layout") : P(m === "callout-wrapper" ? m : "block");
|
|
507
|
-
});
|
|
508
|
-
}, [n == null ? void 0 : n.__key]);
|
|
509
|
-
const N = (m) => m.split(";").filter(Boolean).reduce((T, v) => {
|
|
510
|
-
const [S, L] = v.split(":").map((G) => G.trim());
|
|
511
|
-
return S && L && (T[S] = L), T;
|
|
512
|
-
}, {}), y = (m) => Object.entries(m).map(([T, v]) => `${T}: ${v}`).join("; "), I = ye(
|
|
513
|
-
(m) => {
|
|
514
|
-
e.update(() => {
|
|
515
|
-
const T = qt(e).map((S) => oe(S)).filter(Boolean), v = (S) => {
|
|
516
|
-
if (typeof S.getStyle == "function" && typeof S.setStyle == "function") {
|
|
517
|
-
const L = N(S.getStyle());
|
|
518
|
-
L.color = m.color, L["background-color"] = m.bgColor, S.setStyle(y(L)), u(m.bgColor), _(m.color);
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
T.forEach((S) => {
|
|
522
|
-
if (S instanceof Jt) {
|
|
523
|
-
S.getChildren().forEach((L) => {
|
|
524
|
-
const G = L.getFirstChild();
|
|
525
|
-
G instanceof Nt && v(G);
|
|
526
|
-
});
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
if (S instanceof Un) {
|
|
530
|
-
const L = S.getFirstChild();
|
|
531
|
-
L instanceof Nt && v(L);
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
},
|
|
536
|
-
[u, _]
|
|
537
|
-
), D = (m, T) => {
|
|
538
|
-
const v = T || k;
|
|
539
|
-
v === "callout-wrapper" && n instanceof Ot ? e.update(() => {
|
|
540
|
-
const S = fo(m);
|
|
541
|
-
n.setType(S ? m.meta.type : void 0), n.setBackgroundColor(m.value);
|
|
542
|
-
}) : v === "layout-color" ? e.update(() => {
|
|
543
|
-
const S = n == null ? void 0 : n.getParent(), L = m.value === C ? "inherit" : m.value;
|
|
544
|
-
S instanceof Ze && S.setLayoutBackground(L);
|
|
545
|
-
}) : I({
|
|
546
|
-
color: w,
|
|
547
|
-
bgColor: d,
|
|
548
|
-
[m.mode === "background" ? "bgColor" : m.mode]: m.value
|
|
549
|
-
});
|
|
550
|
-
}, O = (m) => {
|
|
551
|
-
const T = qt(e);
|
|
552
|
-
T.length ? T.forEach((v) => {
|
|
553
|
-
e.update(() => {
|
|
554
|
-
let S = oe(v);
|
|
555
|
-
S && jt(e, t, S, m);
|
|
556
|
-
});
|
|
557
|
-
}) : e.update(() => {
|
|
558
|
-
let v = oe(T[0]);
|
|
559
|
-
jt(e, t, v, m);
|
|
560
|
-
});
|
|
561
|
-
};
|
|
562
|
-
return Y(() => {
|
|
563
|
-
setTimeout(() => {
|
|
564
|
-
e.read(() => {
|
|
565
|
-
if (k === "callout-wrapper" && n instanceof Ot) {
|
|
566
|
-
u(n.__backgroundColor);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
const m = n == null ? void 0 : n.getParent();
|
|
570
|
-
m instanceof Ze && f(m.__backgroundColor);
|
|
571
|
-
const T = ue();
|
|
572
|
-
de(T) && (_(
|
|
573
|
-
tt(T, "color", "inherit")
|
|
574
|
-
), u(
|
|
575
|
-
tt(
|
|
576
|
-
T,
|
|
577
|
-
"background-color",
|
|
578
|
-
"inherit"
|
|
579
|
-
)
|
|
580
|
-
));
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
}, []), /* @__PURE__ */ H(E, { children: [
|
|
584
|
-
/* @__PURE__ */ o(
|
|
585
|
-
$.Item,
|
|
586
|
-
{
|
|
587
|
-
onMouseDown: (m) => {
|
|
588
|
-
m.preventDefault(), Wt(e, "copy"), t("copy");
|
|
589
|
-
},
|
|
590
|
-
leftSection: /* @__PURE__ */ o(xn, { style: { width: V(14), height: V(14) } }),
|
|
591
|
-
children: s("editor.link.copy")
|
|
592
|
-
}
|
|
593
|
-
),
|
|
594
|
-
/* @__PURE__ */ o(
|
|
595
|
-
$.Item,
|
|
596
|
-
{
|
|
597
|
-
onMouseDown: (m) => {
|
|
598
|
-
m.preventDefault(), Wt(e, "cut"), t("cut");
|
|
599
|
-
},
|
|
600
|
-
leftSection: /* @__PURE__ */ o(kn, { style: { width: V(14), height: V(14) } }),
|
|
601
|
-
children: s("editor.contextMenu.cut")
|
|
602
|
-
}
|
|
603
|
-
),
|
|
604
|
-
/* @__PURE__ */ o(
|
|
605
|
-
$.Item,
|
|
606
|
-
{
|
|
607
|
-
onClick: () => O(""),
|
|
608
|
-
leftSection: /* @__PURE__ */ o(ft, { style: { width: V(14), height: V(14) } }),
|
|
609
|
-
children: s("editor.contextMenu.delete")
|
|
610
|
-
}
|
|
611
|
-
),
|
|
612
|
-
/* @__PURE__ */ o(
|
|
613
|
-
$.Item,
|
|
614
|
-
{
|
|
615
|
-
disabled: k === "layout" && r,
|
|
616
|
-
onClick: () => Vo(e, t, n, k),
|
|
617
|
-
leftSection: /* @__PURE__ */ o(Qt, { style: { width: V(14), height: V(14) } }),
|
|
618
|
-
children: s("editor.contextMenu.duplicate")
|
|
619
|
-
}
|
|
620
|
-
),
|
|
621
|
-
i === "text" && k !== "callout-wrapper" && /* @__PURE__ */ H(E, { children: [
|
|
622
|
-
/* @__PURE__ */ o($.Divider, {}),
|
|
623
|
-
/* @__PURE__ */ o(
|
|
624
|
-
en,
|
|
625
|
-
{
|
|
626
|
-
disabled: !1,
|
|
627
|
-
blockType: "paragraph",
|
|
628
|
-
rootType: "root",
|
|
629
|
-
editor: e,
|
|
630
|
-
mode: "editor",
|
|
631
|
-
fetchUploadMedia: a,
|
|
632
|
-
excludeNodes: c,
|
|
633
|
-
onChange: t,
|
|
634
|
-
menuProps: {
|
|
635
|
-
trigger: "hover",
|
|
636
|
-
position: "right-start",
|
|
637
|
-
offset: { mainAxis: 0, alignmentAxis: 0 }
|
|
638
|
-
},
|
|
639
|
-
children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
640
|
-
ut,
|
|
641
|
-
{
|
|
642
|
-
label: s("editor.toolbar.turnInto"),
|
|
643
|
-
icon: /* @__PURE__ */ o(
|
|
644
|
-
vn,
|
|
645
|
-
{
|
|
646
|
-
style: { width: V(14), height: V(14) }
|
|
647
|
-
}
|
|
648
|
-
)
|
|
649
|
-
}
|
|
650
|
-
) })
|
|
651
|
-
}
|
|
652
|
-
)
|
|
653
|
-
] }),
|
|
654
|
-
(i === "text" || k == "callout-wrapper") && /* @__PURE__ */ H(E, { children: [
|
|
655
|
-
/* @__PURE__ */ o($.Divider, {}),
|
|
656
|
-
/* @__PURE__ */ o(
|
|
657
|
-
ht,
|
|
658
|
-
{
|
|
659
|
-
data: {
|
|
660
|
-
callout: {
|
|
661
|
-
label: s("editor.colors.theme"),
|
|
662
|
-
filled: !0,
|
|
663
|
-
palette: uo.map((m) => ({
|
|
664
|
-
label: s(`editor.colors.callout.${m.name}`),
|
|
665
|
-
value: mn(m.color, 0.19),
|
|
666
|
-
icon: m.icon,
|
|
667
|
-
meta: { type: m.name, emoji: m.emoji }
|
|
668
|
-
}))
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
modes: k === "callout-wrapper" ? ["callout", "background"] : ["color", "background"],
|
|
672
|
-
value: {
|
|
673
|
-
color: w,
|
|
674
|
-
background: d,
|
|
675
|
-
callout: d
|
|
676
|
-
},
|
|
677
|
-
onChange: (m) => {
|
|
678
|
-
D(m), t(), $e(e);
|
|
679
|
-
},
|
|
680
|
-
hideInherit: !0,
|
|
681
|
-
target: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
682
|
-
ut,
|
|
683
|
-
{
|
|
684
|
-
label: s(k === "callout-wrapper" ? "editor.contextMenu.appearance" : "editor.toolbar.color"),
|
|
685
|
-
icon: /* @__PURE__ */ o(St, { size: 14 })
|
|
686
|
-
}
|
|
687
|
-
) }),
|
|
688
|
-
menuProps: {
|
|
689
|
-
trigger: "hover",
|
|
690
|
-
position: "right-start",
|
|
691
|
-
offset: { mainAxis: 0, alignmentAxis: 0 }
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
)
|
|
695
|
-
] }),
|
|
696
|
-
k === "layout" && /* @__PURE__ */ H(E, { children: [
|
|
697
|
-
/* @__PURE__ */ o($.Divider, {}),
|
|
698
|
-
/* @__PURE__ */ o(
|
|
699
|
-
ht,
|
|
700
|
-
{
|
|
701
|
-
modes: ["background"],
|
|
702
|
-
value: {
|
|
703
|
-
background: C
|
|
704
|
-
},
|
|
705
|
-
onChange: (m) => {
|
|
706
|
-
D(m, "layout-color"), t(), $e(e);
|
|
707
|
-
},
|
|
708
|
-
hideInherit: !0,
|
|
709
|
-
target: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
710
|
-
ut,
|
|
711
|
-
{
|
|
712
|
-
label: s("editor.column.changeColor"),
|
|
713
|
-
icon: /* @__PURE__ */ o(St, { size: 14 })
|
|
714
|
-
}
|
|
715
|
-
) }),
|
|
716
|
-
menuProps: {
|
|
717
|
-
trigger: "hover",
|
|
718
|
-
position: "right-start",
|
|
719
|
-
offset: { mainAxis: 0, alignmentAxis: 0 }
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
),
|
|
723
|
-
/* @__PURE__ */ o(
|
|
724
|
-
$.Item,
|
|
725
|
-
{
|
|
726
|
-
disabled: r,
|
|
727
|
-
onClick: () => {
|
|
728
|
-
yt(e, n, "left");
|
|
729
|
-
},
|
|
730
|
-
leftSection: /* @__PURE__ */ o(
|
|
731
|
-
In,
|
|
732
|
-
{
|
|
733
|
-
style: { width: V(14), height: V(14) }
|
|
734
|
-
}
|
|
735
|
-
),
|
|
736
|
-
children: s("editor.column.addLeft")
|
|
737
|
-
}
|
|
738
|
-
),
|
|
739
|
-
/* @__PURE__ */ o(
|
|
740
|
-
$.Item,
|
|
741
|
-
{
|
|
742
|
-
disabled: r,
|
|
743
|
-
onClick: () => {
|
|
744
|
-
yt(e, n, "right");
|
|
745
|
-
},
|
|
746
|
-
leftSection: /* @__PURE__ */ o(
|
|
747
|
-
lt,
|
|
748
|
-
{
|
|
749
|
-
style: { width: V(14), height: V(14) }
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
children: s("editor.column.addRight")
|
|
753
|
-
}
|
|
754
|
-
),
|
|
755
|
-
/* @__PURE__ */ o(
|
|
756
|
-
$.Item,
|
|
757
|
-
{
|
|
758
|
-
disabled: l.left,
|
|
759
|
-
onClick: () => {
|
|
760
|
-
zt(e, n, "left"), $e(e);
|
|
761
|
-
},
|
|
762
|
-
leftSection: /* @__PURE__ */ o(
|
|
763
|
-
lt,
|
|
764
|
-
{
|
|
765
|
-
style: { width: V(14), height: V(14) }
|
|
766
|
-
}
|
|
767
|
-
),
|
|
768
|
-
children: s("editor.column.moveLeft")
|
|
769
|
-
}
|
|
770
|
-
),
|
|
771
|
-
/* @__PURE__ */ o(
|
|
772
|
-
$.Item,
|
|
773
|
-
{
|
|
774
|
-
disabled: l.right,
|
|
775
|
-
onClick: () => {
|
|
776
|
-
zt(e, n, "right"), $e(e);
|
|
777
|
-
},
|
|
778
|
-
leftSection: /* @__PURE__ */ o(
|
|
779
|
-
lt,
|
|
780
|
-
{
|
|
781
|
-
style: { width: V(14), height: V(14) }
|
|
782
|
-
}
|
|
783
|
-
),
|
|
784
|
-
children: s("editor.column.moveRight")
|
|
785
|
-
}
|
|
786
|
-
),
|
|
787
|
-
/* @__PURE__ */ o(
|
|
788
|
-
$.Item,
|
|
789
|
-
{
|
|
790
|
-
onClick: () => O("layout"),
|
|
791
|
-
leftSection: /* @__PURE__ */ o(ft, { style: { width: V(14), height: V(14) } }),
|
|
792
|
-
children: s("editor.column.deleteColumn")
|
|
793
|
-
}
|
|
794
|
-
)
|
|
795
|
-
] })
|
|
796
|
-
] });
|
|
797
|
-
};
|
|
798
|
-
function Qo(e) {
|
|
799
|
-
if (!e) return window;
|
|
800
|
-
let t = e;
|
|
801
|
-
for (; t; ) {
|
|
802
|
-
if (t === document.body || t === document.documentElement)
|
|
803
|
-
return window;
|
|
804
|
-
const i = getComputedStyle(t).overflowY;
|
|
805
|
-
if ((i === "auto" || i === "scroll" || i === "overlay") && t.scrollHeight > t.clientHeight)
|
|
806
|
-
return t;
|
|
807
|
-
t = t.parentElement;
|
|
808
|
-
}
|
|
809
|
-
return window;
|
|
810
|
-
}
|
|
811
|
-
function Xo(e, t) {
|
|
812
|
-
let n = 150;
|
|
813
|
-
const { clientY: i } = e;
|
|
814
|
-
if (t === window) {
|
|
815
|
-
const s = window.innerHeight;
|
|
816
|
-
i < n ? window.scrollBy(0, Math.max(-15, (i - n) / 15)) : i > s - n && window.scrollBy(
|
|
817
|
-
0,
|
|
818
|
-
Math.min(15, (i - (s - n)) / 15)
|
|
819
|
-
);
|
|
820
|
-
} else {
|
|
821
|
-
n = 100;
|
|
822
|
-
const s = t.getBoundingClientRect();
|
|
823
|
-
i < s.top + n ? t.scrollTop -= 5 : i > s.bottom - n && (t.scrollTop += 5);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
const Jo = Io.throttle(
|
|
827
|
-
(e, t) => {
|
|
828
|
-
e.preventDefault(), Xo(e, t);
|
|
829
|
-
},
|
|
830
|
-
16
|
|
831
|
-
);
|
|
832
|
-
let Ye = null;
|
|
833
|
-
function Zo(e) {
|
|
834
|
-
return e ? e.classList.contains("dsd__theme__table-scrollable-wrapper") ? e.firstElementChild : e : null;
|
|
835
|
-
}
|
|
836
|
-
function es(e, t, n) {
|
|
837
|
-
const i = ce(null), s = ce(null), r = ce(!1), l = ce(!1), a = ce({
|
|
838
|
-
htmlElement: null,
|
|
839
|
-
lexicalNode: null,
|
|
840
|
-
isBottom: !1
|
|
841
|
-
}), c = ce(null), [d, u] = b(null), { disable: C } = Ae(De), [f, w] = b(!1), [_, k] = b({ opened: !1 }), [P, N] = b(""), [y, I] = b(null), [D, O] = b(!1), [m, T] = b({
|
|
842
|
-
left: !1,
|
|
843
|
-
right: !1
|
|
844
|
-
}), [v, S] = b(null), { t: L } = _t(), G = po(
|
|
845
|
-
(g) => {
|
|
846
|
-
const p = g.target;
|
|
847
|
-
l.current || qe(p) && (Uo(p) || e.read(() => {
|
|
848
|
-
var q;
|
|
849
|
-
const A = p.className.includes(
|
|
850
|
-
"content-editable-wrapper"
|
|
851
|
-
), j = A ? At() : oe(p), { htmlElement: U, lexicalNode: M } = $t(
|
|
852
|
-
j,
|
|
853
|
-
e,
|
|
854
|
-
{
|
|
855
|
-
root: !0,
|
|
856
|
-
"layout-container": !0,
|
|
857
|
-
"layout-item": !0,
|
|
858
|
-
callout: !0,
|
|
859
|
-
"collapsible-content": !0
|
|
860
|
-
},
|
|
861
|
-
g
|
|
862
|
-
);
|
|
863
|
-
if ((M == null ? void 0 : M.__type) === "callout" || (M == null ? void 0 : M.__type) === "callout-image" || ((q = M == null ? void 0 : M.getParent()) == null ? void 0 : q.__type) === "callout" && (M == null ? void 0 : M.getPreviousSibling()) === null) {
|
|
864
|
-
u(null);
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
if (!(A && M instanceof Xe || A && !M) && M != null && M.__key) {
|
|
868
|
-
if (M.__type === "layout-container" || M.__type === "layout-item" || M.__type === "collapsible-content") {
|
|
869
|
-
u(null);
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
U && (a.current.htmlElement = U, a.current.lexicalNode = M), (M == null ? void 0 : M.__type) === "collapsible-title" && (a.current.htmlElement = (U == null ? void 0 : U.parentElement) || U, a.current.lexicalNode = M.getParent()), I(null), u(a.current.htmlElement);
|
|
873
|
-
}
|
|
874
|
-
}));
|
|
875
|
-
},
|
|
876
|
-
20,
|
|
877
|
-
50
|
|
878
|
-
);
|
|
879
|
-
Y(() => () => {
|
|
880
|
-
Ye = null;
|
|
881
|
-
}, []), Y(() => {
|
|
882
|
-
function g() {
|
|
883
|
-
l.current || u(null);
|
|
884
|
-
}
|
|
885
|
-
function p(j) {
|
|
886
|
-
if (!r.current)
|
|
887
|
-
return !1;
|
|
888
|
-
const [U] = wt(j);
|
|
889
|
-
if (U)
|
|
890
|
-
return !1;
|
|
891
|
-
const { target: M, dataTransfer: q } = j, ee = (q == null ? void 0 : q.getData(Ft)) || "";
|
|
892
|
-
e.update(() => {
|
|
893
|
-
var Te;
|
|
894
|
-
let h = qn(ee);
|
|
895
|
-
if (!h || !(qe(M) || M.closest(".resizable-container")))
|
|
896
|
-
return !1;
|
|
897
|
-
const { htmlElement: B, lexicalNode: re, isBottom: F } = a.current;
|
|
898
|
-
let z = re, _e = null;
|
|
899
|
-
if (z != null && z.__key && (_e = B), !_e || !z)
|
|
900
|
-
return !1;
|
|
901
|
-
if (z === h)
|
|
902
|
-
return !0;
|
|
903
|
-
if (s.current && Ro(
|
|
904
|
-
s.current,
|
|
905
|
-
e,
|
|
906
|
-
z,
|
|
907
|
-
h
|
|
908
|
-
))
|
|
909
|
-
return !1;
|
|
910
|
-
if (h.__type === "layout-divider") {
|
|
911
|
-
if (h = h.getParent(), re && (h != null && h.isParentOf(re)))
|
|
912
|
-
return !1;
|
|
913
|
-
Fo(e, h);
|
|
914
|
-
}
|
|
915
|
-
if (h.getParent() instanceof Ze && ((Te = h.getParent()) == null ? void 0 : Te.getChildren().length) === 2) {
|
|
916
|
-
const xe = h.getParent(), Se = xe.getParent();
|
|
917
|
-
et(e, xe, Se);
|
|
918
|
-
}
|
|
919
|
-
if (B != null && B.classList.contains("selected-block"))
|
|
920
|
-
return;
|
|
921
|
-
let we;
|
|
922
|
-
const ae = e._rootElement;
|
|
923
|
-
F ? we = Array.from(
|
|
924
|
-
ae.querySelectorAll(".selected-block")
|
|
925
|
-
).reverse() : we = Array.from(
|
|
926
|
-
ae.querySelectorAll(".selected-block")
|
|
927
|
-
), we.length ? we.forEach((xe) => {
|
|
928
|
-
let Se = oe(xe);
|
|
929
|
-
F ? z == null || z.insertAfter(Se) : z == null || z.insertBefore(Se);
|
|
930
|
-
}) : F ? z.insertAfter(h) : z.insertBefore(h), u(null);
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
function A(j) {
|
|
934
|
-
const { target: U } = j;
|
|
935
|
-
qe(U) && U.className === "ContentEditable__root" && Gt(s.current);
|
|
936
|
-
}
|
|
937
|
-
return t == null || t.addEventListener("mousemove", G), t == null || t.addEventListener("drop", p), t == null || t.addEventListener("mouseleave", g), t == null || t.addEventListener("dragleave", A), () => {
|
|
938
|
-
t == null || t.removeEventListener("mousemove", G), t == null || t.addEventListener("drop", p), t == null || t.removeEventListener("mouseleave", g), t == null || t.removeEventListener("dragleave", A);
|
|
939
|
-
};
|
|
940
|
-
}, [t, e]), Y(() => {
|
|
941
|
-
if (i.current) {
|
|
942
|
-
if (l.current || _.opened) return;
|
|
943
|
-
Kt(
|
|
944
|
-
d,
|
|
945
|
-
i.current,
|
|
946
|
-
t,
|
|
947
|
-
_.opened
|
|
948
|
-
);
|
|
949
|
-
}
|
|
950
|
-
}, [
|
|
951
|
-
t,
|
|
952
|
-
d,
|
|
953
|
-
l.current,
|
|
954
|
-
_.opened
|
|
955
|
-
]), Y(() => {
|
|
956
|
-
function g(p) {
|
|
957
|
-
var F, z;
|
|
958
|
-
const { clientY: A, target: j, pageX: U } = p;
|
|
959
|
-
if (!r.current)
|
|
960
|
-
return !1;
|
|
961
|
-
const [M] = wt(p);
|
|
962
|
-
if (M || !qe(j))
|
|
963
|
-
return !1;
|
|
964
|
-
const q = oe(j) || At(), { htmlElement: ee, lexicalNode: h } = $t(
|
|
965
|
-
q,
|
|
966
|
-
e,
|
|
967
|
-
{
|
|
968
|
-
root: !0,
|
|
969
|
-
"layout-container": !0,
|
|
970
|
-
"layout-item": !0,
|
|
971
|
-
"callout-wrapper": !0,
|
|
972
|
-
callout: !0,
|
|
973
|
-
"collapsible-content": !0,
|
|
974
|
-
"collapsible-container": !0
|
|
975
|
-
},
|
|
976
|
-
p
|
|
977
|
-
);
|
|
978
|
-
if (p.preventDefault(), (h == null ? void 0 : h.__type) === "callout" || (h == null ? void 0 : h.__type) === "collapsible-content" || ln(
|
|
979
|
-
c.current,
|
|
980
|
-
h == null ? void 0 : h.getParent()
|
|
981
|
-
) || (h == null ? void 0 : h.__type) === "layout-item" && q.__type !== "root")
|
|
982
|
-
return !1;
|
|
983
|
-
ee && (a.current.htmlElement = ee, a.current.lexicalNode = h);
|
|
984
|
-
let B = null;
|
|
985
|
-
B = a.current.htmlElement || ee, B != null && B.closest(".dsd__theme__layoutContainer") && q.__type === "root" && h && ((h == null ? void 0 : h.__type) === "layout-item" && q.__type === "root" ? (B = B == null ? void 0 : B.parentElement, a.current.htmlElement = B, a.current.lexicalNode = h == null ? void 0 : h.getParent()) : (B = (F = B.parentElement) == null ? void 0 : F.parentElement, a.current.htmlElement = B, a.current.lexicalNode = (z = h.getParent()) == null ? void 0 : z.getParent()));
|
|
986
|
-
const re = s.current;
|
|
987
|
-
return !B && re ? (re.style.background = "transparent", !1) : B === null || re === null || B != null && B.classList.contains("selected-block") ? !1 : (Wo(
|
|
988
|
-
re,
|
|
989
|
-
B,
|
|
990
|
-
A,
|
|
991
|
-
U,
|
|
992
|
-
t,
|
|
993
|
-
p,
|
|
994
|
-
a
|
|
995
|
-
), !0);
|
|
996
|
-
}
|
|
997
|
-
return Fe(
|
|
998
|
-
e.registerCommand(
|
|
999
|
-
ct,
|
|
1000
|
-
(p) => p === "hide_menu" ? (Ho(i.current), setTimeout(() => {
|
|
1001
|
-
l.current = !0;
|
|
1002
|
-
}, 0), !1) : p === "show_menu" ? (l.current = !1, !1) : (p === !0 && !l.current && u(null), l.current = !1, !1),
|
|
1003
|
-
be
|
|
1004
|
-
),
|
|
1005
|
-
e.registerCommand(
|
|
1006
|
-
ho,
|
|
1007
|
-
(p) => ((p == null ? void 0 : p.target) instanceof HTMLElement && i.current instanceof HTMLElement && (J(p), Kt(
|
|
1008
|
-
p.target,
|
|
1009
|
-
i.current,
|
|
1010
|
-
t,
|
|
1011
|
-
_.opened
|
|
1012
|
-
)), !1),
|
|
1013
|
-
be
|
|
1014
|
-
),
|
|
1015
|
-
e.registerCommand(
|
|
1016
|
-
Gn,
|
|
1017
|
-
(p) => (Ye || (Ye = Qo(
|
|
1018
|
-
p.target
|
|
1019
|
-
)), Jo(p, Ye), g(p)),
|
|
1020
|
-
be
|
|
1021
|
-
),
|
|
1022
|
-
e.registerCommand(
|
|
1023
|
-
Wn,
|
|
1024
|
-
() => (e.dispatchCommand(ct, !0), !1),
|
|
1025
|
-
be
|
|
1026
|
-
),
|
|
1027
|
-
e.registerCommand(
|
|
1028
|
-
jn,
|
|
1029
|
-
() => (e.dispatchCommand(ct, !0), !1),
|
|
1030
|
-
be
|
|
1031
|
-
)
|
|
1032
|
-
);
|
|
1033
|
-
}, [t, e]);
|
|
1034
|
-
function pe(g) {
|
|
1035
|
-
var M;
|
|
1036
|
-
const p = g.dataTransfer;
|
|
1037
|
-
(M = s.current) == null || M.setAttribute("data-index-start", "");
|
|
1038
|
-
const A = d || a.current.htmlElement;
|
|
1039
|
-
if (!p || !A)
|
|
1040
|
-
return;
|
|
1041
|
-
const j = e._rootElement;
|
|
1042
|
-
if (A != null && A.classList.contains("selected-block")) {
|
|
1043
|
-
const q = e._rootElement, ee = Array.from(
|
|
1044
|
-
q.querySelectorAll(".selected-block")
|
|
1045
|
-
);
|
|
1046
|
-
Go(g.dataTransfer, ee);
|
|
1047
|
-
} else
|
|
1048
|
-
at(j), A.className.includes("_layoutDivider") && A.parentElement ? Ut(p, A.parentElement) : Ut(p, A);
|
|
1049
|
-
let U = "";
|
|
1050
|
-
e.read(() => {
|
|
1051
|
-
var ee, h;
|
|
1052
|
-
const q = oe(A);
|
|
1053
|
-
if (q && (U = q.getKey()), q instanceof Xe) {
|
|
1054
|
-
const B = He(
|
|
1055
|
-
(ee = A.parentElement) == null ? void 0 : ee.parentElement,
|
|
1056
|
-
A.parentElement
|
|
1057
|
-
);
|
|
1058
|
-
(h = s.current) == null || h.setAttribute(
|
|
1059
|
-
"data-index-start",
|
|
1060
|
-
B.toString()
|
|
1061
|
-
);
|
|
1062
|
-
}
|
|
1063
|
-
}), i.current && (w(!0), i.current.style.opacity = "0"), r.current = !0, c.current = U, p.setData(Ft, U);
|
|
1064
|
-
}
|
|
1065
|
-
function W() {
|
|
1066
|
-
r.current = !1, Gt(s.current), w(!1);
|
|
1067
|
-
}
|
|
1068
|
-
if (C)
|
|
1069
|
-
return /* @__PURE__ */ o("div", {});
|
|
1070
|
-
function R() {
|
|
1071
|
-
var A;
|
|
1072
|
-
const g = a.current.htmlElement, p = (A = g == null ? void 0 : g.parentElement) == null ? void 0 : A.parentElement;
|
|
1073
|
-
if (p != null && p.classList.contains("dsd__theme__layoutContainer") && (p.children.length === 4 ? O(!0) : O(!1), g != null && g.parentElement)) {
|
|
1074
|
-
const j = He(
|
|
1075
|
-
p,
|
|
1076
|
-
g == null ? void 0 : g.parentElement
|
|
1077
|
-
);
|
|
1078
|
-
j ? j === p.children.length - 1 ? T({
|
|
1079
|
-
left: !1,
|
|
1080
|
-
right: !0
|
|
1081
|
-
}) : T({
|
|
1082
|
-
left: !1,
|
|
1083
|
-
right: !1
|
|
1084
|
-
}) : T({
|
|
1085
|
-
left: !0,
|
|
1086
|
-
right: !1
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
function J(g) {
|
|
1091
|
-
l.current = !0;
|
|
1092
|
-
const p = Zo(
|
|
1093
|
-
(g == null ? void 0 : g.target) ?? a.current.htmlElement
|
|
1094
|
-
);
|
|
1095
|
-
if (!p)
|
|
1096
|
-
return;
|
|
1097
|
-
const A = e._rootElement;
|
|
1098
|
-
R(), p.classList.contains("selected-block") || at(A), e.update(() => {
|
|
1099
|
-
const U = ue(), q = ((U == null ? void 0 : U.getNodes()) ?? []).filter((F) => !pt(F) && !Zt(F) && F.__parent === "root"), ee = q.map((F) => {
|
|
1100
|
-
const z = e.getElementByKey(F.getKey());
|
|
1101
|
-
return F.getType() === "table" ? z == null ? void 0 : z.firstElementChild : z;
|
|
1102
|
-
}).filter((F) => F !== null), h = q.length && ee.includes(p) ? ee : [p];
|
|
1103
|
-
if (h.length === 1) {
|
|
1104
|
-
const F = oe(p);
|
|
1105
|
-
if (!F) return;
|
|
1106
|
-
F.selectStart(), S(F);
|
|
1107
|
-
} else
|
|
1108
|
-
S(null);
|
|
1109
|
-
h.forEach((F) => {
|
|
1110
|
-
tn(e, {
|
|
1111
|
-
block: F,
|
|
1112
|
-
isCreateEventListener: !1
|
|
1113
|
-
});
|
|
1114
|
-
});
|
|
1115
|
-
const B = Array.from(
|
|
1116
|
-
document.querySelectorAll(".selected-block")
|
|
1117
|
-
).reduce((F, z) => {
|
|
1118
|
-
const _e = oe(z);
|
|
1119
|
-
return _e && F.push(_e), F;
|
|
1120
|
-
}, []), re = B.length > 0 && B.every((F) => Je(F) || Qe(F) || kt(F) ? !1 : Me(F) || pt(F));
|
|
1121
|
-
N(re ? "text" : "block");
|
|
1122
|
-
}), bo();
|
|
1123
|
-
const j = Number(g == null ? void 0 : g.y) + 240 > window.innerHeight ? Number(g == null ? void 0 : g.y) - 200 : g == null ? void 0 : g.y;
|
|
1124
|
-
k({ opened: !0, x: (g == null ? void 0 : g.x) ?? 0, y: j ?? 0 }), e.dispatchCommand(gt, !0);
|
|
1125
|
-
}
|
|
1126
|
-
const ne = () => {
|
|
1127
|
-
e.update(() => {
|
|
1128
|
-
const g = nn();
|
|
1129
|
-
if (l.current = !1, k((p) => ({ opened: !1, x: p.x, y: p.y })), (g == null ? void 0 : g.__key) === "root") {
|
|
1130
|
-
const p = Pe();
|
|
1131
|
-
g.append(p);
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
}, me = n ? "hide-add-button" : "", Ce = _.x !== 0 ? {
|
|
1135
|
-
position: "fixed",
|
|
1136
|
-
top: 0,
|
|
1137
|
-
left: 0,
|
|
1138
|
-
transform: `translate(${_.x}px, ${_.y}px)`
|
|
1139
|
-
} : {}, Le = () => {
|
|
1140
|
-
ne(), yo(), mo(e), at(e._rootElement);
|
|
1141
|
-
}, Ke = (g = !1) => {
|
|
1142
|
-
g ? e.update(() => {
|
|
1143
|
-
const p = ue();
|
|
1144
|
-
let A = null;
|
|
1145
|
-
de(p) && (A = p.anchor.getNode().getParent()), Le(), setTimeout(() => {
|
|
1146
|
-
e.update(() => {
|
|
1147
|
-
A == null || A.selectEnd();
|
|
1148
|
-
});
|
|
1149
|
-
}, 100);
|
|
1150
|
-
}) : Le();
|
|
1151
|
-
}, Ie = ye(
|
|
1152
|
-
(g) => {
|
|
1153
|
-
const p = document.querySelector(".draggable-menu");
|
|
1154
|
-
if (!_ && g.button !== 2) return;
|
|
1155
|
-
const A = g.target;
|
|
1156
|
-
if (A.closest(".mantine-Menu-dropdown"))
|
|
1157
|
-
return;
|
|
1158
|
-
!((p == null ? void 0 : p.contains(A)) && A.closest("div.custom-menu-item")) && g.button !== 2 && _.opened && (g.stopPropagation(), g.preventDefault());
|
|
1159
|
-
},
|
|
1160
|
-
[e, _]
|
|
1161
|
-
);
|
|
1162
|
-
return Y(() => (_.opened ? document.addEventListener("mousedown", Ie) : document.removeEventListener("mousedown", Ie), () => {
|
|
1163
|
-
document.removeEventListener("mousedown", Ie);
|
|
1164
|
-
}), [_.opened, Ie]), Ct(
|
|
1165
|
-
/* @__PURE__ */ H(E, { children: [
|
|
1166
|
-
/* @__PURE__ */ H(
|
|
1167
|
-
"div",
|
|
1168
|
-
{
|
|
1169
|
-
className: `draggable-block-container ${me} ${d ? "visible" : ""}`,
|
|
1170
|
-
ref: i,
|
|
1171
|
-
onMouseEnter: () => {
|
|
1172
|
-
var g;
|
|
1173
|
-
_ || I("both"), (g = i.current) != null && g.style && (i.current.style.opacity = "1");
|
|
1174
|
-
},
|
|
1175
|
-
onMouseLeave: () => {
|
|
1176
|
-
I(null);
|
|
1177
|
-
},
|
|
1178
|
-
children: [
|
|
1179
|
-
/* @__PURE__ */ o(
|
|
1180
|
-
qo,
|
|
1181
|
-
{
|
|
1182
|
-
hoveredButton: y,
|
|
1183
|
-
insertNewParagraph: Ht,
|
|
1184
|
-
currentDraggableBlockRef: a,
|
|
1185
|
-
setHoveredButton: I,
|
|
1186
|
-
isClickedBlockRef: l,
|
|
1187
|
-
setDraggableBlockElem: u,
|
|
1188
|
-
editor: e,
|
|
1189
|
-
t: L
|
|
1190
|
-
}
|
|
1191
|
-
),
|
|
1192
|
-
/* @__PURE__ */ H(
|
|
1193
|
-
$,
|
|
1194
|
-
{
|
|
1195
|
-
onOpen: J,
|
|
1196
|
-
opened: _.opened,
|
|
1197
|
-
styles: { dropdown: Ce },
|
|
1198
|
-
position: "left-start",
|
|
1199
|
-
width: 320,
|
|
1200
|
-
shadow: "md",
|
|
1201
|
-
withinPortal: !0,
|
|
1202
|
-
onClose: () => {
|
|
1203
|
-
Ke();
|
|
1204
|
-
},
|
|
1205
|
-
transitionProps: io,
|
|
1206
|
-
children: [
|
|
1207
|
-
/* @__PURE__ */ o($.Target, { children: /* @__PURE__ */ o(
|
|
1208
|
-
"div",
|
|
1209
|
-
{
|
|
1210
|
-
className: "icon draggable-block-menu",
|
|
1211
|
-
draggable: !0,
|
|
1212
|
-
onDragStart: pe,
|
|
1213
|
-
onDragEnd: W,
|
|
1214
|
-
children: /* @__PURE__ */ o(
|
|
1215
|
-
ie,
|
|
1216
|
-
{
|
|
1217
|
-
openDelay: 300,
|
|
1218
|
-
multiline: !0,
|
|
1219
|
-
disabled: f || l.current,
|
|
1220
|
-
label: /* @__PURE__ */ H(E, { children: [
|
|
1221
|
-
/* @__PURE__ */ H("span", { children: [
|
|
1222
|
-
/* @__PURE__ */ o("strong", { children: L("editor.hoverOptions.drag") }),
|
|
1223
|
-
",",
|
|
1224
|
-
" ",
|
|
1225
|
-
L("editor.hoverOptions.dragAction")
|
|
1226
|
-
] }),
|
|
1227
|
-
/* @__PURE__ */ o("br", {}),
|
|
1228
|
-
/* @__PURE__ */ H("span", { children: [
|
|
1229
|
-
/* @__PURE__ */ o("strong", { children: L("editor.hoverOptions.click") }),
|
|
1230
|
-
",",
|
|
1231
|
-
" ",
|
|
1232
|
-
L("editor.hoverOptions.clickAction")
|
|
1233
|
-
] })
|
|
1234
|
-
] }),
|
|
1235
|
-
position: "bottom-start",
|
|
1236
|
-
children: /* @__PURE__ */ o(
|
|
1237
|
-
ze,
|
|
1238
|
-
{
|
|
1239
|
-
radius: "sm",
|
|
1240
|
-
color: "gray",
|
|
1241
|
-
size: "sm",
|
|
1242
|
-
variant: "subtle",
|
|
1243
|
-
"aria-label": "Settings",
|
|
1244
|
-
children: /* @__PURE__ */ o(wn, { size: 20 })
|
|
1245
|
-
}
|
|
1246
|
-
)
|
|
1247
|
-
}
|
|
1248
|
-
)
|
|
1249
|
-
}
|
|
1250
|
-
) }),
|
|
1251
|
-
/* @__PURE__ */ o(
|
|
1252
|
-
jo,
|
|
1253
|
-
{
|
|
1254
|
-
hoveredButton: y,
|
|
1255
|
-
insertNewParagraph: Ht,
|
|
1256
|
-
currentDraggableBlockRef: a,
|
|
1257
|
-
setHoveredButton: I,
|
|
1258
|
-
isClickedBlockRef: l,
|
|
1259
|
-
setDraggableBlockElem: u,
|
|
1260
|
-
editor: e,
|
|
1261
|
-
t: L
|
|
1262
|
-
}
|
|
1263
|
-
),
|
|
1264
|
-
/* @__PURE__ */ o($.Dropdown, { className: "draggable-menu", children: /* @__PURE__ */ o(
|
|
1265
|
-
Eo,
|
|
1266
|
-
{
|
|
1267
|
-
onChange: () => {
|
|
1268
|
-
Ke(!0), $e(e);
|
|
1269
|
-
},
|
|
1270
|
-
t: L,
|
|
1271
|
-
textBlock: P,
|
|
1272
|
-
currentEditorNode: v,
|
|
1273
|
-
editor: e,
|
|
1274
|
-
isDisabledAddColumnButton: D,
|
|
1275
|
-
disabledMoveColumnButtons: m
|
|
1276
|
-
}
|
|
1277
|
-
) })
|
|
1278
|
-
]
|
|
1279
|
-
}
|
|
1280
|
-
)
|
|
1281
|
-
]
|
|
1282
|
-
}
|
|
1283
|
-
),
|
|
1284
|
-
/* @__PURE__ */ o("div", { className: "draggable-block-target-line", ref: s })
|
|
1285
|
-
] }),
|
|
1286
|
-
t
|
|
1287
|
-
);
|
|
1288
|
-
}
|
|
1289
|
-
function qs({
|
|
1290
|
-
anchorElem: e = document.body,
|
|
1291
|
-
isShowAddButton: t = !1
|
|
1292
|
-
}) {
|
|
1293
|
-
const [n] = nt();
|
|
1294
|
-
return es(n, e, t);
|
|
1295
|
-
}
|
|
1296
|
-
function ts({
|
|
1297
|
-
editor: e,
|
|
1298
|
-
anchorElem: t,
|
|
1299
|
-
isLink: n,
|
|
1300
|
-
isBold: i,
|
|
1301
|
-
isItalic: s,
|
|
1302
|
-
isUnderline: r,
|
|
1303
|
-
isCode: l,
|
|
1304
|
-
isStrikethrough: a,
|
|
1305
|
-
isSubscript: c,
|
|
1306
|
-
isSuperscript: d,
|
|
1307
|
-
component: u,
|
|
1308
|
-
isText: C
|
|
1309
|
-
}) {
|
|
1310
|
-
const f = ce(null), w = ce(!1), _ = ce(null), k = ye(() => {
|
|
1311
|
-
e.dispatchCommand(on, "create");
|
|
1312
|
-
}, [e, n]);
|
|
1313
|
-
function P() {
|
|
1314
|
-
var y, I;
|
|
1315
|
-
f.current && (w.current = !0, Oe(
|
|
1316
|
-
((y = _.current) == null ? void 0 : y.rect) || null,
|
|
1317
|
-
f == null ? void 0 : f.current,
|
|
1318
|
-
t,
|
|
1319
|
-
(I = _.current) == null ? void 0 : I.isLink
|
|
1320
|
-
));
|
|
1321
|
-
}
|
|
1322
|
-
Y(() => {
|
|
1323
|
-
const y = Rt();
|
|
1324
|
-
if (!C && !(y != null && y.length)) {
|
|
1325
|
-
let I = function(T) {
|
|
1326
|
-
return T instanceof HTMLElement;
|
|
1327
|
-
};
|
|
1328
|
-
const D = f.current, O = window.getSelection();
|
|
1329
|
-
let m = !1;
|
|
1330
|
-
O != null && O.anchorNode && I(O.anchorNode) && O.anchorNode.className === "toolbar" && (m = !0), D && !m && (_.current = {
|
|
1331
|
-
rect: null,
|
|
1332
|
-
floatingElem: D,
|
|
1333
|
-
anchorElem: t,
|
|
1334
|
-
isLink: n
|
|
1335
|
-
}, Oe(
|
|
1336
|
-
null,
|
|
1337
|
-
D,
|
|
1338
|
-
t,
|
|
1339
|
-
n
|
|
1340
|
-
), w.current = !1);
|
|
1341
|
-
}
|
|
1342
|
-
}, [C, e]), Y(() => {
|
|
1343
|
-
if (f != null && f.current)
|
|
1344
|
-
return document.addEventListener("mouseup", P), () => {
|
|
1345
|
-
document.removeEventListener("mouseup", P);
|
|
1346
|
-
};
|
|
1347
|
-
}, [f]), Y(() => {
|
|
1348
|
-
e.registerCommand(
|
|
1349
|
-
Vn,
|
|
1350
|
-
(y) => {
|
|
1351
|
-
var I;
|
|
1352
|
-
return (y.metaKey || y.ctrlKey) && y.code === "KeyA" ? (y.preventDefault(), _o(e), nn(!0) && (To() && (f != null && f.current) ? (Oe(
|
|
1353
|
-
null,
|
|
1354
|
-
f == null ? void 0 : f.current,
|
|
1355
|
-
t,
|
|
1356
|
-
(I = _.current) == null ? void 0 : I.isLink
|
|
1357
|
-
), En(), tn(e)) : setTimeout(() => {
|
|
1358
|
-
P();
|
|
1359
|
-
})), !0) : !1;
|
|
1360
|
-
},
|
|
1361
|
-
be
|
|
1362
|
-
), e.registerCommand(
|
|
1363
|
-
gt,
|
|
1364
|
-
() => (setTimeout(() => {
|
|
1365
|
-
var y;
|
|
1366
|
-
f != null && f.current && Oe(
|
|
1367
|
-
null,
|
|
1368
|
-
f == null ? void 0 : f.current,
|
|
1369
|
-
t,
|
|
1370
|
-
(y = _.current) == null ? void 0 : y.isLink
|
|
1371
|
-
);
|
|
1372
|
-
}, 100), !1),
|
|
1373
|
-
be
|
|
1374
|
-
);
|
|
1375
|
-
}, [e]);
|
|
1376
|
-
const N = ye(() => {
|
|
1377
|
-
const y = ue(), I = f.current, D = window.getSelection();
|
|
1378
|
-
if (I === null)
|
|
1379
|
-
return;
|
|
1380
|
-
const O = e.getRootElement();
|
|
1381
|
-
let m = !1;
|
|
1382
|
-
const T = Rt();
|
|
1383
|
-
if (T && T.length > 0 && (m = !0), y !== null && D !== null && !D.isCollapsed && O !== null && O.contains(D.anchorNode) && m) {
|
|
1384
|
-
const v = xo(D, O);
|
|
1385
|
-
if (_.current = {
|
|
1386
|
-
rect: v,
|
|
1387
|
-
floatingElem: I,
|
|
1388
|
-
anchorElem: t,
|
|
1389
|
-
isLink: n
|
|
1390
|
-
}, de(y)) {
|
|
1391
|
-
const L = vt(y).getParent(), G = L == null ? void 0 : L.getFormatType();
|
|
1392
|
-
w.current && G && f && e.registerCommand(
|
|
1393
|
-
gt,
|
|
1394
|
-
(pe) => (pe || setTimeout(() => {
|
|
1395
|
-
var W, R;
|
|
1396
|
-
Oe(
|
|
1397
|
-
((W = _.current) == null ? void 0 : W.rect) || null,
|
|
1398
|
-
I,
|
|
1399
|
-
t,
|
|
1400
|
-
(R = _.current) == null ? void 0 : R.isLink
|
|
1401
|
-
);
|
|
1402
|
-
}, 100), !1),
|
|
1403
|
-
be
|
|
1404
|
-
);
|
|
1405
|
-
}
|
|
1406
|
-
} else
|
|
1407
|
-
_.current = {
|
|
1408
|
-
rect: null,
|
|
1409
|
-
floatingElem: I,
|
|
1410
|
-
anchorElem: t,
|
|
1411
|
-
isLink: n
|
|
1412
|
-
};
|
|
1413
|
-
}, [e, t, n]);
|
|
1414
|
-
return Y(() => {
|
|
1415
|
-
const y = t.parentElement, I = () => {
|
|
1416
|
-
e.getEditorState().read(() => {
|
|
1417
|
-
N();
|
|
1418
|
-
});
|
|
1419
|
-
};
|
|
1420
|
-
return window.addEventListener("resize", I), y && y.addEventListener("scroll", I), () => {
|
|
1421
|
-
window.removeEventListener("resize", I), y && y.removeEventListener("scroll", I);
|
|
1422
|
-
};
|
|
1423
|
-
}, [e, N, t]), Y(() => (e.getEditorState().read(() => {
|
|
1424
|
-
N();
|
|
1425
|
-
}), Fe(
|
|
1426
|
-
e.registerUpdateListener(({ editorState: y }) => {
|
|
1427
|
-
y.read(() => {
|
|
1428
|
-
N();
|
|
1429
|
-
});
|
|
1430
|
-
}),
|
|
1431
|
-
e.registerCommand(
|
|
1432
|
-
Xt,
|
|
1433
|
-
() => (N(), !1),
|
|
1434
|
-
be
|
|
1435
|
-
)
|
|
1436
|
-
)), [e, N]), /* @__PURE__ */ o(
|
|
1437
|
-
"div",
|
|
1438
|
-
{
|
|
1439
|
-
ref: f,
|
|
1440
|
-
className: `floating-text-format-popup doc-space-editor-wrapper ${C ? "" : "floating-text-format-popup-hidden"}`,
|
|
1441
|
-
children: /* @__PURE__ */ o("div", { children: e.isEditable() && (u || /* @__PURE__ */ H(E, { children: [
|
|
1442
|
-
/* @__PURE__ */ o(
|
|
1443
|
-
"button",
|
|
1444
|
-
{
|
|
1445
|
-
type: "button",
|
|
1446
|
-
onClick: () => {
|
|
1447
|
-
e.dispatchCommand(le, "bold");
|
|
1448
|
-
},
|
|
1449
|
-
className: "popup-item spaced " + (i ? "active" : ""),
|
|
1450
|
-
children: /* @__PURE__ */ o(X, { name: "bold", stroke: i ? 3 : 2 })
|
|
1451
|
-
}
|
|
1452
|
-
),
|
|
1453
|
-
/* @__PURE__ */ o(
|
|
1454
|
-
"button",
|
|
1455
|
-
{
|
|
1456
|
-
type: "button",
|
|
1457
|
-
onClick: () => {
|
|
1458
|
-
e.dispatchCommand(le, "italic");
|
|
1459
|
-
},
|
|
1460
|
-
className: "popup-item spaced " + (s ? "active" : ""),
|
|
1461
|
-
children: /* @__PURE__ */ o(X, { name: "italic", stroke: s ? 3 : 2 })
|
|
1462
|
-
}
|
|
1463
|
-
),
|
|
1464
|
-
/* @__PURE__ */ o(
|
|
1465
|
-
"button",
|
|
1466
|
-
{
|
|
1467
|
-
type: "button",
|
|
1468
|
-
onClick: () => {
|
|
1469
|
-
e.dispatchCommand(le, "underline");
|
|
1470
|
-
},
|
|
1471
|
-
className: "popup-item spaced " + (r ? "active" : ""),
|
|
1472
|
-
children: /* @__PURE__ */ o(X, { name: "underline", stroke: r ? 3 : 2 })
|
|
1473
|
-
}
|
|
1474
|
-
),
|
|
1475
|
-
/* @__PURE__ */ o(
|
|
1476
|
-
"button",
|
|
1477
|
-
{
|
|
1478
|
-
type: "button",
|
|
1479
|
-
onClick: () => {
|
|
1480
|
-
e.dispatchCommand(le, "strikethrough");
|
|
1481
|
-
},
|
|
1482
|
-
className: "popup-item spaced " + (a ? "active" : ""),
|
|
1483
|
-
"data-test-id": "toolbar-strikethrough",
|
|
1484
|
-
children: /* @__PURE__ */ o(X, { name: "strikethrough", stroke: a ? 3 : 2 })
|
|
1485
|
-
}
|
|
1486
|
-
),
|
|
1487
|
-
/* @__PURE__ */ o(
|
|
1488
|
-
"button",
|
|
1489
|
-
{
|
|
1490
|
-
type: "button",
|
|
1491
|
-
onClick: () => {
|
|
1492
|
-
e.dispatchCommand(le, "subscript");
|
|
1493
|
-
},
|
|
1494
|
-
className: "popup-item spaced " + (c ? "active" : ""),
|
|
1495
|
-
children: /* @__PURE__ */ o(X, { name: "subscript", stroke: c ? 3 : 2 })
|
|
1496
|
-
}
|
|
1497
|
-
),
|
|
1498
|
-
/* @__PURE__ */ o(
|
|
1499
|
-
"button",
|
|
1500
|
-
{
|
|
1501
|
-
type: "button",
|
|
1502
|
-
onClick: () => {
|
|
1503
|
-
e.dispatchCommand(le, "superscript");
|
|
1504
|
-
},
|
|
1505
|
-
className: "popup-item spaced " + (d ? "active" : ""),
|
|
1506
|
-
children: /* @__PURE__ */ o(X, { name: "superscript", stroke: d ? 3 : 2 })
|
|
1507
|
-
}
|
|
1508
|
-
),
|
|
1509
|
-
/* @__PURE__ */ o(
|
|
1510
|
-
"button",
|
|
1511
|
-
{
|
|
1512
|
-
type: "button",
|
|
1513
|
-
onClick: () => {
|
|
1514
|
-
e.dispatchCommand(le, "code");
|
|
1515
|
-
},
|
|
1516
|
-
className: "popup-item spaced " + (l ? "active" : ""),
|
|
1517
|
-
children: /* @__PURE__ */ o(X, { name: "code" })
|
|
1518
|
-
}
|
|
1519
|
-
),
|
|
1520
|
-
/* @__PURE__ */ o(
|
|
1521
|
-
"button",
|
|
1522
|
-
{
|
|
1523
|
-
type: "button",
|
|
1524
|
-
onClick: k,
|
|
1525
|
-
className: "popup-item spaced " + (n ? "active" : ""),
|
|
1526
|
-
children: /* @__PURE__ */ o(X, { name: "link" })
|
|
1527
|
-
}
|
|
1528
|
-
)
|
|
1529
|
-
] })) })
|
|
1530
|
-
}
|
|
1531
|
-
);
|
|
1532
|
-
}
|
|
1533
|
-
function ns(e, t, n) {
|
|
1534
|
-
const [i, s] = b(!1), [r, l] = b(!1), [a, c] = b(!1), [d, u] = b(!1), [C, f] = b(!1), [w, _] = b(!1), [k, P] = b(!1), [N, y] = b(!1), [I, D] = b(!1), O = Co(), { disable: m } = Ae(De), T = ye(() => {
|
|
1535
|
-
e.getEditorState().read(() => {
|
|
1536
|
-
var ne, me, Ce;
|
|
1537
|
-
if (e.isComposing())
|
|
1538
|
-
return;
|
|
1539
|
-
const v = ue(), S = window.getSelection(), L = e.getRootElement();
|
|
1540
|
-
if (S !== null && (!de(v) || L === null || !L.contains(S.anchorNode))) {
|
|
1541
|
-
s(!1);
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
if (!de(v))
|
|
1545
|
-
return;
|
|
1546
|
-
const G = vt(v);
|
|
1547
|
-
c(v.hasFormat("bold")), u(v.hasFormat("italic")), f(v.hasFormat("underline")), _(v.hasFormat("strikethrough")), P(v.hasFormat("subscript")), y(v.hasFormat("superscript")), D(v.hasFormat("code"));
|
|
1548
|
-
const pe = G.getParent();
|
|
1549
|
-
Re(pe) || Re(G) ? l(!0) : l(!1);
|
|
1550
|
-
const W = no(
|
|
1551
|
-
v.anchor.getNode()
|
|
1552
|
-
), R = (Ce = (me = (ne = e.getElementByKey(G.__key)) == null ? void 0 : ne.parentElement) == null ? void 0 : me.parentElement) == null ? void 0 : Ce.classList.contains(
|
|
1553
|
-
"Collapsible__title"
|
|
1554
|
-
);
|
|
1555
|
-
!W && v.getTextContent() !== "" && !R ? s(
|
|
1556
|
-
mt(G) || Yn(G) || dt(G) || Yt(G) || lo(G)
|
|
1557
|
-
) : s(!1);
|
|
1558
|
-
const J = v.getTextContent().replace(/\n/g, "");
|
|
1559
|
-
if (!v.isCollapsed() && J === "") {
|
|
1560
|
-
s(!1);
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
}, [e]);
|
|
1565
|
-
return Y(() => (document.addEventListener("selectionchange", T), () => {
|
|
1566
|
-
document.removeEventListener("selectionchange", T);
|
|
1567
|
-
}), [T]), Y(() => Fe(
|
|
1568
|
-
e.registerUpdateListener(() => {
|
|
1569
|
-
T();
|
|
1570
|
-
}),
|
|
1571
|
-
e.registerRootListener(() => {
|
|
1572
|
-
e.getRootElement() === null && s(!1);
|
|
1573
|
-
})
|
|
1574
|
-
), [e, T]), m ? null : Ct(
|
|
1575
|
-
/* @__PURE__ */ o(
|
|
1576
|
-
ts,
|
|
1577
|
-
{
|
|
1578
|
-
editor: e,
|
|
1579
|
-
anchorElem: t,
|
|
1580
|
-
isLink: r,
|
|
1581
|
-
isBold: a,
|
|
1582
|
-
isItalic: d,
|
|
1583
|
-
isStrikethrough: w,
|
|
1584
|
-
isSubscript: k,
|
|
1585
|
-
isSuperscript: N,
|
|
1586
|
-
isUnderline: C,
|
|
1587
|
-
isCode: I,
|
|
1588
|
-
component: n,
|
|
1589
|
-
isText: i && !O
|
|
1590
|
-
}
|
|
1591
|
-
),
|
|
1592
|
-
document.body
|
|
1593
|
-
);
|
|
1594
|
-
}
|
|
1595
|
-
function Ys({
|
|
1596
|
-
anchorElem: e = document.body,
|
|
1597
|
-
component: t
|
|
1598
|
-
}) {
|
|
1599
|
-
const [n] = nt();
|
|
1600
|
-
return ns(n, e, t);
|
|
1601
|
-
}
|
|
1602
|
-
const os = (e, t, n, i) => {
|
|
1603
|
-
e.update(() => {
|
|
1604
|
-
if (de(n)) {
|
|
1605
|
-
const s = xt(t);
|
|
1606
|
-
n.insertNodes([s]), i();
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1609
|
-
}, ss = (e, t, n, i) => {
|
|
1610
|
-
e.update(() => {
|
|
1611
|
-
if (de(n)) {
|
|
1612
|
-
const s = xt(t);
|
|
1613
|
-
n.insertNodes([]);
|
|
1614
|
-
const r = s.getParent() ?? n.focus.getNode().getParent();
|
|
1615
|
-
if (r) {
|
|
1616
|
-
const l = n.focus.getNode().getNextSibling();
|
|
1617
|
-
l ? l.insertBefore(s) : r.append(s), i();
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
}, is = (e, t = "", n, i) => {
|
|
1622
|
-
e.update(() => {
|
|
1623
|
-
if (!de(n)) return;
|
|
1624
|
-
const r = n.anchor.getNode().getTopLevelElementOrThrow(), l = Pe();
|
|
1625
|
-
t && l.append(xt(t)), r.insertAfter(l), i();
|
|
1626
|
-
});
|
|
1627
|
-
}, ls = (e, t) => {
|
|
1628
|
-
e.update(() => {
|
|
1629
|
-
const n = ue();
|
|
1630
|
-
if (de(n)) {
|
|
1631
|
-
const i = n.getTextContent();
|
|
1632
|
-
t(i);
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1635
|
-
}, rs = ({
|
|
1636
|
-
editor: e,
|
|
1637
|
-
response: t,
|
|
1638
|
-
onSubmit: n,
|
|
1639
|
-
setTypeMenu: i,
|
|
1640
|
-
onClose: s,
|
|
1641
|
-
t: r,
|
|
1642
|
-
selection: l
|
|
1643
|
-
}) => /* @__PURE__ */ H(E, { children: [
|
|
1644
|
-
/* @__PURE__ */ o(
|
|
1645
|
-
$.Item,
|
|
1646
|
-
{
|
|
1647
|
-
leftSection: /* @__PURE__ */ o(Tt, { size: 14 }),
|
|
1648
|
-
onClick: () => i("main"),
|
|
1649
|
-
children: r("editor.ai.back")
|
|
1650
|
-
}
|
|
1651
|
-
),
|
|
1652
|
-
/* @__PURE__ */ o(
|
|
1653
|
-
$.Item,
|
|
1654
|
-
{
|
|
1655
|
-
onClick: () => {
|
|
1656
|
-
os(e, t, l, s);
|
|
1657
|
-
},
|
|
1658
|
-
leftSection: /* @__PURE__ */ o(Sn, { size: 14 }),
|
|
1659
|
-
children: r("editor.ai.menu.answer.replaceSelection")
|
|
1660
|
-
}
|
|
1661
|
-
),
|
|
1662
|
-
/* @__PURE__ */ o(
|
|
1663
|
-
$.Item,
|
|
1664
|
-
{
|
|
1665
|
-
onClick: () => {
|
|
1666
|
-
ss(e, ` ${t}`, l, s);
|
|
1667
|
-
},
|
|
1668
|
-
leftSection: /* @__PURE__ */ o(Mn, { size: 14 }),
|
|
1669
|
-
children: r("editor.ai.menu.answer.addTextInline")
|
|
1670
|
-
}
|
|
1671
|
-
),
|
|
1672
|
-
/* @__PURE__ */ o(
|
|
1673
|
-
$.Item,
|
|
1674
|
-
{
|
|
1675
|
-
onClick: () => {
|
|
1676
|
-
is(e, t, l, s), s();
|
|
1677
|
-
},
|
|
1678
|
-
leftSection: /* @__PURE__ */ o(An, { size: 14 }),
|
|
1679
|
-
children: r("editor.ai.menu.answer.addBelowParagraph")
|
|
1680
|
-
}
|
|
1681
|
-
),
|
|
1682
|
-
/* @__PURE__ */ o($.Divider, {}),
|
|
1683
|
-
/* @__PURE__ */ o($.Label, { children: r("editor.ai.menu.answer.modifyFurther") }),
|
|
1684
|
-
/* @__PURE__ */ o(
|
|
1685
|
-
$.Item,
|
|
1686
|
-
{
|
|
1687
|
-
onClick: () => {
|
|
1688
|
-
n(
|
|
1689
|
-
`Start with this text and continue. Output this text at the start: "${t}"`,
|
|
1690
|
-
!1
|
|
1691
|
-
);
|
|
1692
|
-
},
|
|
1693
|
-
leftSection: /* @__PURE__ */ o(Pn, { size: 14 }),
|
|
1694
|
-
children: r("editor.ai.menu.answer.continueWriting")
|
|
1695
|
-
}
|
|
1696
|
-
),
|
|
1697
|
-
/* @__PURE__ */ o(
|
|
1698
|
-
$.Item,
|
|
1699
|
-
{
|
|
1700
|
-
onClick: () => {
|
|
1701
|
-
n("Regenerate this text with another way: ");
|
|
1702
|
-
},
|
|
1703
|
-
leftSection: /* @__PURE__ */ o(Dn, { size: 14 }),
|
|
1704
|
-
children: r("editor.ai.menu.answer.regenerate")
|
|
1705
|
-
}
|
|
1706
|
-
),
|
|
1707
|
-
/* @__PURE__ */ o($.Item, { onClick: s, leftSection: /* @__PURE__ */ o(ft, { size: 14 }), children: r("editor.ai.menu.answer.discard") })
|
|
1708
|
-
] }), as = [
|
|
1709
|
-
"arabic",
|
|
1710
|
-
"bengali",
|
|
1711
|
-
"chinese",
|
|
1712
|
-
"dutch",
|
|
1713
|
-
"english",
|
|
1714
|
-
"french",
|
|
1715
|
-
"german",
|
|
1716
|
-
"hindi",
|
|
1717
|
-
"japanese",
|
|
1718
|
-
"korean",
|
|
1719
|
-
"nepali",
|
|
1720
|
-
"portuguese",
|
|
1721
|
-
"spanish"
|
|
1722
|
-
], cs = [
|
|
1723
|
-
"professional",
|
|
1724
|
-
"straightforward",
|
|
1725
|
-
"friendly",
|
|
1726
|
-
"poetic",
|
|
1727
|
-
"passiveAggressive",
|
|
1728
|
-
"pirate"
|
|
1729
|
-
], us = [
|
|
1730
|
-
{
|
|
1731
|
-
title: "modifySelection",
|
|
1732
|
-
options: [
|
|
1733
|
-
{
|
|
1734
|
-
title: "improveWriting",
|
|
1735
|
-
prompt: "Improve the quality of the text",
|
|
1736
|
-
icon: /* @__PURE__ */ o(Ln, { size: 14 })
|
|
1737
|
-
},
|
|
1738
|
-
{
|
|
1739
|
-
title: "fixMistakes",
|
|
1740
|
-
prompt: "Fix any typos or general errors in the text",
|
|
1741
|
-
icon: /* @__PURE__ */ o(Nn, { size: 14 })
|
|
1742
|
-
},
|
|
1743
|
-
{
|
|
1744
|
-
title: "simplify",
|
|
1745
|
-
prompt: "Shorten the text, simplifying it",
|
|
1746
|
-
icon: /* @__PURE__ */ o(On, { size: 14 })
|
|
1747
|
-
},
|
|
1748
|
-
{
|
|
1749
|
-
title: "addMoreDetail",
|
|
1750
|
-
prompt: "Lengthen the text, going into more detail",
|
|
1751
|
-
icon: /* @__PURE__ */ o($n, { size: 14 })
|
|
1752
|
-
}
|
|
1753
|
-
]
|
|
1754
|
-
},
|
|
1755
|
-
{
|
|
1756
|
-
title: "generate",
|
|
1757
|
-
options: [
|
|
1758
|
-
{
|
|
1759
|
-
title: "summarise",
|
|
1760
|
-
prompt: "Summarise the text",
|
|
1761
|
-
icon: /* @__PURE__ */ o(Rn, { size: 14 })
|
|
1762
|
-
},
|
|
1763
|
-
{
|
|
1764
|
-
title: "translate",
|
|
1765
|
-
icon: /* @__PURE__ */ o(Bn, { size: 14 }),
|
|
1766
|
-
type: "language"
|
|
1767
|
-
},
|
|
1768
|
-
{
|
|
1769
|
-
title: "changeStyle",
|
|
1770
|
-
icon: /* @__PURE__ */ o(Fn, { size: 14 }),
|
|
1771
|
-
type: "style"
|
|
1772
|
-
},
|
|
1773
|
-
{
|
|
1774
|
-
title: "explain",
|
|
1775
|
-
prompt: "Explain what the text is about",
|
|
1776
|
-
icon: /* @__PURE__ */ o(zn, { size: 14 })
|
|
1777
|
-
}
|
|
1778
|
-
]
|
|
1779
|
-
}
|
|
1780
|
-
], ds = ({
|
|
1781
|
-
setTypeMenu: e,
|
|
1782
|
-
onSubmit: t,
|
|
1783
|
-
t: n
|
|
1784
|
-
}) => /* @__PURE__ */ H(E, { children: [
|
|
1785
|
-
/* @__PURE__ */ o(
|
|
1786
|
-
$.Item,
|
|
1787
|
-
{
|
|
1788
|
-
leftSection: /* @__PURE__ */ o(Tt, { size: 14 }),
|
|
1789
|
-
onClick: () => e("main"),
|
|
1790
|
-
children: n("editor.ai.back")
|
|
1791
|
-
}
|
|
1792
|
-
),
|
|
1793
|
-
as.map((i) => /* @__PURE__ */ o(
|
|
1794
|
-
$.Item,
|
|
1795
|
-
{
|
|
1796
|
-
onClick: () => {
|
|
1797
|
-
t(`Translate text into the ${i} language`);
|
|
1798
|
-
},
|
|
1799
|
-
children: n(`editor.ai.menu.languages.${i}`)
|
|
1800
|
-
},
|
|
1801
|
-
i
|
|
1802
|
-
))
|
|
1803
|
-
] }), fs = ({
|
|
1804
|
-
setTypeMenu: e,
|
|
1805
|
-
onSubmit: t,
|
|
1806
|
-
t: n
|
|
1807
|
-
}) => /* @__PURE__ */ o(E, { children: us.map((i) => /* @__PURE__ */ H("div", { children: [
|
|
1808
|
-
/* @__PURE__ */ o($.Label, { children: n(`editor.ai.menu.main.${i.title}`) }),
|
|
1809
|
-
i.options.map((s) => /* @__PURE__ */ o(
|
|
1810
|
-
$.Item,
|
|
1811
|
-
{
|
|
1812
|
-
onClick: () => {
|
|
1813
|
-
if (s.type) {
|
|
1814
|
-
e(s.type);
|
|
1815
|
-
return;
|
|
1816
|
-
}
|
|
1817
|
-
t(s.prompt || "");
|
|
1818
|
-
},
|
|
1819
|
-
leftSection: s.icon,
|
|
1820
|
-
children: n(`editor.ai.menu.main.${s.title}`)
|
|
1821
|
-
},
|
|
1822
|
-
s.title
|
|
1823
|
-
))
|
|
1824
|
-
] }, i.title)) }), ps = ({
|
|
1825
|
-
setTypeMenu: e,
|
|
1826
|
-
onSubmit: t,
|
|
1827
|
-
t: n
|
|
1828
|
-
}) => /* @__PURE__ */ H(E, { children: [
|
|
1829
|
-
/* @__PURE__ */ o(
|
|
1830
|
-
$.Item,
|
|
1831
|
-
{
|
|
1832
|
-
leftSection: /* @__PURE__ */ o(Tt, { size: 14 }),
|
|
1833
|
-
onClick: () => e("main"),
|
|
1834
|
-
children: n("editor.ai.back")
|
|
1835
|
-
}
|
|
1836
|
-
),
|
|
1837
|
-
cs.map((i) => /* @__PURE__ */ o(
|
|
1838
|
-
$.Item,
|
|
1839
|
-
{
|
|
1840
|
-
onClick: () => {
|
|
1841
|
-
t(`Change text into ${i} style`);
|
|
1842
|
-
},
|
|
1843
|
-
children: n(`editor.ai.menu.style.${i}`)
|
|
1844
|
-
},
|
|
1845
|
-
i
|
|
1846
|
-
))
|
|
1847
|
-
] }), ms = ({
|
|
1848
|
-
keyType: e,
|
|
1849
|
-
setTypeMenu: t,
|
|
1850
|
-
editor: n,
|
|
1851
|
-
onSubmit: i,
|
|
1852
|
-
response: s,
|
|
1853
|
-
onClose: r,
|
|
1854
|
-
t: l,
|
|
1855
|
-
selection: a
|
|
1856
|
-
}) => {
|
|
1857
|
-
switch (e) {
|
|
1858
|
-
case "main":
|
|
1859
|
-
return /* @__PURE__ */ o(fs, { t: l, setTypeMenu: t, onSubmit: i });
|
|
1860
|
-
case "answer":
|
|
1861
|
-
return /* @__PURE__ */ o(
|
|
1862
|
-
rs,
|
|
1863
|
-
{
|
|
1864
|
-
t: l,
|
|
1865
|
-
onSubmit: i,
|
|
1866
|
-
editor: n,
|
|
1867
|
-
response: s,
|
|
1868
|
-
setTypeMenu: t,
|
|
1869
|
-
onClose: r,
|
|
1870
|
-
selection: a
|
|
1871
|
-
}
|
|
1872
|
-
);
|
|
1873
|
-
case "language":
|
|
1874
|
-
return /* @__PURE__ */ o(ds, { t: l, onSubmit: i, setTypeMenu: t });
|
|
1875
|
-
case "style":
|
|
1876
|
-
return /* @__PURE__ */ o(ps, { t: l, onSubmit: i, setTypeMenu: t });
|
|
1877
|
-
default:
|
|
1878
|
-
return null;
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
function gs(e, t = 40) {
|
|
1882
|
-
const [n, i] = b(""), s = ce(0), r = ce(null), l = ce(null);
|
|
1883
|
-
return Y(() => {
|
|
1884
|
-
if (r.current && clearInterval(r.current), i(""), s.current = 0, !!e)
|
|
1885
|
-
return r.current = setInterval(() => {
|
|
1886
|
-
i((a) => {
|
|
1887
|
-
const c = e[s.current];
|
|
1888
|
-
return s.current += 1, s.current >= e.length && clearInterval(r.current), a + (c || "");
|
|
1889
|
-
});
|
|
1890
|
-
}, t), () => {
|
|
1891
|
-
r.current && clearInterval(r.current);
|
|
1892
|
-
};
|
|
1893
|
-
}, [e, t]), Y(() => {
|
|
1894
|
-
l.current && (l.current.scrollTop = l.current.scrollHeight);
|
|
1895
|
-
}, [n]), { displayedText: n, containerRef: l };
|
|
1896
|
-
}
|
|
1897
|
-
const hs = () => {
|
|
1898
|
-
var pe;
|
|
1899
|
-
const [e, t] = b({
|
|
1900
|
-
top: "0px",
|
|
1901
|
-
bottom: "auto"
|
|
1902
|
-
}), [n, i] = b(!1), [s, r] = b(!1), [l] = nt(), [a, c] = b("main"), [d, u] = b(""), [C, f] = b(""), [w, _] = b(""), [k, P] = b(null), [N, y] = b(!1), { fetchPromptResult: I } = Ae(De), { t: D } = _t(), [O, m] = So(), T = () => {
|
|
1903
|
-
i(!1), r(!1), _(""), c("main"), setTimeout(() => {
|
|
1904
|
-
t({ top: "0px", bottom: "auto" });
|
|
1905
|
-
}, 200);
|
|
1906
|
-
}, v = Mo(() => {
|
|
1907
|
-
T();
|
|
1908
|
-
});
|
|
1909
|
-
Y(() => {
|
|
1910
|
-
n ? (ls(l, f), document.documentElement.style.overflow = "hidden", l.update(() => {
|
|
1911
|
-
const W = ue();
|
|
1912
|
-
W && P(W);
|
|
1913
|
-
})) : (c("main"), document.documentElement.style.overflow = "auto", _(""));
|
|
1914
|
-
}, [n]);
|
|
1915
|
-
const { displayedText: S, containerRef: L } = gs(w, 10), G = (W, R = !0) => {
|
|
1916
|
-
const J = W + ` "${R ? C : ""}"Only return the modified text. Do not include any explanations, introductions, or formatting.`;
|
|
1917
|
-
y(!0), I && I(
|
|
1918
|
-
J,
|
|
1919
|
-
(ne) => {
|
|
1920
|
-
_(ne), y(!1), c("answer"), u("");
|
|
1921
|
-
},
|
|
1922
|
-
() => {
|
|
1923
|
-
y(!1);
|
|
1924
|
-
}
|
|
1925
|
-
);
|
|
1926
|
-
};
|
|
1927
|
-
return Y(() => {
|
|
1928
|
-
var R, J, ne;
|
|
1929
|
-
const { bottom: W } = ((R = O.current) == null ? void 0 : R.getBoundingClientRect()) || {
|
|
1930
|
-
bottom: 0
|
|
1931
|
-
};
|
|
1932
|
-
if (W > window.innerHeight) {
|
|
1933
|
-
const me = (((ne = (J = l._rootElement) == null ? void 0 : J.getBoundingClientRect()) == null ? void 0 : ne.bottom) || 0) - window.innerHeight;
|
|
1934
|
-
t({
|
|
1935
|
-
...e,
|
|
1936
|
-
top: "auto",
|
|
1937
|
-
bottom: `${me}px`
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
}, [m.height, n, O.current]), (pe = l._rootElement) != null && pe.parentElement ? /* @__PURE__ */ H(E, { children: [
|
|
1941
|
-
e.top ? Ct(
|
|
1942
|
-
/* @__PURE__ */ o(
|
|
1943
|
-
gn,
|
|
1944
|
-
{
|
|
1945
|
-
mounted: !!n,
|
|
1946
|
-
transition: "scale-x",
|
|
1947
|
-
duration: 300,
|
|
1948
|
-
timingFunction: "ease",
|
|
1949
|
-
children: (W) => /* @__PURE__ */ o(
|
|
1950
|
-
We,
|
|
1951
|
-
{
|
|
1952
|
-
ref: v,
|
|
1953
|
-
style: {
|
|
1954
|
-
position: "absolute",
|
|
1955
|
-
...e,
|
|
1956
|
-
...W
|
|
1957
|
-
},
|
|
1958
|
-
className: "ai-editor-menu",
|
|
1959
|
-
children: /* @__PURE__ */ H(
|
|
1960
|
-
$,
|
|
1961
|
-
{
|
|
1962
|
-
opened: !!s,
|
|
1963
|
-
closeOnItemClick: !1,
|
|
1964
|
-
position: "bottom-start",
|
|
1965
|
-
zIndex: 99,
|
|
1966
|
-
transitionProps: {
|
|
1967
|
-
transition: "fade",
|
|
1968
|
-
duration: 300
|
|
1969
|
-
},
|
|
1970
|
-
styles: {
|
|
1971
|
-
dropdown: {
|
|
1972
|
-
overflow: "auto"
|
|
1973
|
-
}
|
|
1974
|
-
},
|
|
1975
|
-
offset: 8,
|
|
1976
|
-
middlewares: {
|
|
1977
|
-
flip: !0,
|
|
1978
|
-
size: {
|
|
1979
|
-
apply({ availableHeight: R, elements: J }) {
|
|
1980
|
-
requestAnimationFrame(() => {
|
|
1981
|
-
Object.assign(J.floating.style, {
|
|
1982
|
-
maxHeight: `${R >= 425 ? 425 : R}px`
|
|
1983
|
-
});
|
|
1984
|
-
});
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
},
|
|
1988
|
-
disabled: N,
|
|
1989
|
-
children: [
|
|
1990
|
-
/* @__PURE__ */ o($.Target, { children: /* @__PURE__ */ H(
|
|
1991
|
-
hn,
|
|
1992
|
-
{
|
|
1993
|
-
withBorder: !0,
|
|
1994
|
-
ref: O,
|
|
1995
|
-
shadow: "lg",
|
|
1996
|
-
radius: "md",
|
|
1997
|
-
p: "0",
|
|
1998
|
-
px: "xs",
|
|
1999
|
-
children: [
|
|
2000
|
-
w && /* @__PURE__ */ H(E, { children: [
|
|
2001
|
-
/* @__PURE__ */ H(
|
|
2002
|
-
bn,
|
|
2003
|
-
{
|
|
2004
|
-
gap: 3,
|
|
2005
|
-
align: "flex-start",
|
|
2006
|
-
style: {
|
|
2007
|
-
overflowY: "auto"
|
|
2008
|
-
},
|
|
2009
|
-
mah: 120,
|
|
2010
|
-
ref: L,
|
|
2011
|
-
children: [
|
|
2012
|
-
/* @__PURE__ */ o(
|
|
2013
|
-
We,
|
|
2014
|
-
{
|
|
2015
|
-
style: {
|
|
2016
|
-
flex: 1
|
|
2017
|
-
},
|
|
2018
|
-
w: "auto",
|
|
2019
|
-
py: "xs",
|
|
2020
|
-
children: S
|
|
2021
|
-
}
|
|
2022
|
-
),
|
|
2023
|
-
/* @__PURE__ */ o(We, { w: "auto", mt: "xs", children: /* @__PURE__ */ o(yn, { value: w, timeout: 2e3, children: ({ copied: R, copy: J }) => /* @__PURE__ */ o(
|
|
2024
|
-
ie,
|
|
2025
|
-
{
|
|
2026
|
-
label: R ? "Copied" : "Copy",
|
|
2027
|
-
withArrow: !0,
|
|
2028
|
-
position: "right",
|
|
2029
|
-
children: /* @__PURE__ */ o(
|
|
2030
|
-
ze,
|
|
2031
|
-
{
|
|
2032
|
-
color: R ? "teal" : "gray",
|
|
2033
|
-
variant: "subtle",
|
|
2034
|
-
onClick: J,
|
|
2035
|
-
children: R ? /* @__PURE__ */ o(Hn, { size: 16 }) : /* @__PURE__ */ o(Qt, { size: 16 })
|
|
2036
|
-
}
|
|
2037
|
-
)
|
|
2038
|
-
}
|
|
2039
|
-
) }) })
|
|
2040
|
-
]
|
|
2041
|
-
}
|
|
2042
|
-
),
|
|
2043
|
-
/* @__PURE__ */ o(Cn, { my: "0" })
|
|
2044
|
-
] }),
|
|
2045
|
-
/* @__PURE__ */ o(We, { children: /* @__PURE__ */ o(
|
|
2046
|
-
_n,
|
|
2047
|
-
{
|
|
2048
|
-
size: "md",
|
|
2049
|
-
placeholder: D("editor.ai.placeholder"),
|
|
2050
|
-
rightSectionPointerEvents: "all",
|
|
2051
|
-
variant: "unstyled",
|
|
2052
|
-
value: d,
|
|
2053
|
-
onKeyDown: (R) => {
|
|
2054
|
-
if (R.key === "Enter") {
|
|
2055
|
-
if (N) return;
|
|
2056
|
-
G(d);
|
|
2057
|
-
}
|
|
2058
|
-
},
|
|
2059
|
-
onChange: (R) => {
|
|
2060
|
-
u(R.target.value);
|
|
2061
|
-
},
|
|
2062
|
-
rightSection: /* @__PURE__ */ o(E, { children: N ? /* @__PURE__ */ o(Tn, { color: "violet", size: "16", mr: "xs" }) : /* @__PURE__ */ o(
|
|
2063
|
-
ze,
|
|
2064
|
-
{
|
|
2065
|
-
color: "violet",
|
|
2066
|
-
disabled: !d,
|
|
2067
|
-
variant: "subtle",
|
|
2068
|
-
onClick: () => {
|
|
2069
|
-
G(d);
|
|
2070
|
-
},
|
|
2071
|
-
children: /* @__PURE__ */ o(Mt, { size: 16 })
|
|
2072
|
-
}
|
|
2073
|
-
) })
|
|
2074
|
-
}
|
|
2075
|
-
) })
|
|
2076
|
-
]
|
|
2077
|
-
}
|
|
2078
|
-
) }),
|
|
2079
|
-
/* @__PURE__ */ o(
|
|
2080
|
-
$.Dropdown,
|
|
2081
|
-
{
|
|
2082
|
-
className: "menu-dropdown-ai",
|
|
2083
|
-
onMouseDown: (R) => {
|
|
2084
|
-
R.stopPropagation();
|
|
2085
|
-
},
|
|
2086
|
-
children: /* @__PURE__ */ o(
|
|
2087
|
-
ms,
|
|
2088
|
-
{
|
|
2089
|
-
keyType: a,
|
|
2090
|
-
setTypeMenu: c,
|
|
2091
|
-
editor: l,
|
|
2092
|
-
onSubmit: G,
|
|
2093
|
-
response: w,
|
|
2094
|
-
onClose: T,
|
|
2095
|
-
t: D,
|
|
2096
|
-
selection: k
|
|
2097
|
-
}
|
|
2098
|
-
)
|
|
2099
|
-
}
|
|
2100
|
-
)
|
|
2101
|
-
]
|
|
2102
|
-
}
|
|
2103
|
-
)
|
|
2104
|
-
}
|
|
2105
|
-
)
|
|
2106
|
-
}
|
|
2107
|
-
),
|
|
2108
|
-
l._rootElement.parentElement
|
|
2109
|
-
) : null,
|
|
2110
|
-
/* @__PURE__ */ H(
|
|
2111
|
-
"button",
|
|
2112
|
-
{
|
|
2113
|
-
disabled: !1,
|
|
2114
|
-
className: "toolbar-item spaced alignment",
|
|
2115
|
-
"aria-label": "Formatting options for text alignment",
|
|
2116
|
-
type: "button",
|
|
2117
|
-
onClick: () => {
|
|
2118
|
-
const W = document.querySelector(
|
|
2119
|
-
".floating-text-format-popup"
|
|
2120
|
-
);
|
|
2121
|
-
if (W.style.opacity = "0", W.style.transform = "translate(-10000px, -10000px)", W != null && W.style) {
|
|
2122
|
-
const R = window.getSelection();
|
|
2123
|
-
if ((R == null ? void 0 : R.rangeCount) === 0)
|
|
2124
|
-
return null;
|
|
2125
|
-
if (R) {
|
|
2126
|
-
const ne = R.getRangeAt(0).getBoundingClientRect(), me = document.querySelector(
|
|
2127
|
-
".content-editable-wrapper"
|
|
2128
|
-
), Ce = me.getBoundingClientRect(), Le = ne.top - Ce.top + me.scrollTop + ne.height + "px";
|
|
2129
|
-
t({
|
|
2130
|
-
top: Le,
|
|
2131
|
-
bottom: "auto"
|
|
2132
|
-
}), setTimeout(() => {
|
|
2133
|
-
i(!0);
|
|
2134
|
-
}, 0), setTimeout(() => {
|
|
2135
|
-
r(!0);
|
|
2136
|
-
}, 100);
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
},
|
|
2140
|
-
children: [
|
|
2141
|
-
/* @__PURE__ */ o(Mt, { color: "#7950f2", size: 18 }),
|
|
2142
|
-
/* @__PURE__ */ o(Kn, { size: 21, color: "#7950f2" })
|
|
2143
|
-
]
|
|
2144
|
-
}
|
|
2145
|
-
)
|
|
2146
|
-
] }) : null;
|
|
2147
|
-
}, bs = ({
|
|
2148
|
-
editor: e,
|
|
2149
|
-
isEditable: t,
|
|
2150
|
-
t: n
|
|
2151
|
-
}) => {
|
|
2152
|
-
const { fetchUploadMedia: i, imperativeHandleRef: s } = Ae(De), [r, l] = b(!1);
|
|
2153
|
-
return i ? /* @__PURE__ */ o(
|
|
2154
|
-
Ao,
|
|
2155
|
-
{
|
|
2156
|
-
popoverProps: {
|
|
2157
|
-
opened: r,
|
|
2158
|
-
position: "bottom",
|
|
2159
|
-
onChange: l
|
|
2160
|
-
},
|
|
2161
|
-
onUpload: (a) => {
|
|
2162
|
-
var c, d;
|
|
2163
|
-
!i || !a.length || (l(!1), (c = s == null ? void 0 : s.current) != null && c.insertImages && ((d = s.current) == null || d.insertImages(a)));
|
|
2164
|
-
},
|
|
2165
|
-
onChange: (a) => {
|
|
2166
|
-
e.dispatchCommand(Po, {
|
|
2167
|
-
altText: "",
|
|
2168
|
-
src: a
|
|
2169
|
-
}), l(!1);
|
|
2170
|
-
},
|
|
2171
|
-
children: /* @__PURE__ */ o(ie, { label: n("editor.image.add_photo"), children: /* @__PURE__ */ o(
|
|
2172
|
-
"button",
|
|
2173
|
-
{
|
|
2174
|
-
disabled: !t,
|
|
2175
|
-
type: "button",
|
|
2176
|
-
onClick: () => l((a) => !a),
|
|
2177
|
-
className: "toolbar-item spaced",
|
|
2178
|
-
children: /* @__PURE__ */ o(X, { name: "photo" })
|
|
2179
|
-
}
|
|
2180
|
-
) })
|
|
2181
|
-
}
|
|
2182
|
-
) : null;
|
|
2183
|
-
}, ys = {
|
|
2184
|
-
bullet: "Маркированный список",
|
|
2185
|
-
check: "Чек-лист",
|
|
2186
|
-
code: "Кодовый блок",
|
|
2187
|
-
h1: "Заголовок 1",
|
|
2188
|
-
h2: "Заголовок 2",
|
|
2189
|
-
h3: "Заголовок 3",
|
|
2190
|
-
h4: "Заголовок 4",
|
|
2191
|
-
h5: "Заголовок 5",
|
|
2192
|
-
h6: "Заголовок 6",
|
|
2193
|
-
number: "Нумерованный список",
|
|
2194
|
-
paragraph: "Параграф",
|
|
2195
|
-
quote: "Цитата"
|
|
2196
|
-
};
|
|
2197
|
-
function Ve() {
|
|
2198
|
-
return /* @__PURE__ */ o("div", { className: "divider" });
|
|
2199
|
-
}
|
|
2200
|
-
function Vs({
|
|
2201
|
-
mode: e,
|
|
2202
|
-
isFloating: t
|
|
2203
|
-
}) {
|
|
2204
|
-
const [n] = nt(), [i, s] = b(n), [r, l] = b("paragraph"), [a, c] = b("root"), [d, u] = b(
|
|
2205
|
-
null
|
|
2206
|
-
), [C, f] = b("#000"), [w, _] = b("#fff"), [k, P] = b("left"), [N, y] = b(!1), [I, D] = b(!1), [O, m] = b(!1), [T, v] = b(!1), [S, L] = b(!1), [G, pe] = b(!1), [W, R] = b(!1), [J, ne] = b(!1), [me, Ce] = b(!1), [Le, Ke] = b(!1), [Ie] = ro(), [g, p] = b(!1), [A, j] = b(!0), [U, M] = b(!0), [q, ee] = b(0), [h, B] = b(() => n.isEditable()), re = e || "default", { excludeNodes: F, fetchUploadMedia: z, fetchPromptResult: _e, commentOptions: we } = Ae(De), { t: ae } = _t(), Te = ye(() => {
|
|
2207
|
-
const x = ue();
|
|
2208
|
-
if (de(x)) {
|
|
2209
|
-
const K = x.anchor.getNode(), se = x.focus.getNode(), te = Pt(K) ? null : K.getTopLevelElementOrThrow(), he = Pt(se) ? null : se.getTopLevelElementOrThrow();
|
|
2210
|
-
let Q = K.getKey() === "root" ? K : it(K, (ge) => {
|
|
2211
|
-
const Ge = ge.getParent();
|
|
2212
|
-
return Ge !== null && Qn(Ge);
|
|
2213
|
-
});
|
|
2214
|
-
x.getNodes().length === 1 ? j(!0) : j(!1), Q === null && (Q = K.getTopLevelElementOrThrow());
|
|
2215
|
-
const Z = Q.getKey(), Ue = i.getElementByKey(Z);
|
|
2216
|
-
n.update(() => {
|
|
2217
|
-
D(x.hasFormat("bold")), m(x.hasFormat("italic")), v(x.hasFormat("underline")), L(x.hasFormat("strikethrough")), pe(x.hasFormat("subscript")), R(x.hasFormat("superscript")), ne(x.hasFormat("code"));
|
|
2218
|
-
});
|
|
2219
|
-
const fe = vt(x), Ne = fe.getParent();
|
|
2220
|
-
Re(Ne) || Re(fe) ? y(!0) : y(!1), f(
|
|
2221
|
-
tt(x, "color", "inherit")
|
|
2222
|
-
), _(
|
|
2223
|
-
tt(
|
|
2224
|
-
x,
|
|
2225
|
-
"background-color",
|
|
2226
|
-
"inherit"
|
|
2227
|
-
)
|
|
2228
|
-
);
|
|
2229
|
-
let st;
|
|
2230
|
-
Re(Ne) && (st = it(
|
|
2231
|
-
fe,
|
|
2232
|
-
(ge) => Me(ge) && !ge.isInline()
|
|
2233
|
-
)), P(
|
|
2234
|
-
Me(st) ? st.getFormatType() : Me(fe) ? fe.getFormatType() : (Ne == null ? void 0 : Ne.getFormatType()) || "left"
|
|
2235
|
-
);
|
|
2236
|
-
const un = it(fe, Qe);
|
|
2237
|
-
if (Qe(un) ? c("table") : c("root"), Ue !== null && (te == null ? void 0 : te.getKey()) === (he == null ? void 0 : he.getKey()))
|
|
2238
|
-
if (u(Z), Zt(Q)) {
|
|
2239
|
-
const ge = fn(
|
|
2240
|
-
K,
|
|
2241
|
-
Jt
|
|
2242
|
-
), Ge = ge ? ge.getListType() : Q.getListType();
|
|
2243
|
-
l(Ge);
|
|
2244
|
-
} else {
|
|
2245
|
-
const ge = dt(Q) ? Q.getTag() : Q.getType();
|
|
2246
|
-
ge in ys && l(ge);
|
|
2247
|
-
}
|
|
2248
|
-
else
|
|
2249
|
-
l("");
|
|
2250
|
-
}
|
|
2251
|
-
}, [i, j]);
|
|
2252
|
-
Y(() => n.registerCommand(
|
|
2253
|
-
Xt,
|
|
2254
|
-
(x, K) => (Te(), s(K), !1),
|
|
2255
|
-
rt
|
|
2256
|
-
), [n, Te]), Y(() => Fe(
|
|
2257
|
-
n.registerEditableListener((x) => {
|
|
2258
|
-
B(x);
|
|
2259
|
-
}),
|
|
2260
|
-
i.registerUpdateListener(({ editorState: x }) => {
|
|
2261
|
-
x.read(() => {
|
|
2262
|
-
Te();
|
|
2263
|
-
});
|
|
2264
|
-
}),
|
|
2265
|
-
i.registerCommand(
|
|
2266
|
-
Xn,
|
|
2267
|
-
(x) => (Ce(x), !1),
|
|
2268
|
-
rt
|
|
2269
|
-
),
|
|
2270
|
-
i.registerCommand(
|
|
2271
|
-
Jn,
|
|
2272
|
-
(x) => (Ke(x), !1),
|
|
2273
|
-
rt
|
|
2274
|
-
)
|
|
2275
|
-
), [Te, i, n]), Y(() => Fe(
|
|
2276
|
-
i.registerCommand(
|
|
2277
|
-
Zn,
|
|
2278
|
-
(x) => {
|
|
2279
|
-
const K = x, { code: se, metaKey: te } = K;
|
|
2280
|
-
if (se === "KeyK" && te) {
|
|
2281
|
-
K.preventDefault();
|
|
2282
|
-
let he;
|
|
2283
|
-
return N ? he = null : he = ko("https://"), i.dispatchCommand(oo, he);
|
|
2284
|
-
}
|
|
2285
|
-
return !1;
|
|
2286
|
-
},
|
|
2287
|
-
Dt
|
|
2288
|
-
),
|
|
2289
|
-
i.registerCommand(
|
|
2290
|
-
eo,
|
|
2291
|
-
() => {
|
|
2292
|
-
const x = ue();
|
|
2293
|
-
if (de(x)) {
|
|
2294
|
-
const K = x.getNodes(), se = K.length > 0 && K.every((te) => Je(te) || Qe(te) || kt(te) ? !1 : Me(te) || pt(te));
|
|
2295
|
-
M(!se);
|
|
2296
|
-
}
|
|
2297
|
-
return !1;
|
|
2298
|
-
},
|
|
2299
|
-
Dt
|
|
2300
|
-
)
|
|
2301
|
-
), [i, N]), ye(
|
|
2302
|
-
(x, K) => {
|
|
2303
|
-
i.update(
|
|
2304
|
-
() => {
|
|
2305
|
-
const se = ue();
|
|
2306
|
-
se !== null && Bt(se, x);
|
|
2307
|
-
},
|
|
2308
|
-
K ? { tag: "historic" } : {}
|
|
2309
|
-
);
|
|
2310
|
-
},
|
|
2311
|
-
[i]
|
|
2312
|
-
);
|
|
2313
|
-
const xe = ye(() => {
|
|
2314
|
-
setTimeout(() => {
|
|
2315
|
-
i.dispatchCommand(le, "");
|
|
2316
|
-
}), i.update(() => {
|
|
2317
|
-
const x = ue();
|
|
2318
|
-
if (de(x)) {
|
|
2319
|
-
const K = x.anchor, se = x.focus, te = x.getNodes(), he = x.extract();
|
|
2320
|
-
if (K.key === se.key && K.offset === se.offset)
|
|
2321
|
-
return;
|
|
2322
|
-
te.forEach((Q, ot) => {
|
|
2323
|
-
if (mt(Q)) {
|
|
2324
|
-
let Z = Q;
|
|
2325
|
-
ot === 0 && K.offset !== 0 && (Z = Z.splitText(K.offset)[1] || Z), ot === te.length - 1 && (Z = Z.splitText(se.offset)[0] || Z);
|
|
2326
|
-
const Ue = he[0];
|
|
2327
|
-
te.length === 1 && mt(Ue) && (Z = Ue), Z.__style !== "" && Z.setStyle(""), Z.__format !== 0 && Z.setFormat(0);
|
|
2328
|
-
const fe = pn(Z);
|
|
2329
|
-
fe.__format !== 0 && fe.setFormat(""), fe.__indent !== 0 && fe.setIndent(0), Q = Z;
|
|
2330
|
-
} else dt(Q) || Yt(Q) ? Q.replace(Pe(), !0) : wo(Q) && Q.setFormat("");
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
});
|
|
2334
|
-
}, [i]), Se = (x) => {
|
|
2335
|
-
f(x.color), _(x["background-color"]), i.update(() => {
|
|
2336
|
-
const K = ue();
|
|
2337
|
-
K !== null && Bt(K, x);
|
|
2338
|
-
});
|
|
2339
|
-
}, an = ye(() => {
|
|
2340
|
-
n.dispatchCommand(on, "create"), setTimeout(() => {
|
|
2341
|
-
B(!0);
|
|
2342
|
-
}, 1e3);
|
|
2343
|
-
}, [n]), cn = () => {
|
|
2344
|
-
n.dispatchCommand(to, void 0), ee((x) => x + 1);
|
|
2345
|
-
};
|
|
2346
|
-
return /* @__PURE__ */ o("div", { className: "toolbar-wrapper", tabIndex: -1, children: /* @__PURE__ */ H("div", { className: "toolbar", children: [
|
|
2347
|
-
/* @__PURE__ */ H(E, { children: [
|
|
2348
|
-
/* @__PURE__ */ o(
|
|
2349
|
-
en,
|
|
2350
|
-
{
|
|
2351
|
-
disabled: U,
|
|
2352
|
-
blockType: r,
|
|
2353
|
-
rootType: a,
|
|
2354
|
-
editor: n,
|
|
2355
|
-
mode: re,
|
|
2356
|
-
fetchUploadMedia: z,
|
|
2357
|
-
excludeNodes: F
|
|
2358
|
-
}
|
|
2359
|
-
),
|
|
2360
|
-
/* @__PURE__ */ o(Ve, {})
|
|
2361
|
-
] }),
|
|
2362
|
-
e === "editor" && !0 && _e && /* @__PURE__ */ H(E, { children: [
|
|
2363
|
-
/* @__PURE__ */ o(dn, { fallback: null, children: /* @__PURE__ */ o(hs, {}) }),
|
|
2364
|
-
/* @__PURE__ */ o(Ve, {})
|
|
2365
|
-
] }),
|
|
2366
|
-
/* @__PURE__ */ H(E, { children: [
|
|
2367
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.bold"), children: /* @__PURE__ */ o(
|
|
2368
|
-
"button",
|
|
2369
|
-
{
|
|
2370
|
-
disabled: !h,
|
|
2371
|
-
onClick: () => {
|
|
2372
|
-
i.dispatchCommand(le, "bold");
|
|
2373
|
-
},
|
|
2374
|
-
className: "toolbar-item spaced " + (I ? "active" : ""),
|
|
2375
|
-
type: "button",
|
|
2376
|
-
"data-test-id": "toolbar-bold",
|
|
2377
|
-
children: /* @__PURE__ */ o(X, { name: "bold" })
|
|
2378
|
-
}
|
|
2379
|
-
) }),
|
|
2380
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.italic"), children: /* @__PURE__ */ o(
|
|
2381
|
-
"button",
|
|
2382
|
-
{
|
|
2383
|
-
disabled: !h,
|
|
2384
|
-
onClick: () => {
|
|
2385
|
-
i.dispatchCommand(le, "italic");
|
|
2386
|
-
},
|
|
2387
|
-
className: "toolbar-item spaced " + (O ? "active" : ""),
|
|
2388
|
-
type: "button",
|
|
2389
|
-
"data-test-id": "toolbar-italic",
|
|
2390
|
-
children: /* @__PURE__ */ o(X, { name: "italic" })
|
|
2391
|
-
}
|
|
2392
|
-
) }),
|
|
2393
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.underline"), children: /* @__PURE__ */ o(
|
|
2394
|
-
"button",
|
|
2395
|
-
{
|
|
2396
|
-
disabled: !h,
|
|
2397
|
-
"data-test-id": "toolbar-underline",
|
|
2398
|
-
onClick: () => {
|
|
2399
|
-
i.dispatchCommand(le, "underline");
|
|
2400
|
-
},
|
|
2401
|
-
className: "toolbar-item spaced " + (T ? "active" : ""),
|
|
2402
|
-
type: "button",
|
|
2403
|
-
children: /* @__PURE__ */ o(X, { name: "underline" })
|
|
2404
|
-
}
|
|
2405
|
-
) }),
|
|
2406
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.strike"), children: /* @__PURE__ */ o(
|
|
2407
|
-
"button",
|
|
2408
|
-
{
|
|
2409
|
-
disabled: !h,
|
|
2410
|
-
className: "toolbar-item spaced " + (S ? "active" : ""),
|
|
2411
|
-
"data-test-id": "toolbar-strikethrough",
|
|
2412
|
-
onClick: () => {
|
|
2413
|
-
i.dispatchCommand(
|
|
2414
|
-
le,
|
|
2415
|
-
"strikethrough"
|
|
2416
|
-
);
|
|
2417
|
-
},
|
|
2418
|
-
children: /* @__PURE__ */ o(X, { name: "strikethrough" })
|
|
2419
|
-
}
|
|
2420
|
-
) }),
|
|
2421
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.code"), children: /* @__PURE__ */ o(
|
|
2422
|
-
"button",
|
|
2423
|
-
{
|
|
2424
|
-
disabled: !h,
|
|
2425
|
-
onClick: () => {
|
|
2426
|
-
i.dispatchCommand(le, "code");
|
|
2427
|
-
},
|
|
2428
|
-
className: "toolbar-item spaced " + (J ? "active" : ""),
|
|
2429
|
-
type: "button",
|
|
2430
|
-
"data-test-id": "toolbar-code",
|
|
2431
|
-
children: /* @__PURE__ */ o(X, { name: "code" })
|
|
2432
|
-
}
|
|
2433
|
-
) }),
|
|
2434
|
-
/* @__PURE__ */ o(ie, { label: ae("editor.toolbar.clear"), children: /* @__PURE__ */ o(
|
|
2435
|
-
"button",
|
|
2436
|
-
{
|
|
2437
|
-
disabled: !h,
|
|
2438
|
-
className: "toolbar-item",
|
|
2439
|
-
onClick: xe,
|
|
2440
|
-
"data-test-id": "toolbar-clear-format",
|
|
2441
|
-
children: /* @__PURE__ */ o(X, { name: "сlear-format" })
|
|
2442
|
-
}
|
|
2443
|
-
) }),
|
|
2444
|
-
/* @__PURE__ */ o(ie, { disabled: !h, label: ae("editor.toolbar.link"), children: /* @__PURE__ */ o(
|
|
2445
|
-
"button",
|
|
2446
|
-
{
|
|
2447
|
-
onClick: an,
|
|
2448
|
-
className: "toolbar-item spaced " + (N ? "active" : ""),
|
|
2449
|
-
onMouseDown: () => {
|
|
2450
|
-
B(!1);
|
|
2451
|
-
},
|
|
2452
|
-
type: "button",
|
|
2453
|
-
"data-test-id": "toolbar-link",
|
|
2454
|
-
children: /* @__PURE__ */ o(X, { name: "link" })
|
|
2455
|
-
}
|
|
2456
|
-
) }),
|
|
2457
|
-
we && e === "editor" && /* @__PURE__ */ o(ie, { label: ae("editor.toolbar.comment"), children: /* @__PURE__ */ o(
|
|
2458
|
-
"button",
|
|
2459
|
-
{
|
|
2460
|
-
onClick: cn,
|
|
2461
|
-
className: "toolbar-item spaced " + (N ? "active" : ""),
|
|
2462
|
-
type: "button",
|
|
2463
|
-
"data-test-id": "toolbar-comment",
|
|
2464
|
-
children: /* @__PURE__ */ o(X, { name: "message" })
|
|
2465
|
-
}
|
|
2466
|
-
) }, q),
|
|
2467
|
-
/* @__PURE__ */ o(
|
|
2468
|
-
ht,
|
|
2469
|
-
{
|
|
2470
|
-
value: { color: C, background: w },
|
|
2471
|
-
menuProps: {
|
|
2472
|
-
closeOnItemClick: !0
|
|
2473
|
-
},
|
|
2474
|
-
onChange: (x) => {
|
|
2475
|
-
Se({
|
|
2476
|
-
color: C,
|
|
2477
|
-
"background-color": w,
|
|
2478
|
-
[x.mode === "color" ? "color" : "background-color"]: x.value
|
|
2479
|
-
});
|
|
2480
|
-
},
|
|
2481
|
-
disabled: !h,
|
|
2482
|
-
modes: ["color", "background"]
|
|
2483
|
-
}
|
|
2484
|
-
)
|
|
2485
|
-
] }),
|
|
2486
|
-
/* @__PURE__ */ o(Ve, {}),
|
|
2487
|
-
/* @__PURE__ */ o(
|
|
2488
|
-
vo,
|
|
2489
|
-
{
|
|
2490
|
-
disabled: !h,
|
|
2491
|
-
value: k,
|
|
2492
|
-
editor: n,
|
|
2493
|
-
isRTL: g,
|
|
2494
|
-
setElementFormat: P
|
|
2495
|
-
}
|
|
2496
|
-
),
|
|
2497
|
-
e === "default" && /* @__PURE__ */ H(E, { children: [
|
|
2498
|
-
/* @__PURE__ */ o(Ve, {}),
|
|
2499
|
-
/* @__PURE__ */ o(bs, { editor: n, t: ae, isEditable: h })
|
|
2500
|
-
] }),
|
|
2501
|
-
Ie
|
|
2502
|
-
] }) });
|
|
2503
|
-
}
|
|
2504
|
-
export {
|
|
2505
|
-
qs as D,
|
|
2506
|
-
Ys as F,
|
|
2507
|
-
Vs as T,
|
|
2508
|
-
It as g,
|
|
2509
|
-
$o as m,
|
|
2510
|
-
Fo as s
|
|
2511
|
-
};
|