@templatical/editor 0.21.0 → 0.21.1
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/{AiFeatureMenu-CPdNpHpZ.js → AiFeatureMenu-CcqQDHzJ.js} +1 -1
- package/dist/{CloudEditor-3a7mqMhe.js → CloudEditor-Dnww6og-.js} +5 -5
- package/dist/{CollaboratorBar-Ds0YZWzV.js → CollaboratorBar-Bj4NZiie.js} +1 -1
- package/dist/CountdownBlock-J_Q9JRQM.js +91 -0
- package/dist/{ParagraphEditor-CkwBirNl.js → ParagraphEditor--_zWfxps.js} +1 -1
- package/dist/{SaveBlockDialog-Cc5BSUBx.js → SaveBlockDialog-CYIEHABH.js} +3 -3
- package/dist/{SavedBlockPreviewCanvas-ubttfmKr.js → SavedBlockPreviewCanvas-2-mzAnZE.js} +1 -1
- package/dist/{SavedBlocksBrowserModal-LkY_U3lY.js → SavedBlocksBrowserModal-D5V5yF_3.js} +4 -4
- package/dist/{SavedBlocksPanels-CET0zvH6.js → SavedBlocksPanels-Dff38YXu.js} +1 -1
- package/dist/{SavedBlocksPickBar-poGS4PoI.js → SavedBlocksPickBar-rB6iyji6.js} +1 -1
- package/dist/{SnapshotHistory-BvF5IXn1.js → SnapshotHistory-FtzDq8f0.js} +1 -1
- package/dist/{TestEmailModal-BRaM_eko.js → TestEmailModal-DL2O1H8M.js} +2 -2
- package/dist/{TitleEditor-Bhgzh-iQ.js → TitleEditor-CPda5lh-.js} +1 -1
- package/dist/{TplModal-BA-Zsg0O.js → TplModal-C7Koj5gM.js} +1 -1
- package/dist/{blockTypeIcons-B1-Yzp-a.js → blockTypeIcons-CgwECCut.js} +1 -1
- package/dist/bundle-stats.json +8 -8
- package/dist/cdn/chunks/AiChatSidebar-A1CuWGY0.js +203 -0
- package/dist/cdn/chunks/AiChatSidebar-A1CuWGY0.js.map +1 -0
- package/dist/cdn/chunks/{AiFeatureMenu--PdArSnv.js → AiFeatureMenu-Duwg413F.js} +9 -5
- package/dist/cdn/chunks/{AiFeatureMenu--PdArSnv.js.map → AiFeatureMenu-Duwg413F.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-DMSd0SIl.js → BlockIssueBadge-Da4yR-mh.js} +7 -5
- package/dist/cdn/chunks/{BlockIssueBadge-DMSd0SIl.js.map → BlockIssueBadge-Da4yR-mh.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-DnTfI5GU.js → CloudEditor-B3hqbwfP.js} +179 -170
- package/dist/cdn/chunks/{CloudEditor-DnTfI5GU.js.map → CloudEditor-B3hqbwfP.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-CBqd7ldq.js → CollaboratorBar-BS3rJy6-.js} +7 -6
- package/dist/cdn/chunks/{CollaboratorBar-CBqd7ldq.js.map → CollaboratorBar-BS3rJy6-.js.map} +1 -1
- package/dist/cdn/chunks/{ColorPicker-DCdWP8YB.js → ColorPicker-DZSzZ5ZP.js} +107 -103
- package/dist/cdn/chunks/{ColorPicker-DCdWP8YB.js.map → ColorPicker-DZSzZ5ZP.js.map} +1 -1
- package/dist/cdn/chunks/CommentsSidebar-DHdRiGPX.js +412 -0
- package/dist/cdn/chunks/CommentsSidebar-DHdRiGPX.js.map +1 -0
- package/dist/cdn/chunks/CountdownBlock-Bffpoppw.js +93 -0
- package/dist/cdn/chunks/{CountdownBlock-BDnWMAME.js.map → CountdownBlock-Bffpoppw.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-BbLoo22S.js → CountdownToolbar-DAnmIZjq.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-BbLoo22S.js.map → CountdownToolbar-DAnmIZjq.js.map} +1 -1
- package/dist/cdn/chunks/DesignReferenceSidebar-Dre99DTH.js +223 -0
- package/dist/cdn/chunks/DesignReferenceSidebar-Dre99DTH.js.map +1 -0
- package/dist/cdn/chunks/{IssuesPanel-CfudrI3T.js → IssuesPanel-D80JedOj.js} +11 -10
- package/dist/cdn/chunks/{IssuesPanel-CfudrI3T.js.map → IssuesPanel-D80JedOj.js.map} +1 -1
- package/dist/cdn/chunks/LoadingTrack-D-CW2tUa.js +12 -0
- package/dist/cdn/chunks/LoadingTrack-D-CW2tUa.js.map +1 -0
- package/dist/cdn/chunks/{NumberWithSuffix-BmMx9_n_.js → NumberWithSuffix-CjlVNIEe.js} +2 -2
- package/dist/cdn/chunks/{NumberWithSuffix-BmMx9_n_.js.map → NumberWithSuffix-CjlVNIEe.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-DPCUSXpx.js → ParagraphEditor-CtaRa1vr.js} +73 -68
- package/dist/cdn/chunks/{ParagraphEditor-DPCUSXpx.js.map → ParagraphEditor-CtaRa1vr.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-B8dOiv_D.js → RichTextEditorContent-BbdgJqWM.js} +9 -6
- package/dist/cdn/chunks/{RichTextEditorContent-B8dOiv_D.js.map → RichTextEditorContent-BbdgJqWM.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-BY3SMnNV.js → SaveBlockDialog-Bb3fdUEZ.js} +30 -26
- package/dist/cdn/chunks/{SaveBlockDialog-BY3SMnNV.js.map → SaveBlockDialog-Bb3fdUEZ.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlockPreviewCanvas-LpaOcusq.js → SavedBlockPreviewCanvas-DZOMgNsz.js} +33 -32
- package/dist/cdn/chunks/{SavedBlockPreviewCanvas-LpaOcusq.js.map → SavedBlockPreviewCanvas-DZOMgNsz.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CfIcmyzF.js → SavedBlocksBrowserModal-CeUWcPv0.js} +14 -10
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-CfIcmyzF.js.map → SavedBlocksBrowserModal-CeUWcPv0.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-kIowCfh_.js → SavedBlocksPanels-D-pA_wfk.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-kIowCfh_.js.map → SavedBlocksPanels-D-pA_wfk.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-WSGe1GiZ.js → SavedBlocksPickBar-1rf1KpqS.js} +6 -4
- package/dist/cdn/chunks/{SavedBlocksPickBar-WSGe1GiZ.js.map → SavedBlocksPickBar-1rf1KpqS.js.map} +1 -1
- package/dist/cdn/chunks/SnapshotHistory-Bf1uovti.js +121 -0
- package/dist/cdn/chunks/SnapshotHistory-Bf1uovti.js.map +1 -0
- package/dist/cdn/chunks/TemplateScoringPanel-CTk8WwxU.js +231 -0
- package/dist/cdn/chunks/TemplateScoringPanel-CTk8WwxU.js.map +1 -0
- package/dist/cdn/chunks/TestEmailModal-BJTDxFHh.js +96 -0
- package/dist/cdn/chunks/TestEmailModal-BJTDxFHh.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-iwd-O9sO.js → TitleEditor-BJ7LFykI.js} +15 -12
- package/dist/cdn/chunks/{TitleEditor-iwd-O9sO.js.map → TitleEditor-BJ7LFykI.js.map} +1 -1
- package/dist/cdn/chunks/TplModal-CH9RzKF7.js +50 -0
- package/dist/cdn/chunks/TplModal-CH9RzKF7.js.map +1 -0
- package/dist/cdn/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/cdn/chunks/blockTypeIcons-etMMQoVv.js +21 -0
- package/dist/cdn/chunks/{blockTypeIcons-BYz0fgLz.js.map → blockTypeIcons-etMMQoVv.js.map} +1 -1
- package/dist/cdn/chunks/cloud-BJlbXGTJ.js +1787 -0
- package/dist/cdn/chunks/cloud-BJlbXGTJ.js.map +1 -0
- package/dist/cdn/chunks/dist-CiBEt0VR.js +163 -0
- package/dist/cdn/chunks/dist-CiBEt0VR.js.map +1 -0
- package/dist/cdn/chunks/dist-CxTt8FRE.js +403 -0
- package/dist/cdn/chunks/dist-CxTt8FRE.js.map +1 -0
- package/dist/cdn/chunks/{extensions-DeJh3E9b.js → extensions-ZX2oarW6.js} +17 -15
- package/dist/cdn/chunks/{extensions-DeJh3E9b.js.map → extensions-ZX2oarW6.js.map} +1 -1
- package/dist/cdn/chunks/formatRelativeTime-CtUU-QZ8.js +12 -0
- package/dist/cdn/chunks/formatRelativeTime-CtUU-QZ8.js.map +1 -0
- package/dist/cdn/chunks/htmlparser-CZa2V5cF.js +1008 -0
- package/dist/cdn/chunks/htmlparser-CZa2V5cF.js.map +1 -0
- package/dist/cdn/chunks/icons-CYWw8Xfp.js +1190 -0
- package/dist/cdn/chunks/icons-CYWw8Xfp.js.map +1 -0
- package/dist/cdn/chunks/keys-D7kUmfpE.js +12 -0
- package/dist/cdn/chunks/keys-D7kUmfpE.js.map +1 -0
- package/dist/cdn/chunks/src-BKI1x1k7.js +546 -0
- package/dist/cdn/chunks/src-BKI1x1k7.js.map +1 -0
- package/dist/cdn/chunks/src-CM0gCvAS.js +1176 -0
- package/dist/cdn/chunks/src-CM0gCvAS.js.map +1 -0
- package/dist/cdn/chunks/{media-library-mCCZieYO.js → src-D6F_3XkE.js} +1782 -1280
- package/dist/cdn/chunks/src-D6F_3XkE.js.map +1 -0
- package/dist/cdn/chunks/{renderer-Yg1XhsBN.js → src-DYji-wXB.js} +118 -134
- package/dist/cdn/chunks/src-DYji-wXB.js.map +1 -0
- package/dist/cdn/chunks/{styles-Bp5Jsu9J.js → styles-DMOEiSX9.js} +867 -859
- package/dist/cdn/chunks/styles-DMOEiSX9.js.map +1 -0
- package/dist/cdn/chunks/timeouts-Bmi_yePw.js +6 -0
- package/dist/cdn/chunks/timeouts-Bmi_yePw.js.map +1 -0
- package/dist/cdn/chunks/useAliveFlag-aanU8uqB.js +12 -0
- package/dist/cdn/chunks/useAliveFlag-aanU8uqB.js.map +1 -0
- package/dist/cdn/chunks/useCloudI18n-BjNENqkM.js +25 -0
- package/dist/cdn/chunks/useCloudI18n-BjNENqkM.js.map +1 -0
- package/dist/cdn/chunks/useEditorCore-BA6mspzD.js +3019 -0
- package/dist/cdn/chunks/useEditorCore-BA6mspzD.js.map +1 -0
- package/dist/cdn/chunks/useI18n-8Wd7G-cq.js +19 -0
- package/dist/cdn/chunks/useI18n-8Wd7G-cq.js.map +1 -0
- package/dist/cdn/chunks/useMergeTag-C7G31KV-.js +46 -0
- package/dist/cdn/chunks/useMergeTag-C7G31KV-.js.map +1 -0
- package/dist/cdn/chunks/usePopoverPosition-Bx0QewTv.js +61 -0
- package/dist/cdn/chunks/usePopoverPosition-Bx0QewTv.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +72 -69
- package/dist/cdn/editor.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-DIDAJdkj.js → styles-PcOPXvLO.js} +547 -549
- package/dist/templatical-editor.js +5 -5
- package/dist/{useEditorCore-Bd9CA4L_.js → useEditorCore-CT1slufs.js} +3 -3
- package/package.json +7 -7
- package/dist/CountdownBlock-BUHYIAe9.js +0 -92
- package/dist/cdn/chunks/CountdownBlock-BDnWMAME.js +0 -93
- package/dist/cdn/chunks/blockTypeIcons-BYz0fgLz.js +0 -22
- package/dist/cdn/chunks/features-pLfGJWIB.js +0 -7813
- package/dist/cdn/chunks/features-pLfGJWIB.js.map +0 -1
- package/dist/cdn/chunks/icons-FLemooQz.js +0 -690
- package/dist/cdn/chunks/icons-FLemooQz.js.map +0 -1
- package/dist/cdn/chunks/media-library-mCCZieYO.js.map +0 -1
- package/dist/cdn/chunks/quality-BRbHtAk1.js +0 -2180
- package/dist/cdn/chunks/quality-BRbHtAk1.js.map +0 -1
- package/dist/cdn/chunks/renderer-Yg1XhsBN.js.map +0 -1
- package/dist/cdn/chunks/src-BDJeYiVE.js +0 -509
- package/dist/cdn/chunks/src-BDJeYiVE.js.map +0 -1
- package/dist/cdn/chunks/styles-Bp5Jsu9J.js.map +0 -1
|
@@ -0,0 +1,3019 @@
|
|
|
1
|
+
import { $ as e, A as t, C as n, F as r, G as i, H as a, J as o, K as s, L as c, M as l, N as u, O as d, P as f, T as p, U as m, V as h, X as g, Y as _, Z as v, at as y, b, c as x, ct as S, f as C, g as w, h as T, it as E, k as D, l as O, m as k, nt as A, ot as j, p as M, rt as N, s as P, st as F, t as ee, u as I, v as L, x as R, y as z, z as B } from "./draggable-D840DIZB.js";
|
|
2
|
+
import "./timeouts-Bmi_yePw.js";
|
|
3
|
+
import { A as V, C as te, D as ne, E as re, F as ie, J as ae, M as oe, N as se, O as ce, S as le, T as ue, _ as de, a as fe, b as pe, c as me, d as he, f as ge, g as _e, h as ve, i as ye, j as be, k as xe, l as Se, n as Ce, p as we, q as Te, r as H, s as Ee, t as De, u as Oe, v as ke, w as Ae, x as je, y as Me } from "./src-BKI1x1k7.js";
|
|
4
|
+
import { _ as Ne, h as Pe, v as Fe, y as Ie } from "./dist-CiBEt0VR.js";
|
|
5
|
+
import { a as U, c as Le, i as Re, r as ze } from "./dist-CxTt8FRE.js";
|
|
6
|
+
import { A as Be, B as Ve, C as He, D as Ue, E as We, I as Ge, L as Ke, M as qe, N as Je, O as Ye, R as Xe, S as Ze, T as Qe, _ as $e, a as et, b as tt, d as nt, f as rt, g as it, h as W, i as at, j as ot, k as st, l as ct, m as lt, n as ut, o as dt, p as ft, s as pt, v as mt, w as ht, x as gt, y as _t, z as vt } from "./keys-D7kUmfpE.js";
|
|
7
|
+
import { t as G } from "./useI18n-8Wd7G-cq.js";
|
|
8
|
+
import { a as yt, i as bt, o as xt, r as K, t as St } from "./usePopoverPosition-Bx0QewTv.js";
|
|
9
|
+
import { Ct, Et as wt, Lt as Tt, Rt as Et, V as Dt, Y as Ot, _t as kt, d as At, dt as jt, et as Mt, g as Nt, k as Pt, mt as Ft, o as It, rt as Lt, s as Rt, u as zt, wt as Bt } from "./icons-CYWw8Xfp.js";
|
|
10
|
+
import { t as Vt } from "./LoadingTrack-D-CW2tUa.js";
|
|
11
|
+
import { t as Ht } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
12
|
+
import "./useCloudI18n-BjNENqkM.js";
|
|
13
|
+
import { t as q } from "./useMergeTag-C7G31KV-.js";
|
|
14
|
+
import { t as Ut } from "./useAliveFlag-aanU8uqB.js";
|
|
15
|
+
//#region ../core/src/editor.ts
|
|
16
|
+
function Wt(e) {
|
|
17
|
+
return e === "1" ? 1 : e === "3" ? 3 : 2;
|
|
18
|
+
}
|
|
19
|
+
function Gt(e) {
|
|
20
|
+
let t = _({
|
|
21
|
+
content: e.content ?? be(e.defaultFontFamily, e.templateDefaults),
|
|
22
|
+
selectedBlockId: null,
|
|
23
|
+
viewport: "desktop",
|
|
24
|
+
darkMode: !1,
|
|
25
|
+
previewMode: !1,
|
|
26
|
+
isDirty: !1,
|
|
27
|
+
uiTheme: "auto"
|
|
28
|
+
}), n = m({
|
|
29
|
+
get: () => t.content,
|
|
30
|
+
set: (e) => {
|
|
31
|
+
t.content = e, t.isDirty = !0;
|
|
32
|
+
}
|
|
33
|
+
}), r = m(() => t.selectedBlockId ? i(t.content.blocks, t.selectedBlockId) : null);
|
|
34
|
+
function i(e, t) {
|
|
35
|
+
for (let n of e) {
|
|
36
|
+
if (n.id === t) return n;
|
|
37
|
+
if (n.type === "section") for (let e of n.children) {
|
|
38
|
+
let n = i(e, t);
|
|
39
|
+
if (n) return n;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function a(e, t) {
|
|
45
|
+
if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) a(e, t);
|
|
46
|
+
}
|
|
47
|
+
function o(e, t, n = { blocks: e }) {
|
|
48
|
+
for (let r = 0; r < e.length; r++) {
|
|
49
|
+
let i = e[r];
|
|
50
|
+
if (i.id === t) return n;
|
|
51
|
+
if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
|
|
52
|
+
let n = o(i.children[e], t, {
|
|
53
|
+
blocks: i.children[e],
|
|
54
|
+
sectionId: i.id,
|
|
55
|
+
columnIndex: e
|
|
56
|
+
});
|
|
57
|
+
if (n) return n;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function s(t) {
|
|
63
|
+
return e.lockedBlocks?.value.has(t) ?? !1;
|
|
64
|
+
}
|
|
65
|
+
function c(e) {
|
|
66
|
+
let n = o(t.content.blocks, e);
|
|
67
|
+
if (!n) return null;
|
|
68
|
+
let r = n.blocks.findIndex((t) => t.id === e);
|
|
69
|
+
return r === -1 ? null : {
|
|
70
|
+
targetSectionId: n.sectionId,
|
|
71
|
+
columnIndex: n.columnIndex,
|
|
72
|
+
index: r
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function l(e, n = !0) {
|
|
76
|
+
t.content = e, n && (t.isDirty = !0);
|
|
77
|
+
}
|
|
78
|
+
function u(e) {
|
|
79
|
+
e && s(e) || (t.selectedBlockId = e);
|
|
80
|
+
}
|
|
81
|
+
function d(e) {
|
|
82
|
+
t.viewport = e;
|
|
83
|
+
}
|
|
84
|
+
function f(e) {
|
|
85
|
+
t.darkMode = e;
|
|
86
|
+
}
|
|
87
|
+
function p(e) {
|
|
88
|
+
t.uiTheme = e;
|
|
89
|
+
}
|
|
90
|
+
function h(e) {
|
|
91
|
+
t.previewMode = e, e && (t.selectedBlockId = null);
|
|
92
|
+
}
|
|
93
|
+
function v(e, n) {
|
|
94
|
+
if (s(e)) return;
|
|
95
|
+
let r = i(t.content.blocks, e);
|
|
96
|
+
r && (Object.assign(r, n), t.isDirty = !0);
|
|
97
|
+
}
|
|
98
|
+
function y(e) {
|
|
99
|
+
t.content.settings = {
|
|
100
|
+
...t.content.settings,
|
|
101
|
+
...e
|
|
102
|
+
}, t.isDirty = !0;
|
|
103
|
+
}
|
|
104
|
+
function b(e, n, r = 0, a) {
|
|
105
|
+
if (!(n && e.type === "section")) {
|
|
106
|
+
if (n) {
|
|
107
|
+
if (s(n)) return;
|
|
108
|
+
let o = i(t.content.blocks, n);
|
|
109
|
+
if (o && o.type === "section") {
|
|
110
|
+
if (r < 0 || r >= Wt(o.columns)) return;
|
|
111
|
+
o.children[r] = o.children[r] || [];
|
|
112
|
+
let t = o.children[r];
|
|
113
|
+
a !== void 0 && a < t.length ? t.splice(a, 0, e) : t.push(e);
|
|
114
|
+
}
|
|
115
|
+
} else a !== void 0 && a < t.content.blocks.length ? t.content.blocks.splice(a, 0, e) : t.content.blocks.push(e);
|
|
116
|
+
t.isDirty = !0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function x(e) {
|
|
120
|
+
if (s(e)) return;
|
|
121
|
+
let n = o(t.content.blocks, e);
|
|
122
|
+
if (n) {
|
|
123
|
+
let r = n.blocks.findIndex((t) => t.id === e);
|
|
124
|
+
if (r !== -1) {
|
|
125
|
+
let [e] = n.blocks.splice(r, 1);
|
|
126
|
+
if (t.selectedBlockId) {
|
|
127
|
+
let n = /* @__PURE__ */ new Set();
|
|
128
|
+
a(e, n), n.has(t.selectedBlockId) && (t.selectedBlockId = null);
|
|
129
|
+
}
|
|
130
|
+
t.isDirty = !0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function S(e, n, r, a = 0) {
|
|
135
|
+
if (s(e) || r && s(r)) return;
|
|
136
|
+
let c = o(t.content.blocks, e);
|
|
137
|
+
if (!c) return;
|
|
138
|
+
let l = c.blocks.findIndex((t) => t.id === e);
|
|
139
|
+
if (l === -1 || r && c.blocks[l].type === "section") return;
|
|
140
|
+
let u;
|
|
141
|
+
if (r) {
|
|
142
|
+
let e = i(t.content.blocks, r);
|
|
143
|
+
if (!e || e.type !== "section" || a < 0 || a >= Wt(e.columns)) return;
|
|
144
|
+
e.children[a] = e.children[a] || [], u = e.children[a];
|
|
145
|
+
} else u = t.content.blocks;
|
|
146
|
+
let [d] = c.blocks.splice(l, 1);
|
|
147
|
+
u.splice(n, 0, d), t.isDirty = !0;
|
|
148
|
+
}
|
|
149
|
+
function C() {
|
|
150
|
+
t.isDirty = !0;
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
state: g(t),
|
|
154
|
+
content: n,
|
|
155
|
+
selectedBlock: r,
|
|
156
|
+
isBlockLocked: s,
|
|
157
|
+
setContent: l,
|
|
158
|
+
selectBlock: u,
|
|
159
|
+
setViewport: d,
|
|
160
|
+
setDarkMode: f,
|
|
161
|
+
setUiTheme: p,
|
|
162
|
+
setPreviewMode: h,
|
|
163
|
+
updateBlock: v,
|
|
164
|
+
updateSettings: y,
|
|
165
|
+
addBlock: b,
|
|
166
|
+
removeBlock: x,
|
|
167
|
+
moveBlock: S,
|
|
168
|
+
markDirty: C,
|
|
169
|
+
findBlockLocation: c
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region ../core/src/history.ts
|
|
174
|
+
var Kt = 50, qt = 300, Jt = 1500;
|
|
175
|
+
function Yt(e) {
|
|
176
|
+
let { content: t, setContent: n, isRemoteOperation: r, maxSize: i = Kt } = e, a = v([]), o = v([]), s = v(!1), c = null, l = null, u = m(() => a.value.length > 0), d = m(() => o.value.length > 0);
|
|
177
|
+
function f() {
|
|
178
|
+
return we(t.value);
|
|
179
|
+
}
|
|
180
|
+
function p(e) {
|
|
181
|
+
a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
|
|
182
|
+
}
|
|
183
|
+
function h() {
|
|
184
|
+
l &&= (clearTimeout(l.timeoutId), null);
|
|
185
|
+
}
|
|
186
|
+
function g() {
|
|
187
|
+
r?.() || (h(), p(f()), o.value = []);
|
|
188
|
+
}
|
|
189
|
+
function _(e) {
|
|
190
|
+
if (!r?.()) {
|
|
191
|
+
if (l && l.blockId === e) {
|
|
192
|
+
clearTimeout(l.timeoutId), l.timeoutId = setTimeout(() => {
|
|
193
|
+
l = null;
|
|
194
|
+
}, qt);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
h(), p(f()), o.value = [], l = {
|
|
198
|
+
blockId: e,
|
|
199
|
+
timeoutId: setTimeout(() => {
|
|
200
|
+
l = null;
|
|
201
|
+
}, qt)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function y() {
|
|
206
|
+
s.value = !0, c && clearTimeout(c), c = setTimeout(() => {
|
|
207
|
+
s.value = !1, c = null;
|
|
208
|
+
}, Jt);
|
|
209
|
+
}
|
|
210
|
+
function b() {
|
|
211
|
+
if (a.value.length === 0) return;
|
|
212
|
+
h();
|
|
213
|
+
let e = a.value.pop();
|
|
214
|
+
o.value.push(f()), n(e, !0), y();
|
|
215
|
+
}
|
|
216
|
+
function x() {
|
|
217
|
+
if (o.value.length === 0) return;
|
|
218
|
+
h();
|
|
219
|
+
let e = o.value.pop();
|
|
220
|
+
a.value.push(f()), n(e, !0), y();
|
|
221
|
+
}
|
|
222
|
+
function S() {
|
|
223
|
+
a.value = [], o.value = [], h();
|
|
224
|
+
}
|
|
225
|
+
function C() {
|
|
226
|
+
S(), c &&= (clearTimeout(c), null);
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
canUndo: u,
|
|
230
|
+
canRedo: d,
|
|
231
|
+
isNavigating: s,
|
|
232
|
+
undo: b,
|
|
233
|
+
redo: x,
|
|
234
|
+
record: g,
|
|
235
|
+
recordDebounced: _,
|
|
236
|
+
clear: S,
|
|
237
|
+
destroy: C
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region ../core/src/block-actions.ts
|
|
242
|
+
function Xt(e) {
|
|
243
|
+
e.type === "table" ? e.rows = e.rows.map((e) => ({
|
|
244
|
+
...e,
|
|
245
|
+
id: V(),
|
|
246
|
+
cells: e.cells.map((e) => ({
|
|
247
|
+
...e,
|
|
248
|
+
id: V()
|
|
249
|
+
}))
|
|
250
|
+
})) : e.type === "social" ? e.icons = e.icons.map((e) => ({
|
|
251
|
+
...e,
|
|
252
|
+
id: V()
|
|
253
|
+
})) : e.type === "menu" && (e.items = e.items.map((e) => ({
|
|
254
|
+
...e,
|
|
255
|
+
id: V()
|
|
256
|
+
})));
|
|
257
|
+
}
|
|
258
|
+
function Zt(e) {
|
|
259
|
+
let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
|
|
260
|
+
function o(n, r, a) {
|
|
261
|
+
let o = ve(n, e.blockDefaults);
|
|
262
|
+
return t(o, r, a), i(o.id), o;
|
|
263
|
+
}
|
|
264
|
+
function s(e, n, r) {
|
|
265
|
+
let o = JSON.parse(JSON.stringify(e));
|
|
266
|
+
if (o.id = V(), Xt(o), o.type === "section" && (o.children = o.children.map((e) => e.map((e) => {
|
|
267
|
+
let t = JSON.parse(JSON.stringify(e));
|
|
268
|
+
return t.id = V(), Xt(t), t;
|
|
269
|
+
}))), n !== void 0 || r !== void 0) t(o, n, r);
|
|
270
|
+
else {
|
|
271
|
+
let i = a?.(e.id) ?? null;
|
|
272
|
+
i ? t(o, i.targetSectionId, i.columnIndex, i.index + 1) : t(o, n, r);
|
|
273
|
+
}
|
|
274
|
+
return i(o.id), o;
|
|
275
|
+
}
|
|
276
|
+
function c(e) {
|
|
277
|
+
n(e);
|
|
278
|
+
}
|
|
279
|
+
function l(e, t, n) {
|
|
280
|
+
r(e, { [t]: n });
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
createAndAddBlock: o,
|
|
284
|
+
duplicateBlock: s,
|
|
285
|
+
deleteBlock: c,
|
|
286
|
+
updateBlockProperty: l
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region ../core/src/auto-save.ts
|
|
291
|
+
function Qt(e) {
|
|
292
|
+
let { content: t, isDirty: n, onChange: r, debounce: i = 1e3, enabled: a = !0 } = e, o = null, s = !1;
|
|
293
|
+
function c() {
|
|
294
|
+
return typeof a == "function" ? a() : a;
|
|
295
|
+
}
|
|
296
|
+
function l() {
|
|
297
|
+
s = !0, d();
|
|
298
|
+
}
|
|
299
|
+
function u() {
|
|
300
|
+
s = !1;
|
|
301
|
+
}
|
|
302
|
+
function d() {
|
|
303
|
+
o &&= (clearTimeout(o), null);
|
|
304
|
+
}
|
|
305
|
+
function f() {
|
|
306
|
+
d(), n() && r(JSON.parse(JSON.stringify(t.value)));
|
|
307
|
+
}
|
|
308
|
+
function p() {
|
|
309
|
+
!c() || s || (d(), o = setTimeout(() => {
|
|
310
|
+
o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
|
|
311
|
+
}, i));
|
|
312
|
+
}
|
|
313
|
+
let m = y(t, () => {
|
|
314
|
+
c() && !s && n() && p();
|
|
315
|
+
}, { deep: !0 });
|
|
316
|
+
function h() {
|
|
317
|
+
m(), d();
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
flush: f,
|
|
321
|
+
cancel: d,
|
|
322
|
+
pause: l,
|
|
323
|
+
resume: u,
|
|
324
|
+
destroy: h
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region ../core/src/condition-preview.ts
|
|
329
|
+
function $t(e) {
|
|
330
|
+
let t = _(/* @__PURE__ */ new Set()), n = m(() => t.size > 0);
|
|
331
|
+
function r(e) {
|
|
332
|
+
return t.has(e);
|
|
333
|
+
}
|
|
334
|
+
function i(n) {
|
|
335
|
+
t.has(n) ? t.delete(n) : (t.add(n), e.state.selectedBlockId === n && e.selectBlock(null));
|
|
336
|
+
}
|
|
337
|
+
function a() {
|
|
338
|
+
t.clear();
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
isHidden: r,
|
|
342
|
+
toggleBlock: i,
|
|
343
|
+
reset: a,
|
|
344
|
+
hasHiddenBlocks: n
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region ../core/src/data-source-fetch.ts
|
|
349
|
+
function en(e) {
|
|
350
|
+
let t = v(!1), n = v(!1), r = m(() => !!e.definition.value?.dataSource), i = m(() => r.value && !e.block.value.dataSourceFetched);
|
|
351
|
+
async function a() {
|
|
352
|
+
let r = e.definition.value;
|
|
353
|
+
if (r?.dataSource) {
|
|
354
|
+
t.value = !0, n.value = !1;
|
|
355
|
+
try {
|
|
356
|
+
let t = await r.dataSource.onFetch({
|
|
357
|
+
fieldValues: { ...e.block.value.fieldValues },
|
|
358
|
+
blockId: e.block.value.id
|
|
359
|
+
});
|
|
360
|
+
if (t == null) return;
|
|
361
|
+
let n = { ...e.block.value.fieldValues };
|
|
362
|
+
for (let e of Object.keys(n)) e in t && (n[e] = t[e]);
|
|
363
|
+
e.onUpdate(n, !0);
|
|
364
|
+
} catch (e) {
|
|
365
|
+
console.warn("[Templatical] Data source fetch error:", e), n.value = !0;
|
|
366
|
+
} finally {
|
|
367
|
+
t.value = !1;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
isFetching: t,
|
|
373
|
+
fetchError: n,
|
|
374
|
+
fetch: a,
|
|
375
|
+
hasDataSource: r,
|
|
376
|
+
needsFetch: i
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region ../core/src/history-interceptor.ts
|
|
381
|
+
function tn(e, t) {
|
|
382
|
+
let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
|
|
383
|
+
e.addBlock = (r, i, a, o) => {
|
|
384
|
+
i && e.isBlockLocked(i) || (t.record(), n(r, i, a, o));
|
|
385
|
+
}, e.removeBlock = (n) => {
|
|
386
|
+
e.isBlockLocked(n) || (t.record(), r(n));
|
|
387
|
+
}, e.moveBlock = (n, r, a, o) => {
|
|
388
|
+
e.isBlockLocked(n) || a && e.isBlockLocked(a) || (t.record(), i(n, r, a, o));
|
|
389
|
+
}, e.updateBlock = (n, r) => {
|
|
390
|
+
e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r));
|
|
391
|
+
}, e.updateSettings = (e) => {
|
|
392
|
+
t.record(), o(e);
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region ../core/src/saved-blocks.ts
|
|
397
|
+
function nn(e) {
|
|
398
|
+
let { provider: t } = e, n = v([]), r = v(!1), i = C(() => {
|
|
399
|
+
let e = /* @__PURE__ */ new Set();
|
|
400
|
+
for (let t of n.value) {
|
|
401
|
+
let n = t.category?.trim();
|
|
402
|
+
n && e.add(n);
|
|
403
|
+
}
|
|
404
|
+
return [...e].sort((e, t) => e.localeCompare(t));
|
|
405
|
+
}), a = C(() => typeof t.create == "function"), o = C(() => typeof t.update == "function"), s = C(() => typeof t.delete == "function");
|
|
406
|
+
function c(e) {
|
|
407
|
+
return o.value && e.canUpdate !== !1;
|
|
408
|
+
}
|
|
409
|
+
function l(e) {
|
|
410
|
+
return s.value && e.canDelete !== !1;
|
|
411
|
+
}
|
|
412
|
+
function u(e, t) {
|
|
413
|
+
throw new De(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
|
|
414
|
+
}
|
|
415
|
+
async function d(i) {
|
|
416
|
+
r.value = !0;
|
|
417
|
+
try {
|
|
418
|
+
n.value = await t.list(i);
|
|
419
|
+
} catch (t) {
|
|
420
|
+
throw e.onError?.(t), t;
|
|
421
|
+
} finally {
|
|
422
|
+
r.value = !1;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
async function f(r, i, a) {
|
|
426
|
+
let { create: o } = t;
|
|
427
|
+
typeof o != "function" && u("create", "disabled by the provider");
|
|
428
|
+
try {
|
|
429
|
+
let e = await o(a ? {
|
|
430
|
+
name: r,
|
|
431
|
+
content: i,
|
|
432
|
+
category: a
|
|
433
|
+
} : {
|
|
434
|
+
name: r,
|
|
435
|
+
content: i
|
|
436
|
+
});
|
|
437
|
+
return n.value = [e, ...n.value], e;
|
|
438
|
+
} catch (t) {
|
|
439
|
+
throw e.onError?.(t), t;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
async function p(r, i) {
|
|
443
|
+
let { update: a } = t;
|
|
444
|
+
typeof a != "function" && u("update", "disabled by the provider");
|
|
445
|
+
let o = n.value.find((e) => e.id === r);
|
|
446
|
+
o && o.canUpdate === !1 && u("update", `not permitted for entry "${r}"`);
|
|
447
|
+
try {
|
|
448
|
+
let e = await a(r, i);
|
|
449
|
+
return n.value = n.value.map((t) => t.id === r ? e : t), e;
|
|
450
|
+
} catch (t) {
|
|
451
|
+
throw e.onError?.(t), t;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
async function m(r) {
|
|
455
|
+
let { delete: i } = t;
|
|
456
|
+
typeof i != "function" && u("delete", "disabled by the provider");
|
|
457
|
+
let a = n.value.find((e) => e.id === r);
|
|
458
|
+
a && a.canDelete === !1 && u("delete", `not permitted for entry "${r}"`);
|
|
459
|
+
try {
|
|
460
|
+
await i(r), n.value = n.value.filter((e) => e.id !== r);
|
|
461
|
+
} catch (t) {
|
|
462
|
+
throw e.onError?.(t), t;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
savedBlocks: n,
|
|
467
|
+
isLoading: r,
|
|
468
|
+
categories: i,
|
|
469
|
+
canCreate: a,
|
|
470
|
+
canUpdate: o,
|
|
471
|
+
canDelete: s,
|
|
472
|
+
canUpdateBlock: c,
|
|
473
|
+
canDeleteBlock: l,
|
|
474
|
+
load: d,
|
|
475
|
+
create: f,
|
|
476
|
+
update: p,
|
|
477
|
+
remove: m
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region ../core/src/saved-blocks-local.ts
|
|
482
|
+
var rn = "templatical:saved-blocks";
|
|
483
|
+
function an(e = {}) {
|
|
484
|
+
let t = e.key ?? rn;
|
|
485
|
+
function n() {
|
|
486
|
+
if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.");
|
|
487
|
+
return localStorage;
|
|
488
|
+
}
|
|
489
|
+
function r() {
|
|
490
|
+
let e = n().getItem(t);
|
|
491
|
+
if (!e) return [];
|
|
492
|
+
try {
|
|
493
|
+
let t = JSON.parse(e);
|
|
494
|
+
return Array.isArray(t) ? t : [];
|
|
495
|
+
} catch {
|
|
496
|
+
return [];
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function i(e) {
|
|
500
|
+
n().setItem(t, JSON.stringify(e));
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
async list(e) {
|
|
504
|
+
let t = r(), n = e?.search?.trim().toLowerCase(), i = e?.category?.trim();
|
|
505
|
+
return t.filter((e) => !(n && !e.name.toLowerCase().includes(n) || i && e.category !== i));
|
|
506
|
+
},
|
|
507
|
+
async create(e) {
|
|
508
|
+
let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
|
|
509
|
+
id: V(),
|
|
510
|
+
name: e.name,
|
|
511
|
+
content: e.content,
|
|
512
|
+
...e.category ? { category: e.category } : {},
|
|
513
|
+
createdAt: t,
|
|
514
|
+
updatedAt: t
|
|
515
|
+
};
|
|
516
|
+
return i([n, ...r()]), n;
|
|
517
|
+
},
|
|
518
|
+
async update(e, t) {
|
|
519
|
+
let n = r(), a = n.findIndex((t) => t.id === e);
|
|
520
|
+
if (a === -1) throw Error(`[Templatical] Saved block not found: ${e}`);
|
|
521
|
+
let o = {
|
|
522
|
+
...n[a],
|
|
523
|
+
...t,
|
|
524
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
525
|
+
}, s = [...n];
|
|
526
|
+
return s[a] = o, i(s), o;
|
|
527
|
+
},
|
|
528
|
+
async delete(e) {
|
|
529
|
+
let t = r();
|
|
530
|
+
if (!t.some((t) => t.id === e)) throw Error(`[Templatical] Saved block not found: ${e}`);
|
|
531
|
+
i(t.filter((t) => t.id !== e));
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/utils/activeEditorTracker.ts
|
|
537
|
+
var J = /* @__PURE__ */ new Set(), Y = 0, on = 0;
|
|
538
|
+
function sn() {
|
|
539
|
+
let e = ++on;
|
|
540
|
+
return J.add(e), Y === 0 && (Y = e), {
|
|
541
|
+
id: e,
|
|
542
|
+
isActive: () => J.size <= 1 || Y === e,
|
|
543
|
+
claim: () => {
|
|
544
|
+
Y = e;
|
|
545
|
+
},
|
|
546
|
+
dispose: () => {
|
|
547
|
+
if (J.delete(e), Y === e) {
|
|
548
|
+
let e = Array.from(J);
|
|
549
|
+
Y = e[e.length - 1] ?? 0;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/composables/useImageUrlResolver.ts
|
|
556
|
+
function cn(e) {
|
|
557
|
+
let t = _(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
|
|
558
|
+
function r(e) {
|
|
559
|
+
return t.get(e);
|
|
560
|
+
}
|
|
561
|
+
function i(e) {
|
|
562
|
+
return t.has(e) || n.has(e);
|
|
563
|
+
}
|
|
564
|
+
function a(r) {
|
|
565
|
+
if (i(r)) return;
|
|
566
|
+
let a;
|
|
567
|
+
try {
|
|
568
|
+
a = e(r);
|
|
569
|
+
} catch {
|
|
570
|
+
t.set(r, null);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (a === null || typeof a == "string") {
|
|
574
|
+
t.set(r, a);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
n.add(r), Promise.resolve(a).then((e) => {
|
|
578
|
+
t.set(r, typeof e == "string" ? e : null);
|
|
579
|
+
}, () => {
|
|
580
|
+
t.set(r, null);
|
|
581
|
+
}).finally(() => n.delete(r));
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
get: r,
|
|
585
|
+
has: i,
|
|
586
|
+
lookup: a
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function X(e) {
|
|
590
|
+
let t = p(tt, null), n = C(e);
|
|
591
|
+
if (!t) return n;
|
|
592
|
+
let r;
|
|
593
|
+
function a() {
|
|
594
|
+
r !== void 0 && (clearTimeout(r), r = void 0);
|
|
595
|
+
}
|
|
596
|
+
i() && o(a);
|
|
597
|
+
let s = !0;
|
|
598
|
+
return B(n, (e) => {
|
|
599
|
+
a();
|
|
600
|
+
let n = s;
|
|
601
|
+
if (s = !1, !(!e || t.has(e))) {
|
|
602
|
+
if (n) {
|
|
603
|
+
t.lookup(e);
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
r = setTimeout(() => {
|
|
607
|
+
r = void 0, t.lookup(e);
|
|
608
|
+
}, 300);
|
|
609
|
+
}
|
|
610
|
+
}, { immediate: !0 }), C(() => {
|
|
611
|
+
let e = n.value;
|
|
612
|
+
if (!e) return e;
|
|
613
|
+
let r = t.get(e);
|
|
614
|
+
return typeof r == "string" && r.length > 0 ? r : e;
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/composables/useMergeTagPicker.ts
|
|
619
|
+
function ln() {
|
|
620
|
+
let e = v(!1), t = v([]), n = null;
|
|
621
|
+
function r(r) {
|
|
622
|
+
if (n) {
|
|
623
|
+
let e = n;
|
|
624
|
+
n = null, e(null);
|
|
625
|
+
}
|
|
626
|
+
return t.value = r, e.value = !0, new Promise((e) => {
|
|
627
|
+
n = e;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function a(r) {
|
|
631
|
+
let i = n;
|
|
632
|
+
n = null, e.value = !1, t.value = [], i && i(r);
|
|
633
|
+
}
|
|
634
|
+
return i() && o(() => {
|
|
635
|
+
if (n) {
|
|
636
|
+
let e = n;
|
|
637
|
+
n = null, e(null);
|
|
638
|
+
}
|
|
639
|
+
e.value = !1, t.value = [];
|
|
640
|
+
}), {
|
|
641
|
+
isOpen: e,
|
|
642
|
+
tags: t,
|
|
643
|
+
open: r,
|
|
644
|
+
resolve: a
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region src/composables/useLogicTagPicker.ts
|
|
649
|
+
function un() {
|
|
650
|
+
let e = v(!1), t = v([]), n = v([]), r = null;
|
|
651
|
+
function a(i, a) {
|
|
652
|
+
if (r) {
|
|
653
|
+
let e = r;
|
|
654
|
+
r = null, e(null);
|
|
655
|
+
}
|
|
656
|
+
return t.value = i, n.value = a, e.value = !0, new Promise((e) => {
|
|
657
|
+
r = e;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function s(i) {
|
|
661
|
+
let a = r;
|
|
662
|
+
r = null, e.value = !1, t.value = [], n.value = [], a && a(i);
|
|
663
|
+
}
|
|
664
|
+
return i() && o(() => {
|
|
665
|
+
if (r) {
|
|
666
|
+
let e = r;
|
|
667
|
+
r = null, e(null);
|
|
668
|
+
}
|
|
669
|
+
e.value = !1, t.value = [], n.value = [];
|
|
670
|
+
}), {
|
|
671
|
+
isOpen: e,
|
|
672
|
+
tags: t,
|
|
673
|
+
pairs: n,
|
|
674
|
+
open: a,
|
|
675
|
+
resolve: s
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/composables/useTemplateLint.ts
|
|
680
|
+
function dn(e) {
|
|
681
|
+
return e ? e.disabled === !0 || e.accessibility === !1 && e.structure === !1 && e.links === !1 : !1;
|
|
682
|
+
}
|
|
683
|
+
function fn(t) {
|
|
684
|
+
let n = v([]), r = v(!1), i = v(!1), a = e(null), o = dn(t.options), s = null, c = !1;
|
|
685
|
+
o || l();
|
|
686
|
+
async function l() {
|
|
687
|
+
try {
|
|
688
|
+
let e = await import("./src-CM0gCvAS.js");
|
|
689
|
+
if (c) return;
|
|
690
|
+
a.value = { lintTemplate: e.lintTemplate }, r.value = !0, u(), s = Ie(t.content, u, {
|
|
691
|
+
debounce: t.debounce ?? 500,
|
|
692
|
+
deep: !0
|
|
693
|
+
});
|
|
694
|
+
} catch {
|
|
695
|
+
if (c) return;
|
|
696
|
+
i.value = !0;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function u() {
|
|
700
|
+
a.value && (n.value = a.value.lintTemplate(t.content.value, t.options));
|
|
701
|
+
}
|
|
702
|
+
let d = B(() => t.options, () => {
|
|
703
|
+
a.value && u();
|
|
704
|
+
}, { deep: !0 });
|
|
705
|
+
function f(e) {
|
|
706
|
+
e.fix && e.fix.apply({
|
|
707
|
+
updateBlock: t.updateBlock,
|
|
708
|
+
updateSettings: t.updateSettings,
|
|
709
|
+
removeBlock: t.removeBlock
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
function p() {
|
|
713
|
+
c = !0, s?.(), d();
|
|
714
|
+
}
|
|
715
|
+
return {
|
|
716
|
+
issues: n,
|
|
717
|
+
ready: r,
|
|
718
|
+
unavailable: i,
|
|
719
|
+
applyFix: f,
|
|
720
|
+
destroy: p
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/utils/blockTypeLabels.ts
|
|
725
|
+
function pn(e, t) {
|
|
726
|
+
return t.blocks[e] ?? e;
|
|
727
|
+
}
|
|
728
|
+
function mn(e, t, n = []) {
|
|
729
|
+
if (e.type !== "custom") return pn(e.type, t);
|
|
730
|
+
let { customType: r } = e;
|
|
731
|
+
return n.find((e) => e.type === r)?.name ?? r;
|
|
732
|
+
}
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/composables/useKeyboardReorder.ts
|
|
735
|
+
function hn(e, t, n = []) {
|
|
736
|
+
let r = v(null), i = v(""), a = null;
|
|
737
|
+
function o(t) {
|
|
738
|
+
let n = e.content.value.blocks, r = n.findIndex((e) => e.id === t);
|
|
739
|
+
if (r !== -1) return {
|
|
740
|
+
index: r,
|
|
741
|
+
total: n.length
|
|
742
|
+
};
|
|
743
|
+
for (let e of n) {
|
|
744
|
+
if (e.type !== "section") continue;
|
|
745
|
+
let n = e;
|
|
746
|
+
for (let e = 0; e < n.children.length; e++) {
|
|
747
|
+
let r = n.children[e], i = r.findIndex((e) => e.id === t);
|
|
748
|
+
if (i !== -1) return {
|
|
749
|
+
index: i,
|
|
750
|
+
total: r.length,
|
|
751
|
+
sectionId: n.id,
|
|
752
|
+
columnIndex: e
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
function s(r) {
|
|
759
|
+
let i = o(r);
|
|
760
|
+
if (!i) return "";
|
|
761
|
+
let a = (i.sectionId ? c(i.sectionId, i.columnIndex ?? 0) : e.content.value.blocks)?.[i.index];
|
|
762
|
+
return a ? mn(a, t.t, n) : "";
|
|
763
|
+
}
|
|
764
|
+
function c(t, n) {
|
|
765
|
+
return e.content.value.blocks.find((e) => e.id === t && e.type === "section")?.children[n] ?? null;
|
|
766
|
+
}
|
|
767
|
+
function l(e) {
|
|
768
|
+
i.value = "", queueMicrotask(() => {
|
|
769
|
+
i.value = e;
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
function u(e) {
|
|
773
|
+
return r.value === e;
|
|
774
|
+
}
|
|
775
|
+
function d(e) {
|
|
776
|
+
let n = o(e);
|
|
777
|
+
n && (r.value = e, a = n, l(t.format(t.t.blockActions.lifted, {
|
|
778
|
+
block: s(e),
|
|
779
|
+
position: String(n.index + 1),
|
|
780
|
+
total: String(n.total)
|
|
781
|
+
})));
|
|
782
|
+
}
|
|
783
|
+
function f(n, r) {
|
|
784
|
+
let i = o(n);
|
|
785
|
+
if (!i) return;
|
|
786
|
+
let a = i.index + r;
|
|
787
|
+
a < 0 || a >= i.total || (e.moveBlock(n, a, i.sectionId, i.columnIndex), l(t.format(t.t.blockActions.moved, {
|
|
788
|
+
block: s(n),
|
|
789
|
+
position: String(a + 1),
|
|
790
|
+
total: String(i.total)
|
|
791
|
+
})));
|
|
792
|
+
}
|
|
793
|
+
function p(e) {
|
|
794
|
+
f(e, -1);
|
|
795
|
+
}
|
|
796
|
+
function m(e) {
|
|
797
|
+
f(e, 1);
|
|
798
|
+
}
|
|
799
|
+
function h(e) {
|
|
800
|
+
let n = o(e);
|
|
801
|
+
n && l(t.format(t.t.blockActions.dropped, {
|
|
802
|
+
block: s(e),
|
|
803
|
+
position: String(n.index + 1),
|
|
804
|
+
total: String(n.total)
|
|
805
|
+
})), r.value = null, a = null;
|
|
806
|
+
}
|
|
807
|
+
function g() {
|
|
808
|
+
let n = r.value;
|
|
809
|
+
if (n && a) {
|
|
810
|
+
let r = o(n);
|
|
811
|
+
r && (r && (r.sectionId !== a.sectionId || r.columnIndex !== a.columnIndex) || r && r.index !== a.index) && e.moveBlock(n, a.index, a.sectionId, a.columnIndex), l(t.format(t.t.blockActions.cancelled, {
|
|
812
|
+
block: s(n),
|
|
813
|
+
position: String(a.index + 1)
|
|
814
|
+
}));
|
|
815
|
+
}
|
|
816
|
+
r.value = null, a = null;
|
|
817
|
+
}
|
|
818
|
+
return {
|
|
819
|
+
liftedBlockId: r,
|
|
820
|
+
announcement: i,
|
|
821
|
+
isLifted: u,
|
|
822
|
+
lift: d,
|
|
823
|
+
cancel: g,
|
|
824
|
+
moveUp: p,
|
|
825
|
+
moveDown: m,
|
|
826
|
+
drop: h
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/composables/useUiTheme.ts
|
|
831
|
+
function gn(e) {
|
|
832
|
+
let t = Le("(prefers-color-scheme: dark)");
|
|
833
|
+
return { resolvedTheme: C(() => e.value === "auto" ? t.value ? "dark" : "light" : e.value) };
|
|
834
|
+
}
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/composables/useThemeStyles.ts
|
|
837
|
+
var _n = {
|
|
838
|
+
bg: "--tpl-bg",
|
|
839
|
+
bgElevated: "--tpl-bg-elevated",
|
|
840
|
+
bgHover: "--tpl-bg-hover",
|
|
841
|
+
bgActive: "--tpl-bg-active",
|
|
842
|
+
border: "--tpl-border",
|
|
843
|
+
borderLight: "--tpl-border-light",
|
|
844
|
+
text: "--tpl-text",
|
|
845
|
+
textMuted: "--tpl-text-muted",
|
|
846
|
+
textDim: "--tpl-text-dim",
|
|
847
|
+
primary: "--tpl-primary",
|
|
848
|
+
primaryHover: "--tpl-primary-hover",
|
|
849
|
+
primaryLight: "--tpl-primary-light",
|
|
850
|
+
secondary: "--tpl-secondary",
|
|
851
|
+
secondaryHover: "--tpl-secondary-hover",
|
|
852
|
+
secondaryLight: "--tpl-secondary-light",
|
|
853
|
+
success: "--tpl-success",
|
|
854
|
+
successLight: "--tpl-success-light",
|
|
855
|
+
warning: "--tpl-warning",
|
|
856
|
+
warningLight: "--tpl-warning-light",
|
|
857
|
+
danger: "--tpl-danger",
|
|
858
|
+
dangerLight: "--tpl-danger-light",
|
|
859
|
+
canvasBg: "--tpl-canvas-bg"
|
|
860
|
+
};
|
|
861
|
+
function vn({ themeOverrides: e, resolvedTheme: t, extraStyles: n }) {
|
|
862
|
+
return { themeStyles: C(() => {
|
|
863
|
+
let r = {}, i = e.value, a = t.value === "dark" ? i.dark : i;
|
|
864
|
+
if (a) for (let [e, t] of Object.entries(_n)) {
|
|
865
|
+
let n = a[e];
|
|
866
|
+
n && (r[t] = n);
|
|
867
|
+
}
|
|
868
|
+
return n && Object.assign(r, n()), r;
|
|
869
|
+
}) };
|
|
870
|
+
}
|
|
871
|
+
//#endregion
|
|
872
|
+
//#region src/utils/logger.ts
|
|
873
|
+
var Z = "[Templatical]";
|
|
874
|
+
function yn() {
|
|
875
|
+
return typeof process < "u" && !0;
|
|
876
|
+
}
|
|
877
|
+
var Q = {
|
|
878
|
+
warn(...e) {
|
|
879
|
+
console.warn(Z, ...e);
|
|
880
|
+
},
|
|
881
|
+
error(...e) {
|
|
882
|
+
console.error(Z, ...e);
|
|
883
|
+
},
|
|
884
|
+
debug(...e) {
|
|
885
|
+
yn() || console.debug(Z, ...e);
|
|
886
|
+
},
|
|
887
|
+
info(...e) {
|
|
888
|
+
yn() || console.info(Z, ...e);
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region src/composables/useBlockRegistry.ts
|
|
893
|
+
function bn() {
|
|
894
|
+
let t = e(/* @__PURE__ */ new Map());
|
|
895
|
+
function n(e, n) {
|
|
896
|
+
t.value.set(e, n), N(t);
|
|
897
|
+
}
|
|
898
|
+
function r(e, n) {
|
|
899
|
+
let r = `custom:${e.type}`;
|
|
900
|
+
t.value.set(r, {
|
|
901
|
+
component: n,
|
|
902
|
+
createBlock: () => ke(e),
|
|
903
|
+
definition: e
|
|
904
|
+
}), N(t);
|
|
905
|
+
}
|
|
906
|
+
function i(e) {
|
|
907
|
+
if (e.type === "custom") {
|
|
908
|
+
let n = `custom:${e.customType}`;
|
|
909
|
+
return t.value.get(n)?.component;
|
|
910
|
+
}
|
|
911
|
+
return t.value.get(e.type)?.component;
|
|
912
|
+
}
|
|
913
|
+
function a(e) {
|
|
914
|
+
return t.value.get(e)?.createBlock();
|
|
915
|
+
}
|
|
916
|
+
function o(e) {
|
|
917
|
+
let n = `custom:${e}`;
|
|
918
|
+
return t.value.get(n)?.definition;
|
|
919
|
+
}
|
|
920
|
+
function s(e) {
|
|
921
|
+
return `<div style="color: var(--tpl-text-muted); padding: 16px; text-align: center; border: 1px dashed var(--tpl-border); border-radius: var(--tpl-radius-sm); font-family: var(--tpl-font-family); font-size: 14px;">${e}</div>`;
|
|
922
|
+
}
|
|
923
|
+
async function c(e) {
|
|
924
|
+
let t = o(e.customType);
|
|
925
|
+
if (!t) return s("Block definition not found");
|
|
926
|
+
try {
|
|
927
|
+
let { Liquid: n } = await import("./liquid.browser-BJOEu6Cg.js");
|
|
928
|
+
return await new n({
|
|
929
|
+
strictVariables: !1,
|
|
930
|
+
strictFilters: !1
|
|
931
|
+
}).parseAndRender(t.template, e.fieldValues);
|
|
932
|
+
} catch (t) {
|
|
933
|
+
return Q.error(`Failed to render custom block "${e.customType}":`, t), s(`Render error: ${e.customType}`);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function l(e) {
|
|
937
|
+
return t.value.has(e);
|
|
938
|
+
}
|
|
939
|
+
return {
|
|
940
|
+
registerBuiltIn: n,
|
|
941
|
+
registerCustom: r,
|
|
942
|
+
getComponent: i,
|
|
943
|
+
createBlock: a,
|
|
944
|
+
getDefinition: o,
|
|
945
|
+
renderCustomBlock: c,
|
|
946
|
+
isRegistered: l
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/composables/useCustomBlockStylesheets.ts
|
|
951
|
+
function xn(e, t) {
|
|
952
|
+
return C(() => {
|
|
953
|
+
let n = Sn(e.value.blocks);
|
|
954
|
+
if (n.size === 0) return [];
|
|
955
|
+
let r = /* @__PURE__ */ new Set(), i = [];
|
|
956
|
+
for (let e of n) {
|
|
957
|
+
let n = t.getDefinition(e)?.stylesheet;
|
|
958
|
+
if (!n) continue;
|
|
959
|
+
let a = n.trim();
|
|
960
|
+
a === "" || r.has(a) || (r.add(a), i.push(a));
|
|
961
|
+
}
|
|
962
|
+
return i;
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
function Sn(e) {
|
|
966
|
+
let t = /* @__PURE__ */ new Set();
|
|
967
|
+
return Cn(e, t), t;
|
|
968
|
+
}
|
|
969
|
+
function Cn(e, t) {
|
|
970
|
+
for (let n of e) {
|
|
971
|
+
if (ie(n)) {
|
|
972
|
+
t.add(n.customType);
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
975
|
+
if (n.type === "section") {
|
|
976
|
+
let e = n.children;
|
|
977
|
+
if (!e) continue;
|
|
978
|
+
for (let n of e) Cn(n, t);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region src/utils/registerBuiltInBlocks.ts
|
|
984
|
+
var wn = [
|
|
985
|
+
{
|
|
986
|
+
type: "section",
|
|
987
|
+
createBlock: Ae
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
type: "title",
|
|
991
|
+
createBlock: ce
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
type: "paragraph",
|
|
995
|
+
createBlock: te
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
type: "image",
|
|
999
|
+
createBlock: je
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
type: "button",
|
|
1003
|
+
createBlock: _e
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
type: "divider",
|
|
1007
|
+
createBlock: Me
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
type: "video",
|
|
1011
|
+
createBlock: xe
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
type: "social",
|
|
1015
|
+
createBlock: ue
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
type: "menu",
|
|
1019
|
+
createBlock: le
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
type: "table",
|
|
1023
|
+
createBlock: ne
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
type: "spacer",
|
|
1027
|
+
createBlock: re
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
type: "html",
|
|
1031
|
+
createBlock: pe
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
type: "countdown",
|
|
1035
|
+
createBlock: de
|
|
1036
|
+
}
|
|
1037
|
+
];
|
|
1038
|
+
function Tn(e, t) {
|
|
1039
|
+
for (let n of wn) {
|
|
1040
|
+
let r = t[n.type];
|
|
1041
|
+
r && e.registerBuiltIn(n.type, {
|
|
1042
|
+
component: r,
|
|
1043
|
+
createBlock: n.createBlock
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
//#endregion
|
|
1048
|
+
//#region src/utils/resolveHtmlBlockPreview.ts
|
|
1049
|
+
function En(e) {
|
|
1050
|
+
return typeof e == "boolean" ? e : e?.enabled ?? !1;
|
|
1051
|
+
}
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region src/utils/collectOffPaletteDefaults.ts
|
|
1054
|
+
function Dn(e) {
|
|
1055
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1056
|
+
}
|
|
1057
|
+
function On(e, t, n) {
|
|
1058
|
+
let r = new Set(e.map((e) => K(e))), i = [], a = (e, t) => {
|
|
1059
|
+
for (let [n, o] of Object.entries(e)) typeof o == "string" ? o !== "" && /color$/i.test(n) && !r.has(K(o)) && i.push(`${t}.${n}: ${o}`) : Dn(o) && a(o, `${t}.${n}`);
|
|
1060
|
+
}, o = t;
|
|
1061
|
+
for (let [e, t] of Object.entries(oe)) {
|
|
1062
|
+
let n = o?.[e];
|
|
1063
|
+
a({
|
|
1064
|
+
...t,
|
|
1065
|
+
...Dn(n) ? n : {}
|
|
1066
|
+
}, e);
|
|
1067
|
+
}
|
|
1068
|
+
return a({
|
|
1069
|
+
...se,
|
|
1070
|
+
...n ?? {}
|
|
1071
|
+
}, "template"), i;
|
|
1072
|
+
}
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region src/utils/resolveFieldColors.ts
|
|
1075
|
+
function kn(e, t) {
|
|
1076
|
+
let n = xt({ presets: e.presets }, yt), r = n.presets.length === 0;
|
|
1077
|
+
return {
|
|
1078
|
+
presets: r ? t.presets : n.presets,
|
|
1079
|
+
allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
|
|
1080
|
+
invalidPresets: n.invalidPresets,
|
|
1081
|
+
emptyPresets: e.presets !== void 0 && e.presets.length === 0,
|
|
1082
|
+
presetsInherited: r,
|
|
1083
|
+
allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region src/utils/collectColorFieldIssues.ts
|
|
1088
|
+
function An(e, t) {
|
|
1089
|
+
let n = [], r = (r, i) => {
|
|
1090
|
+
let a = kn(r, t), o = `custom block "${e.type}" field "${i}"`, s = (t) => `${e.type}:${i}:${t}`;
|
|
1091
|
+
if (a.invalidPresets.length > 0 && n.push({
|
|
1092
|
+
id: s("invalid-presets"),
|
|
1093
|
+
message: `${o}: presets skipped invalid entries: ${a.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).` + (a.presetsInherited ? " No valid entries are left, so the field inherits colors.presets." : "")
|
|
1094
|
+
}), a.emptyPresets && n.push({
|
|
1095
|
+
id: s("empty-presets"),
|
|
1096
|
+
message: `${o}: presets is empty — a field palette can only narrow the editor's, so an empty list is ignored and the field inherits colors.presets.`
|
|
1097
|
+
}), a.allowCustomIgnored && n.push({
|
|
1098
|
+
id: s("allow-custom-ignored"),
|
|
1099
|
+
message: `${o}: allowCustom: true is ignored because colors.allowCustom is false — a field can narrow the editor-wide palette, never unlock it.`
|
|
1100
|
+
}), !a.allowCustom && a.presets.length > 0) {
|
|
1101
|
+
let e = r.default ?? "", t = new Set(a.presets.map((e) => K(e)));
|
|
1102
|
+
e !== "" && !t.has(K(e)) && n.push({
|
|
1103
|
+
id: s("off-palette-default"),
|
|
1104
|
+
message: `${o} locks custom colours, but its default ${e} falls outside the field's presets: ${a.presets.join(", ")}. New blocks start on a colour the picker can't reselect — set the default from the same palette.`
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
for (let t of e.fields) if (t.type === "color") r(t, t.key);
|
|
1109
|
+
else if (t.type === "repeatable") for (let e of t.fields) e.type === "color" && r(e, `${t.key}[].${e.key}`);
|
|
1110
|
+
return n;
|
|
1111
|
+
}
|
|
1112
|
+
//#endregion
|
|
1113
|
+
//#region src/utils/keyboardShortcuts.ts
|
|
1114
|
+
function jn(e) {
|
|
1115
|
+
for (let t of e.composedPath()) {
|
|
1116
|
+
if (!(t instanceof HTMLElement)) continue;
|
|
1117
|
+
if (t.isContentEditable) return !0;
|
|
1118
|
+
let e = t.tagName;
|
|
1119
|
+
if (e === "INPUT" || e === "TEXTAREA" || e === "SELECT") return !0;
|
|
1120
|
+
}
|
|
1121
|
+
return !1;
|
|
1122
|
+
}
|
|
1123
|
+
function Mn(e, t) {
|
|
1124
|
+
let n = e.metaKey || e.ctrlKey;
|
|
1125
|
+
if (n && e.key.toLowerCase() === "s") {
|
|
1126
|
+
e.preventDefault(), t.onSave?.();
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
if (n && e.key.toLowerCase() === "z") {
|
|
1130
|
+
if (jn(e)) return;
|
|
1131
|
+
e.preventDefault(), e.shiftKey ? t.history.redo() : (t.onBeforeUndo?.(), t.history.undo());
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if (t.isPicking?.() && !jn(e)) {
|
|
1135
|
+
if (e.key === "Escape") {
|
|
1136
|
+
e.preventDefault(), t.onCancelPick?.();
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
if (e.key === "Enter") {
|
|
1140
|
+
e.preventDefault(), t.onConfirmPick?.();
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
1144
|
+
e.preventDefault();
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (e.key === "Escape") {
|
|
1149
|
+
t.selectBlock(null);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
(e.key === "Delete" || e.key === "Backspace") && t.getSelectedBlockId() && !jn(e) && (e.preventDefault(), t.history.record(), t.removeBlock(t.getSelectedBlockId()));
|
|
1153
|
+
}
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region src/utils/mergeTagLabelSegments.ts
|
|
1156
|
+
function Nn(e, t, n) {
|
|
1157
|
+
if (!e) return [];
|
|
1158
|
+
let r = RegExp(`(${n.value.source}|${n.logic.source})`, "g"), i = [], a = 0, o;
|
|
1159
|
+
for (; (o = r.exec(e)) !== null;) {
|
|
1160
|
+
o.index > a && i.push({
|
|
1161
|
+
type: "text",
|
|
1162
|
+
value: e.slice(a, o.index)
|
|
1163
|
+
});
|
|
1164
|
+
let r = o[0];
|
|
1165
|
+
Se(r, n) ? i.push({
|
|
1166
|
+
type: "tag",
|
|
1167
|
+
value: fe(r, t)
|
|
1168
|
+
}) : me(r, n) ? i.push({
|
|
1169
|
+
type: "tag",
|
|
1170
|
+
value: ye(r, n)
|
|
1171
|
+
}) : i.push({
|
|
1172
|
+
type: "text",
|
|
1173
|
+
value: r
|
|
1174
|
+
}), a = o.index + r.length;
|
|
1175
|
+
}
|
|
1176
|
+
return a < e.length && i.push({
|
|
1177
|
+
type: "text",
|
|
1178
|
+
value: e.slice(a)
|
|
1179
|
+
}), i;
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/components/MergeTagPreviewText.vue
|
|
1183
|
+
var Pn = R({
|
|
1184
|
+
name: "MergeTagPreviewText",
|
|
1185
|
+
props: { text: {
|
|
1186
|
+
type: String,
|
|
1187
|
+
required: !0
|
|
1188
|
+
} },
|
|
1189
|
+
setup(e) {
|
|
1190
|
+
let t = p(Qe, []), r = p(Ye, Ce.liquid), i = C(() => Nn(e.text, t, r));
|
|
1191
|
+
return () => i.value.map((e, t) => e.type === "tag" ? n("span", {
|
|
1192
|
+
key: t,
|
|
1193
|
+
class: "tpl-merge-tag-label"
|
|
1194
|
+
}, e.value) : e.value);
|
|
1195
|
+
}
|
|
1196
|
+
}), Fn = { class: "tpl:text-center" }, In = ["href"], Ln = /* @__PURE__ */ R({
|
|
1197
|
+
__name: "ButtonBlock",
|
|
1198
|
+
props: {
|
|
1199
|
+
block: {},
|
|
1200
|
+
viewport: {}
|
|
1201
|
+
},
|
|
1202
|
+
setup(e) {
|
|
1203
|
+
let t = e, n = C(() => {
|
|
1204
|
+
let e = {
|
|
1205
|
+
display: "inline-block",
|
|
1206
|
+
padding: `${t.block.buttonPadding.top}px ${t.block.buttonPadding.right}px ${t.block.buttonPadding.bottom}px ${t.block.buttonPadding.left}px`,
|
|
1207
|
+
backgroundColor: t.block.backgroundColor,
|
|
1208
|
+
color: t.block.textColor,
|
|
1209
|
+
fontSize: `${t.block.fontSize}px`,
|
|
1210
|
+
fontWeight: "bold",
|
|
1211
|
+
textDecoration: "none",
|
|
1212
|
+
borderRadius: `${t.block.borderRadius}px`,
|
|
1213
|
+
textAlign: "center"
|
|
1214
|
+
};
|
|
1215
|
+
return t.block.fontFamily && (e.fontFamily = t.block.fontFamily), t.block.width === "full" ? (e.display = "block", e.width = "100%", e.boxSizing = "border-box") : typeof t.block.width == "number" && (e.width = `${t.block.width}px`, e.boxSizing = "border-box"), e;
|
|
1216
|
+
});
|
|
1217
|
+
return (t, r) => (l(), w("div", Fn, [M("a", {
|
|
1218
|
+
href: e.block.url || "#",
|
|
1219
|
+
style: F(n.value),
|
|
1220
|
+
class: "tpl:cursor-default",
|
|
1221
|
+
onClick: r[0] ||= O(() => {}, ["prevent"])
|
|
1222
|
+
}, [z(Pn, { text: e.block.text }, null, 8, ["text"])], 12, In)]));
|
|
1223
|
+
}
|
|
1224
|
+
}), Rn = ["innerHTML"], zn = [
|
|
1225
|
+
"src",
|
|
1226
|
+
"width",
|
|
1227
|
+
"height"
|
|
1228
|
+
], Bn = /* @__PURE__ */ R({
|
|
1229
|
+
__name: "CustomBlockIcon",
|
|
1230
|
+
props: {
|
|
1231
|
+
icon: {},
|
|
1232
|
+
size: {}
|
|
1233
|
+
},
|
|
1234
|
+
setup(e) {
|
|
1235
|
+
let t = e, n = C(() => t.size ?? 20), r = C(() => t.icon && (t.icon.trimStart().startsWith("<svg") || t.icon.trimStart().startsWith("<SVG"))), i = C(() => t.icon && !r.value && (t.icon.startsWith("http") || t.icon.startsWith("/")));
|
|
1236
|
+
return (t, a) => r.value ? (l(), w("span", {
|
|
1237
|
+
key: 0,
|
|
1238
|
+
class: "tpl:inline-flex tpl:items-center tpl:justify-center",
|
|
1239
|
+
style: F({
|
|
1240
|
+
width: `${n.value}px`,
|
|
1241
|
+
height: `${n.value}px`
|
|
1242
|
+
}),
|
|
1243
|
+
innerHTML: e.icon
|
|
1244
|
+
}, null, 12, Rn)) : i.value ? (l(), w("img", {
|
|
1245
|
+
key: 1,
|
|
1246
|
+
src: e.icon,
|
|
1247
|
+
width: n.value,
|
|
1248
|
+
height: n.value,
|
|
1249
|
+
class: "tpl:inline-block",
|
|
1250
|
+
alt: ""
|
|
1251
|
+
}, null, 8, zn)) : (l(), k(E(Tt), {
|
|
1252
|
+
key: 2,
|
|
1253
|
+
size: n.value,
|
|
1254
|
+
"stroke-width": 1.5
|
|
1255
|
+
}, null, 8, ["size"]));
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region src/composables/useEditorRoot.ts
|
|
1260
|
+
function Vn() {
|
|
1261
|
+
return p(it, document) ?? document;
|
|
1262
|
+
}
|
|
1263
|
+
//#endregion
|
|
1264
|
+
//#region src/composables/useFocusTrap.ts
|
|
1265
|
+
var Hn = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
1266
|
+
function Un(e, t) {
|
|
1267
|
+
let n = Vn(), r = null, i = null, a = null;
|
|
1268
|
+
function s() {
|
|
1269
|
+
return e.value ? Array.from(e.value.querySelectorAll(Hn)).filter((e) => e.offsetParent !== null) : [];
|
|
1270
|
+
}
|
|
1271
|
+
function c(e) {
|
|
1272
|
+
if (e.key !== "Tab") return;
|
|
1273
|
+
let t = s();
|
|
1274
|
+
if (t.length === 0) return;
|
|
1275
|
+
let r = t[0], i = t[t.length - 1];
|
|
1276
|
+
e.shiftKey ? n.activeElement === r && (e.preventDefault(), i.focus()) : n.activeElement === i && (e.preventDefault(), r.focus());
|
|
1277
|
+
}
|
|
1278
|
+
function l() {
|
|
1279
|
+
let t = i !== null || a !== null;
|
|
1280
|
+
t && u({ restoreFocus: !1 }), t || (r = n.activeElement), a = requestAnimationFrame(() => {
|
|
1281
|
+
a = null;
|
|
1282
|
+
let t = s();
|
|
1283
|
+
t.length > 0 && (e.value?.querySelector("[autofocus], input:not([disabled])") ?? t[0]).focus();
|
|
1284
|
+
}), i = U(e, "keydown", c);
|
|
1285
|
+
}
|
|
1286
|
+
function u(e = {}) {
|
|
1287
|
+
let t = e.restoreFocus !== !1;
|
|
1288
|
+
a !== null && (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(a), a = null), i?.(), i = null, t && r && r.focus && (r.focus(), r = null);
|
|
1289
|
+
}
|
|
1290
|
+
let d = B([t, e], ([e, t]) => {
|
|
1291
|
+
e && t ? l() : u();
|
|
1292
|
+
}, { flush: "post" });
|
|
1293
|
+
o(() => {
|
|
1294
|
+
d(), u();
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/composables/useEmoji.ts
|
|
1299
|
+
function Wn() {
|
|
1300
|
+
let [t, n] = Fe(!1), r = e([]), i = !1;
|
|
1301
|
+
o(() => {
|
|
1302
|
+
i = !0;
|
|
1303
|
+
}), B(t, async (e) => {
|
|
1304
|
+
if (e && r.value.length === 0) {
|
|
1305
|
+
let { emojiCategories: e } = await import("./emojiData-6m0DBh7O.js");
|
|
1306
|
+
if (i) return;
|
|
1307
|
+
r.value = e;
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
function a() {
|
|
1311
|
+
n();
|
|
1312
|
+
}
|
|
1313
|
+
function s() {
|
|
1314
|
+
t.value = !1;
|
|
1315
|
+
}
|
|
1316
|
+
return {
|
|
1317
|
+
categories: r,
|
|
1318
|
+
isOpen: t,
|
|
1319
|
+
toggle: a,
|
|
1320
|
+
close: s
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region src/composables/useDragDrop.ts
|
|
1325
|
+
function Gn(e) {
|
|
1326
|
+
let { onBlockMove: t, onBlockAdd: n } = e, r = v(!1), i = v(null), a = v(null);
|
|
1327
|
+
function o(e) {
|
|
1328
|
+
r.value = !0, i.value = e;
|
|
1329
|
+
}
|
|
1330
|
+
function s() {
|
|
1331
|
+
r.value = !1, i.value = null, a.value = null;
|
|
1332
|
+
}
|
|
1333
|
+
function c(e) {
|
|
1334
|
+
a.value = e;
|
|
1335
|
+
}
|
|
1336
|
+
function l(e, r, a, o) {
|
|
1337
|
+
i.value && (e.findIndex((e) => e.id === i.value.id) === -1 ? n(i.value, a, o) : t(i.value.id, r, a, o), s());
|
|
1338
|
+
}
|
|
1339
|
+
function u(e, n, i) {
|
|
1340
|
+
return {
|
|
1341
|
+
group: e,
|
|
1342
|
+
animation: 150,
|
|
1343
|
+
ghostClass: "tpl-ghost",
|
|
1344
|
+
dragClass: "tpl-drag",
|
|
1345
|
+
handle: ".tpl-drag-handle",
|
|
1346
|
+
onStart: (e) => {
|
|
1347
|
+
e.item.dataset.blockId && (r.value = !0);
|
|
1348
|
+
},
|
|
1349
|
+
onEnd: () => {
|
|
1350
|
+
s();
|
|
1351
|
+
},
|
|
1352
|
+
onAdd: (e) => {
|
|
1353
|
+
let r = e.item.dataset.blockId;
|
|
1354
|
+
r && t(r, e.newIndex, n, i);
|
|
1355
|
+
},
|
|
1356
|
+
onUpdate: (e) => {
|
|
1357
|
+
let r = e.item.dataset.blockId;
|
|
1358
|
+
r && t(r, e.newIndex, n, i);
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
return {
|
|
1363
|
+
isDragging: r,
|
|
1364
|
+
draggedBlock: i,
|
|
1365
|
+
dropTargetId: a,
|
|
1366
|
+
startDrag: o,
|
|
1367
|
+
endDrag: s,
|
|
1368
|
+
setDropTarget: c,
|
|
1369
|
+
handleDrop: l,
|
|
1370
|
+
getSortableOptions: u
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
//#endregion
|
|
1374
|
+
//#region src/composables/useFonts.ts
|
|
1375
|
+
var Kn = [
|
|
1376
|
+
{
|
|
1377
|
+
value: "Arial",
|
|
1378
|
+
label: "Arial"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
value: "Helvetica",
|
|
1382
|
+
label: "Helvetica"
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
value: "Georgia",
|
|
1386
|
+
label: "Georgia"
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
value: "Times New Roman",
|
|
1390
|
+
label: "Times New Roman"
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
value: "Verdana",
|
|
1394
|
+
label: "Verdana"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
value: "Trebuchet MS",
|
|
1398
|
+
label: "Trebuchet MS"
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
value: "Courier New",
|
|
1402
|
+
label: "Courier New"
|
|
1403
|
+
}
|
|
1404
|
+
], qn = {
|
|
1405
|
+
arial: "Arial, sans-serif",
|
|
1406
|
+
helvetica: "Helvetica, sans-serif",
|
|
1407
|
+
georgia: "Georgia, serif",
|
|
1408
|
+
"times new roman": "'Times New Roman', serif",
|
|
1409
|
+
verdana: "Verdana, sans-serif",
|
|
1410
|
+
"trebuchet ms": "'Trebuchet MS', sans-serif",
|
|
1411
|
+
"courier new": "'Courier New', monospace"
|
|
1412
|
+
}, $ = "Arial, sans-serif";
|
|
1413
|
+
function Jn(e) {
|
|
1414
|
+
if (e === void 0 || e === !0) return [...Kn];
|
|
1415
|
+
if (e === !1) return [];
|
|
1416
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1417
|
+
for (let i of e) {
|
|
1418
|
+
let e = i.toLowerCase(), a = Kn.find((t) => t.value.toLowerCase() === e);
|
|
1419
|
+
if (!a) {
|
|
1420
|
+
r.has(e) || (r.add(e), Q.warn(`config.fonts.builtIns: "${i}" is not a built-in font — skipping it. Built-in fonts are: ${Kn.map((e) => e.value).join(", ")}.`));
|
|
1421
|
+
continue;
|
|
1422
|
+
}
|
|
1423
|
+
n.has(a.value) || (n.add(a.value), t.push(a));
|
|
1424
|
+
}
|
|
1425
|
+
return t;
|
|
1426
|
+
}
|
|
1427
|
+
function Yn(e) {
|
|
1428
|
+
let t = v(e?.customFonts ?? []), n = v(!0), r = v(!1), a = Jn(e?.builtIns), s = C(() => e?.defaultFallback ?? $);
|
|
1429
|
+
function c(e) {
|
|
1430
|
+
n.value = e;
|
|
1431
|
+
}
|
|
1432
|
+
let l = C(() => {
|
|
1433
|
+
let e = [...a];
|
|
1434
|
+
if (!n.value) return e.sort((e, t) => e.label.localeCompare(t.label));
|
|
1435
|
+
let r = t.value.map((e) => ({
|
|
1436
|
+
value: e.name,
|
|
1437
|
+
label: e.name,
|
|
1438
|
+
isCustom: !0
|
|
1439
|
+
})), i = [...e, ...r];
|
|
1440
|
+
return i.sort((e, t) => e.label.localeCompare(t.label)), i;
|
|
1441
|
+
});
|
|
1442
|
+
function u(e) {
|
|
1443
|
+
return l.value.some((t) => t.label.toLowerCase() === e.toLowerCase() || t.value.toLowerCase().startsWith(e.toLowerCase()));
|
|
1444
|
+
}
|
|
1445
|
+
let d = e?.defaultFont ?? $.split(",")[0].trim();
|
|
1446
|
+
u(d) || Q.warn(`config.fonts: new templates seed "${d}", which the font picker doesn't offer — authors can't reselect it. Either add it to fonts.builtIns, or set fonts.defaultFont to an offered font.`);
|
|
1447
|
+
function f(e) {
|
|
1448
|
+
return Kn.some((t) => t.label.toLowerCase() === e.toLowerCase() || t.value.toLowerCase().startsWith(e.toLowerCase()));
|
|
1449
|
+
}
|
|
1450
|
+
function p() {
|
|
1451
|
+
if (e?.defaultFont) {
|
|
1452
|
+
if (!n.value && !f(e.defaultFont)) return $;
|
|
1453
|
+
if (u(e.defaultFont)) {
|
|
1454
|
+
let t = l.value.find((t) => t.label.toLowerCase() === e.defaultFont.toLowerCase() || t.value.toLowerCase().startsWith(e.defaultFont.toLowerCase()));
|
|
1455
|
+
if (t) return t.value;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return $;
|
|
1459
|
+
}
|
|
1460
|
+
let m = C(() => p());
|
|
1461
|
+
function h(e) {
|
|
1462
|
+
if (!e) return s.value;
|
|
1463
|
+
let n = t.value.find((t) => t.name.toLowerCase() === e.toLowerCase());
|
|
1464
|
+
return n ? `'${n.name}', ${n.fallback ?? s.value}` : qn[e.toLowerCase()] || (e.includes(",") ? e : `${e}, ${s.value}`);
|
|
1465
|
+
}
|
|
1466
|
+
let g = [], _ = !1;
|
|
1467
|
+
async function y() {
|
|
1468
|
+
if (t.value.length === 0) {
|
|
1469
|
+
_ || (r.value = !0);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
let e = t.value.map(async (e) => {
|
|
1473
|
+
try {
|
|
1474
|
+
if (document.querySelector(`link[data-custom-font="${CSS.escape(e.name)}"]`)) return;
|
|
1475
|
+
let t = document.createElement("link");
|
|
1476
|
+
t.rel = "stylesheet", t.href = e.url, t.setAttribute("data-custom-font", e.name), g.push(t), await new Promise((n, r) => {
|
|
1477
|
+
t.onload = () => n(), t.onerror = () => r(/* @__PURE__ */ Error(`Failed to load font: ${e.name}`)), document.head.appendChild(t);
|
|
1478
|
+
});
|
|
1479
|
+
} catch (t) {
|
|
1480
|
+
Q.warn(`Failed to load custom font "${e.name}":`, t);
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
await Promise.allSettled(e), !_ && (r.value = !0);
|
|
1484
|
+
}
|
|
1485
|
+
function b() {
|
|
1486
|
+
for (let e of g) e.remove();
|
|
1487
|
+
g.length = 0;
|
|
1488
|
+
}
|
|
1489
|
+
return i() && o(() => {
|
|
1490
|
+
_ = !0, b();
|
|
1491
|
+
}), {
|
|
1492
|
+
fonts: l,
|
|
1493
|
+
defaultFont: m,
|
|
1494
|
+
defaultFallback: s,
|
|
1495
|
+
customFonts: t,
|
|
1496
|
+
customFontsEnabled: n,
|
|
1497
|
+
isLoaded: r,
|
|
1498
|
+
setCustomFontsEnabled: c,
|
|
1499
|
+
loadCustomFonts: y,
|
|
1500
|
+
cleanupFontLinks: b,
|
|
1501
|
+
getFontWithFallback: h,
|
|
1502
|
+
getDefaultFont: p
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1505
|
+
//#endregion
|
|
1506
|
+
//#region src/composables/useLogicTag.ts
|
|
1507
|
+
function Xn() {
|
|
1508
|
+
let e = p(He, []), t = p(Ze, []), n = p(Ye, Ce.liquid), r = p(st, null), i = p(ht, null), a = v(!1), o = !!r || e.length > 0 || t.length > 0, s = e.length > 0 || t.length > 0;
|
|
1509
|
+
async function c() {
|
|
1510
|
+
if (r) {
|
|
1511
|
+
a.value = !0;
|
|
1512
|
+
try {
|
|
1513
|
+
return await r();
|
|
1514
|
+
} finally {
|
|
1515
|
+
a.value = !1;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
if (i && s) {
|
|
1519
|
+
a.value = !0;
|
|
1520
|
+
try {
|
|
1521
|
+
return await i.open(e, t);
|
|
1522
|
+
} finally {
|
|
1523
|
+
a.value = !1;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return null;
|
|
1527
|
+
}
|
|
1528
|
+
return {
|
|
1529
|
+
logicTags: e,
|
|
1530
|
+
logicPairs: t,
|
|
1531
|
+
syntax: n,
|
|
1532
|
+
canInsertLogicTag: o,
|
|
1533
|
+
isRequesting: a,
|
|
1534
|
+
requestLogicTag: c
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
//#endregion
|
|
1538
|
+
//#region src/utils/mergeTagNodeSpec.ts
|
|
1539
|
+
function Zn(e, t, n) {
|
|
1540
|
+
return me(e, n) ? {
|
|
1541
|
+
type: "logicMergeTagNode",
|
|
1542
|
+
attrs: {
|
|
1543
|
+
value: e,
|
|
1544
|
+
keyword: ye(e, n)
|
|
1545
|
+
}
|
|
1546
|
+
} : {
|
|
1547
|
+
type: "mergeTagNode",
|
|
1548
|
+
attrs: {
|
|
1549
|
+
label: t,
|
|
1550
|
+
value: e
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
//#endregion
|
|
1555
|
+
//#region src/utils/insertLogicTag.ts
|
|
1556
|
+
function Qn(e) {
|
|
1557
|
+
return "before" in e && "after" in e;
|
|
1558
|
+
}
|
|
1559
|
+
function $n(e, t, n) {
|
|
1560
|
+
if (!Qn(t)) {
|
|
1561
|
+
e.chain().focus().insertContent(Zn(t.value, t.label, n)).run();
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
let r = Zn(t.before, t.label, n), i = Zn(t.after, t.label, n), { from: a, to: o } = e.state.selection;
|
|
1565
|
+
if (a !== o) {
|
|
1566
|
+
e.chain().focus().insertContentAt(o, i).insertContentAt(a, r).run();
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
e.chain().focus().insertContentAt(a, [r, i]).setTextSelection(a + 1).run();
|
|
1570
|
+
}
|
|
1571
|
+
//#endregion
|
|
1572
|
+
//#region src/utils/linkColorExtension.ts
|
|
1573
|
+
function er(e) {
|
|
1574
|
+
if (!e) return null;
|
|
1575
|
+
let t = e.trim();
|
|
1576
|
+
return /^#[0-9a-f]{3,8}$/i.test(t) || /^(rgb|rgba|hsl|hsla)\(\s*[0-9.,%/\s]+\)$/i.test(t) || /^[a-z]+$/i.test(t) ? t : null;
|
|
1577
|
+
}
|
|
1578
|
+
function tr(e) {
|
|
1579
|
+
return e.extend({ addAttributes() {
|
|
1580
|
+
return {
|
|
1581
|
+
...this.parent?.(),
|
|
1582
|
+
color: {
|
|
1583
|
+
default: null,
|
|
1584
|
+
parseHTML: (e) => er(bt(e.style.color)),
|
|
1585
|
+
renderHTML: (e) => {
|
|
1586
|
+
let t = er(e.color);
|
|
1587
|
+
return t ? { style: `color: ${t}` } : {};
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
} });
|
|
1592
|
+
}
|
|
1593
|
+
//#endregion
|
|
1594
|
+
//#region src/composables/useRichTextLinkDialog.ts
|
|
1595
|
+
function nr(e) {
|
|
1596
|
+
let t = v(!1), n = v(""), r = v(""), i = v(null);
|
|
1597
|
+
Un(i, t);
|
|
1598
|
+
function a() {
|
|
1599
|
+
let i = e.value?.getAttributes("link") ?? {};
|
|
1600
|
+
n.value = i.href || "", r.value = i.color || "", t.value = !0;
|
|
1601
|
+
}
|
|
1602
|
+
function o() {
|
|
1603
|
+
if (n.value) {
|
|
1604
|
+
let t = c(n.value);
|
|
1605
|
+
if (t !== null) {
|
|
1606
|
+
let n = er(r.value), i = e.value?.chain().focus().extendMarkRange("link").setLink({ href: t }).updateAttributes("link", { color: n });
|
|
1607
|
+
n && typeof e.value?.commands.unsetColor == "function" && i?.unsetColor(), i?.run();
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
u();
|
|
1611
|
+
}
|
|
1612
|
+
let s = /* @__PURE__ */ new Set([
|
|
1613
|
+
"http",
|
|
1614
|
+
"https",
|
|
1615
|
+
"mailto",
|
|
1616
|
+
"tel",
|
|
1617
|
+
"ftp",
|
|
1618
|
+
"ftps",
|
|
1619
|
+
"sms",
|
|
1620
|
+
"xmpp",
|
|
1621
|
+
"cid"
|
|
1622
|
+
]);
|
|
1623
|
+
function c(e) {
|
|
1624
|
+
let t = e.trim();
|
|
1625
|
+
if (!t) return null;
|
|
1626
|
+
if (t.startsWith("#")) return t;
|
|
1627
|
+
let n = /^([a-z][a-z0-9+.-]*):/i.exec(t);
|
|
1628
|
+
return n ? s.has(n[1].toLowerCase()) ? t : null : `https://${t}`;
|
|
1629
|
+
}
|
|
1630
|
+
function l() {
|
|
1631
|
+
e.value?.chain().focus().extendMarkRange("link").unsetLink().run(), u();
|
|
1632
|
+
}
|
|
1633
|
+
function u() {
|
|
1634
|
+
t.value = !1, n.value = "", r.value = "";
|
|
1635
|
+
}
|
|
1636
|
+
function d(e) {
|
|
1637
|
+
e.key === "Enter" ? (e.preventDefault(), o()) : e.key === "Escape" && u();
|
|
1638
|
+
}
|
|
1639
|
+
return {
|
|
1640
|
+
showLinkDialog: t,
|
|
1641
|
+
linkUrl: n,
|
|
1642
|
+
linkColor: r,
|
|
1643
|
+
linkDialogRef: i,
|
|
1644
|
+
openLinkDialog: a,
|
|
1645
|
+
insertLink: o,
|
|
1646
|
+
removeLink: l,
|
|
1647
|
+
closeLinkDialog: u,
|
|
1648
|
+
handleLinkKeydown: d
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
//#endregion
|
|
1652
|
+
//#region src/composables/useRichTextEditor.ts
|
|
1653
|
+
function rr(t) {
|
|
1654
|
+
let n = p(W, null), { mergeTags: r, canRequestMergeTag: i, isRequesting: a, requestMergeTag: o, syntax: c, autocomplete: l } = q(), { canInsertLogicTag: u, isRequesting: d, requestLogicTag: f } = Xn(), m = p(Xe, null), h = (s(m) ? m.value : m)?.mergeTag?.suggestionEmpty ?? "No matching merge tags", g = Ee(c), _ = e(null), { showLinkDialog: y, linkUrl: b, linkColor: x, linkDialogRef: S, openLinkDialog: C, insertLink: w, removeLink: T, closeLinkDialog: E, handleLinkKeydown: O } = nr(_), { start: k, stop: A } = Ne(() => _.value?.commands.focus("end"), 0, { immediate: !1 }), j = e(null), M = v(!0), N = v(null), P = !1;
|
|
1655
|
+
async function F() {
|
|
1656
|
+
N.value = null, M.value = !0;
|
|
1657
|
+
try {
|
|
1658
|
+
let { TiptapEditor: e, EC: i, extensions: a } = await t.loadExtensions({
|
|
1659
|
+
mergeTags: r,
|
|
1660
|
+
syntax: c,
|
|
1661
|
+
triggerChar: g,
|
|
1662
|
+
autocompleteEnabled: l,
|
|
1663
|
+
suggestionEmptyText: h
|
|
1664
|
+
});
|
|
1665
|
+
if (P) return;
|
|
1666
|
+
j.value = i;
|
|
1667
|
+
let o = /* @__PURE__ */ new Map();
|
|
1668
|
+
a.forEach((e, t) => o.set(e.name, t));
|
|
1669
|
+
let s = new e({
|
|
1670
|
+
extensions: a.filter((e, t) => o.get(e.name) === t),
|
|
1671
|
+
content: t.blockContent(),
|
|
1672
|
+
editable: !0,
|
|
1673
|
+
onUpdate: ({ editor: e }) => {
|
|
1674
|
+
P || n && n.updateBlock(t.blockId(), { content: e.getHTML() });
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
if (P) {
|
|
1678
|
+
s.destroy();
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
_.value = s, M.value = !1, k();
|
|
1682
|
+
} catch (e) {
|
|
1683
|
+
if (P) return;
|
|
1684
|
+
Q.error(`[${t.editorName ?? "RichTextEditor"}] Failed to initialize TipTap editor:`, e), N.value = e instanceof Error ? e.message : "Failed to load editor", M.value = !1;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function ee() {
|
|
1688
|
+
_.value?.destroy(), _.value = null, F();
|
|
1689
|
+
}
|
|
1690
|
+
F();
|
|
1691
|
+
let I = B(() => t.blockContent(), (e) => {
|
|
1692
|
+
_.value && _.value.getHTML() !== e && _.value.commands.setContent(e, { emitUpdate: !1 });
|
|
1693
|
+
});
|
|
1694
|
+
function L(e) {
|
|
1695
|
+
if (a.value || d.value) return;
|
|
1696
|
+
let n = e.composedPath(), r = n.find((e) => e instanceof HTMLElement);
|
|
1697
|
+
if (!r) return;
|
|
1698
|
+
t.onClickOutsideSideEffect?.(r);
|
|
1699
|
+
let i = n.some((e) => e instanceof HTMLElement && e.classList.contains("tpl-color-popover"));
|
|
1700
|
+
r.closest(".tpl-text-editor-wrapper") || r.closest(".tpl-text-toolbar") || r.closest(".tpl-link-dialog") || i || t.onDone();
|
|
1701
|
+
}
|
|
1702
|
+
U(document, "mousedown", L), D(() => {
|
|
1703
|
+
P = !0, I(), A(), _.value?.destroy();
|
|
1704
|
+
});
|
|
1705
|
+
async function R() {
|
|
1706
|
+
let e = await o();
|
|
1707
|
+
P || (e && _.value ? _.value.chain().focus().insertMergeTag({
|
|
1708
|
+
label: e.label,
|
|
1709
|
+
value: e.value
|
|
1710
|
+
}).run() : _.value?.commands.focus());
|
|
1711
|
+
}
|
|
1712
|
+
async function z() {
|
|
1713
|
+
let e = await f();
|
|
1714
|
+
P || (e && _.value ? $n(_.value, e, c) : _.value?.commands.focus());
|
|
1715
|
+
}
|
|
1716
|
+
return {
|
|
1717
|
+
editor: _,
|
|
1718
|
+
EditorContent: j,
|
|
1719
|
+
isLoading: M,
|
|
1720
|
+
initError: N,
|
|
1721
|
+
retry: ee,
|
|
1722
|
+
showLinkDialog: y,
|
|
1723
|
+
linkUrl: b,
|
|
1724
|
+
linkColor: x,
|
|
1725
|
+
linkDialogRef: S,
|
|
1726
|
+
mergeTags: r,
|
|
1727
|
+
canRequestMergeTag: i,
|
|
1728
|
+
isRequestingMergeTag: a,
|
|
1729
|
+
syntax: c,
|
|
1730
|
+
canInsertLogicTag: u,
|
|
1731
|
+
isRequestingLogicTag: d,
|
|
1732
|
+
openLinkDialog: C,
|
|
1733
|
+
insertLink: w,
|
|
1734
|
+
removeLink: T,
|
|
1735
|
+
closeLinkDialog: E,
|
|
1736
|
+
handleLinkKeydown: O,
|
|
1737
|
+
handleAddMergeTag: R,
|
|
1738
|
+
handleAddLogicTag: z
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
//#endregion
|
|
1742
|
+
//#region src/composables/useSmallScreenNotice.ts
|
|
1743
|
+
var ir = "(max-width: 767px)";
|
|
1744
|
+
function ar(e) {
|
|
1745
|
+
let t = Le(ir);
|
|
1746
|
+
return {
|
|
1747
|
+
isSmallScreen: t,
|
|
1748
|
+
showNotice: C(() => (A(e) ?? !0) && t.value)
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
//#endregion
|
|
1752
|
+
//#region src/components/blocks/CustomBlock.vue?vue&type=script&setup=true&lang.ts
|
|
1753
|
+
var or = { class: "tpl:w-full" }, sr = {
|
|
1754
|
+
key: 0,
|
|
1755
|
+
class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-warning)] tpl:bg-[var(--tpl-warning-light)]"
|
|
1756
|
+
}, cr = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, lr = {
|
|
1757
|
+
key: 1,
|
|
1758
|
+
class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-danger)] tpl:bg-[var(--tpl-danger-light)]"
|
|
1759
|
+
}, ur = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, dr = {
|
|
1760
|
+
key: 2,
|
|
1761
|
+
class: "tpl:relative"
|
|
1762
|
+
}, fr = ["innerHTML"], pr = {
|
|
1763
|
+
key: 0,
|
|
1764
|
+
class: "tpl:absolute tpl:inset-0 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:rounded tpl:backdrop-blur-[2px]",
|
|
1765
|
+
style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)" }
|
|
1766
|
+
}, mr = /* @__PURE__ */ R({
|
|
1767
|
+
__name: "CustomBlock",
|
|
1768
|
+
props: {
|
|
1769
|
+
block: {},
|
|
1770
|
+
viewport: {}
|
|
1771
|
+
},
|
|
1772
|
+
emits: ["fetchData"],
|
|
1773
|
+
setup(e, { emit: n }) {
|
|
1774
|
+
let r = e, i = n, { t: a } = G(), o = p(dt, null), s = v(""), c = v(!1), u = C(() => o?.getDefinition(r.block.customType)), d = C(() => !!u.value), { isFetching: f, fetch: m, needsFetch: h, hasDataSource: g } = en({
|
|
1775
|
+
definition: u,
|
|
1776
|
+
block: C(() => r.block),
|
|
1777
|
+
onUpdate: (e, t) => {
|
|
1778
|
+
i("fetchData", {
|
|
1779
|
+
fieldValues: e,
|
|
1780
|
+
dataSourceFetched: t
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
async function _() {
|
|
1785
|
+
if (o) {
|
|
1786
|
+
c.value = !1;
|
|
1787
|
+
try {
|
|
1788
|
+
let e = await o.renderCustomBlock(r.block);
|
|
1789
|
+
e.includes("Template render error:") && (c.value = !0), s.value = e;
|
|
1790
|
+
} catch {
|
|
1791
|
+
c.value = !0, s.value = "";
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
let y = Pe(_, 150);
|
|
1796
|
+
return t(() => {
|
|
1797
|
+
_();
|
|
1798
|
+
}), B(() => r.block.fieldValues, () => {
|
|
1799
|
+
y();
|
|
1800
|
+
}, { deep: !0 }), (e, t) => (l(), w("div", or, [d.value ? c.value ? (l(), w("div", lr, [z(E(zt), {
|
|
1801
|
+
size: 24,
|
|
1802
|
+
class: "tpl:text-[var(--tpl-danger)]"
|
|
1803
|
+
}), M("span", ur, S(E(a).customBlocks.renderError), 1)])) : (l(), w("div", dr, [M("div", { innerHTML: s.value }, null, 8, fr), E(g) && E(h) ? (l(), w("div", pr, [E(f) ? (l(), k(Vt, {
|
|
1804
|
+
key: 1,
|
|
1805
|
+
class: "tpl:w-48"
|
|
1806
|
+
})) : (l(), w("button", {
|
|
1807
|
+
key: 0,
|
|
1808
|
+
type: "button",
|
|
1809
|
+
class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:shadow-sm tpl:transition-all tpl:duration-150 hover:tpl:border-[var(--tpl-primary)] hover:tpl:shadow-md tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary-hover)]",
|
|
1810
|
+
onClick: t[0] ||= O((...e) => E(m) && E(m)(...e), ["stop"])
|
|
1811
|
+
}, [u.value?.icon ? (l(), k(Bn, {
|
|
1812
|
+
key: 0,
|
|
1813
|
+
icon: u.value.icon,
|
|
1814
|
+
size: 16
|
|
1815
|
+
}, null, 8, ["icon"])) : T("", !0), L(" " + S(u.value?.dataSource?.label || E(a).customBlocks.dataSource.fetchButton), 1)]))])) : T("", !0)])) : (l(), w("div", sr, [z(E(Dt), {
|
|
1816
|
+
size: 24,
|
|
1817
|
+
class: "tpl:text-[var(--tpl-warning)]"
|
|
1818
|
+
}), M("span", cr, S(E(a).customBlocks.definitionNotFound), 1)]))]));
|
|
1819
|
+
}
|
|
1820
|
+
}), hr = { class: "tpl:w-full" }, gr = /* @__PURE__ */ R({
|
|
1821
|
+
__name: "DividerBlock",
|
|
1822
|
+
props: {
|
|
1823
|
+
block: {},
|
|
1824
|
+
viewport: {}
|
|
1825
|
+
},
|
|
1826
|
+
setup(e) {
|
|
1827
|
+
let t = e, n = C(() => ({
|
|
1828
|
+
borderTop: `${t.block.thickness}px ${t.block.lineStyle} ${t.block.color}`,
|
|
1829
|
+
width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
|
|
1830
|
+
margin: t.block.width === "full" ? "0" : "0 auto"
|
|
1831
|
+
}));
|
|
1832
|
+
return (e, t) => (l(), w("div", hr, [M("hr", {
|
|
1833
|
+
class: "tpl:m-0 tpl:border-none",
|
|
1834
|
+
style: F(n.value)
|
|
1835
|
+
}, null, 4)]));
|
|
1836
|
+
}
|
|
1837
|
+
}), _r = { class: "tpl:w-full" }, vr = ["srcdoc", "title"], yr = {
|
|
1838
|
+
key: 1,
|
|
1839
|
+
class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-hover)]"
|
|
1840
|
+
}, br = {
|
|
1841
|
+
key: 0,
|
|
1842
|
+
class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]"
|
|
1843
|
+
}, xr = {
|
|
1844
|
+
key: 1,
|
|
1845
|
+
class: "tpl:text-sm tpl:text-[var(--tpl-text-dim)]"
|
|
1846
|
+
}, Sr = /* @__PURE__ */ R({
|
|
1847
|
+
__name: "HtmlBlock",
|
|
1848
|
+
props: {
|
|
1849
|
+
block: {},
|
|
1850
|
+
viewport: {}
|
|
1851
|
+
},
|
|
1852
|
+
setup(e) {
|
|
1853
|
+
let t = e, { t: n } = G(), r = p(_t, !1), i = C(() => t.block.content.trim().length > 0), a = C(() => r && i.value), o = v(null), s = v(60), c = null;
|
|
1854
|
+
function u() {
|
|
1855
|
+
let e = o.value?.contentDocument;
|
|
1856
|
+
e && (s.value = Math.max(e.body?.scrollHeight ?? 0, e.documentElement?.scrollHeight ?? 0));
|
|
1857
|
+
}
|
|
1858
|
+
function d() {
|
|
1859
|
+
c?.disconnect(), c = null, u();
|
|
1860
|
+
let e = o.value?.contentDocument?.documentElement;
|
|
1861
|
+
e && typeof ResizeObserver < "u" && (c = new ResizeObserver(() => u()), c.observe(e));
|
|
1862
|
+
}
|
|
1863
|
+
return B(a, (e) => {
|
|
1864
|
+
e || (c?.disconnect(), c = null);
|
|
1865
|
+
}), D(() => {
|
|
1866
|
+
c?.disconnect(), c = null;
|
|
1867
|
+
}), (t, r) => (l(), w("div", _r, [a.value ? (l(), w("iframe", {
|
|
1868
|
+
key: 0,
|
|
1869
|
+
ref_key: "iframeRef",
|
|
1870
|
+
ref: o,
|
|
1871
|
+
srcdoc: e.block.content,
|
|
1872
|
+
sandbox: "allow-same-origin",
|
|
1873
|
+
title: E(n).html.preview,
|
|
1874
|
+
class: "tpl:block tpl:w-full tpl:border-0",
|
|
1875
|
+
style: F({ height: `${s.value}px` }),
|
|
1876
|
+
onLoad: d
|
|
1877
|
+
}, null, 44, vr)) : (l(), w("div", yr, [z(E(wt), {
|
|
1878
|
+
size: 24,
|
|
1879
|
+
class: "tpl:text-[var(--tpl-text-dim)]"
|
|
1880
|
+
}), i.value ? (l(), w("span", br, S(E(n).html.preview), 1)) : (l(), w("span", xr, S(E(n).html.empty), 1))]))]));
|
|
1881
|
+
}
|
|
1882
|
+
}), Cr = "image/";
|
|
1883
|
+
function wr(e) {
|
|
1884
|
+
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || A(r), { isOverDropZone: a } = ze(t, {
|
|
1885
|
+
preventDefaultForUnhandled: !0,
|
|
1886
|
+
onDrop: (e) => {
|
|
1887
|
+
if (!i()) return;
|
|
1888
|
+
let t = (e ?? []).filter((e) => e.type.startsWith(Cr));
|
|
1889
|
+
t.length > 0 && n([t[0]]);
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
return { isOver: C(() => i() && a.value) };
|
|
1893
|
+
}
|
|
1894
|
+
//#endregion
|
|
1895
|
+
//#region src/components/blocks/ImageBlock.vue?vue&type=script&setup=true&lang.ts
|
|
1896
|
+
var Tr = {
|
|
1897
|
+
key: 0,
|
|
1898
|
+
class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]",
|
|
1899
|
+
style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 85%, transparent)" }
|
|
1900
|
+
}, Er = ["href"], Dr = ["src", "alt"], Or = ["src", "alt"], kr = {
|
|
1901
|
+
class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
|
|
1902
|
+
style: { opacity: "0.7" }
|
|
1903
|
+
}, Ar = ["href"], jr = ["src", "alt"], Mr = ["src", "alt"], Nr = {
|
|
1904
|
+
key: 4,
|
|
1905
|
+
class: "tpl:flex tpl:min-h-[100px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
|
|
1906
|
+
}, Pr = ["aria-label"], Fr = { key: 1 }, Ir = /* @__PURE__ */ R({
|
|
1907
|
+
__name: "ImageBlock",
|
|
1908
|
+
props: {
|
|
1909
|
+
block: {},
|
|
1910
|
+
viewport: {}
|
|
1911
|
+
},
|
|
1912
|
+
emits: ["update"],
|
|
1913
|
+
setup(e, { emit: t }) {
|
|
1914
|
+
let n = e, r = t, { t: i } = G(), { syntax: a } = q(), o = p(Be, null), s = C(() => !!o), c = Ut();
|
|
1915
|
+
async function u() {
|
|
1916
|
+
let e = await o?.({ accept: ["images"] });
|
|
1917
|
+
if (c.alive && e) {
|
|
1918
|
+
let t = { src: e.url };
|
|
1919
|
+
e.alt && (t.alt = e.alt), r("update", t);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
let d = v(), f = v(!1), m = C(() => s.value && !f.value && !b.value);
|
|
1923
|
+
async function h(e) {
|
|
1924
|
+
if (o) {
|
|
1925
|
+
f.value = !0;
|
|
1926
|
+
try {
|
|
1927
|
+
let t = await o({
|
|
1928
|
+
accept: ["images"],
|
|
1929
|
+
files: e
|
|
1930
|
+
});
|
|
1931
|
+
if (!c.alive) return;
|
|
1932
|
+
if (t) {
|
|
1933
|
+
let e = { src: t.url };
|
|
1934
|
+
t.alt && (e.alt = t.alt), r("update", e);
|
|
1935
|
+
}
|
|
1936
|
+
} finally {
|
|
1937
|
+
c.alive && (f.value = !1);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
let { isOver: g } = wr({
|
|
1942
|
+
target: d,
|
|
1943
|
+
enabled: m,
|
|
1944
|
+
onFiles: h
|
|
1945
|
+
}), _ = C(() => ({ textAlign: n.block.align })), y = C(() => {
|
|
1946
|
+
let e = n.block.align;
|
|
1947
|
+
return {
|
|
1948
|
+
maxWidth: "100%",
|
|
1949
|
+
width: n.block.width === "full" ? "100%" : `${n.block.width}px`,
|
|
1950
|
+
display: "block",
|
|
1951
|
+
marginLeft: e === "center" || e === "right" ? "auto" : void 0,
|
|
1952
|
+
marginRight: e === "center" ? "auto" : void 0
|
|
1953
|
+
};
|
|
1954
|
+
}), b = C(() => H(n.block.src, a)), x = X(() => b.value ? void 0 : n.block.src), D = X(() => b.value ? n.block.placeholderUrl : void 0);
|
|
1955
|
+
return (t, n) => (l(), w("div", {
|
|
1956
|
+
ref_key: "dropZoneRef",
|
|
1957
|
+
ref: d,
|
|
1958
|
+
"data-testid": "image-drop-zone",
|
|
1959
|
+
class: "tpl:relative tpl:w-full",
|
|
1960
|
+
style: F(_.value)
|
|
1961
|
+
}, [m.value && (E(g) || f.value) ? (l(), w("div", Tr, [f.value ? (l(), w(I, { key: 0 }, [z(E(Lt), {
|
|
1962
|
+
class: "tpl-spinner",
|
|
1963
|
+
size: 20,
|
|
1964
|
+
"stroke-width": 2
|
|
1965
|
+
}), L(" " + S(E(i).image.uploading), 1)], 64)) : (l(), w(I, { key: 1 }, [z(E(Rt), {
|
|
1966
|
+
size: 20,
|
|
1967
|
+
"stroke-width": 1.5
|
|
1968
|
+
}), L(" " + S(E(i).image.dropToUpload), 1)], 64))])) : T("", !0), e.block.src && b.value && e.block.placeholderUrl ? (l(), w(I, { key: 1 }, [e.block.linkUrl ? (l(), w("a", {
|
|
1969
|
+
key: 0,
|
|
1970
|
+
href: e.block.linkUrl,
|
|
1971
|
+
target: "_blank",
|
|
1972
|
+
rel: "noopener noreferrer",
|
|
1973
|
+
onClick: n[0] ||= O(() => {}, ["prevent"])
|
|
1974
|
+
}, [M("img", {
|
|
1975
|
+
class: "tpl:border-0",
|
|
1976
|
+
loading: "lazy",
|
|
1977
|
+
src: E(D),
|
|
1978
|
+
alt: e.block.alt || E(i).image.altTextPlaceholder,
|
|
1979
|
+
style: F(y.value)
|
|
1980
|
+
}, null, 12, Dr)], 8, Er)) : (l(), w("img", {
|
|
1981
|
+
key: 1,
|
|
1982
|
+
class: "tpl:border-0",
|
|
1983
|
+
src: E(D),
|
|
1984
|
+
alt: e.block.alt,
|
|
1985
|
+
style: F(y.value)
|
|
1986
|
+
}, null, 12, Or))], 64)) : e.block.src && b.value ? (l(), w("div", {
|
|
1987
|
+
key: 2,
|
|
1988
|
+
class: "tpl:!flex tpl:min-h-[120px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
|
|
1989
|
+
style: F([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, y.value])
|
|
1990
|
+
}, [z(E(jt), {
|
|
1991
|
+
size: 32,
|
|
1992
|
+
"stroke-width": 1.5,
|
|
1993
|
+
class: "tpl:text-[var(--tpl-primary)]",
|
|
1994
|
+
style: { opacity: "0.5" }
|
|
1995
|
+
}), M("span", kr, [z(Pn, { text: e.block.src }, null, 8, ["text"])])], 4)) : e.block.src ? (l(), w(I, { key: 3 }, [e.block.linkUrl ? (l(), w("a", {
|
|
1996
|
+
key: 0,
|
|
1997
|
+
href: e.block.linkUrl,
|
|
1998
|
+
target: "_blank",
|
|
1999
|
+
rel: "noopener noreferrer",
|
|
2000
|
+
onClick: n[1] ||= O(() => {}, ["prevent"])
|
|
2001
|
+
}, [M("img", {
|
|
2002
|
+
class: "tpl:border-0",
|
|
2003
|
+
loading: "lazy",
|
|
2004
|
+
src: E(x),
|
|
2005
|
+
alt: e.block.alt || E(i).image.altTextPlaceholder,
|
|
2006
|
+
style: F(y.value)
|
|
2007
|
+
}, null, 12, jr)], 8, Ar)) : (l(), w("img", {
|
|
2008
|
+
key: 1,
|
|
2009
|
+
class: "tpl:border-0",
|
|
2010
|
+
src: E(x),
|
|
2011
|
+
alt: e.block.alt,
|
|
2012
|
+
style: F(y.value)
|
|
2013
|
+
}, null, 12, Mr))], 64)) : (l(), w("div", Nr, [s.value ? (l(), w("button", {
|
|
2014
|
+
key: 0,
|
|
2015
|
+
"aria-label": E(i).image.browseMedia,
|
|
2016
|
+
class: "tpl:flex tpl:items-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:px-3 tpl:py-2 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150 tpl:cursor-pointer tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-primary)] tpl:bg-[var(--tpl-bg)]",
|
|
2017
|
+
onClick: O(u, ["stop"])
|
|
2018
|
+
}, [z(E(jt), {
|
|
2019
|
+
size: 14,
|
|
2020
|
+
"stroke-width": 1.5
|
|
2021
|
+
}), L(" " + S(E(i).image.browseMedia), 1)], 8, Pr)) : (l(), w("span", Fr, S(E(i).image.clickToAdd), 1))]))], 4));
|
|
2022
|
+
}
|
|
2023
|
+
}), Lr = { class: "tpl:w-full" }, Rr = ["href"], zr = {
|
|
2024
|
+
key: 1,
|
|
2025
|
+
class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
|
|
2026
|
+
}, Br = /* @__PURE__ */ R({
|
|
2027
|
+
__name: "MenuBlock",
|
|
2028
|
+
props: {
|
|
2029
|
+
block: {},
|
|
2030
|
+
viewport: {}
|
|
2031
|
+
},
|
|
2032
|
+
setup(e) {
|
|
2033
|
+
let t = e, { t: n } = G(), r = C(() => ({
|
|
2034
|
+
display: "flex",
|
|
2035
|
+
flexWrap: "wrap",
|
|
2036
|
+
gap: `0 ${t.block.spacing}px`,
|
|
2037
|
+
justifyContent: t.block.textAlign === "left" ? "flex-start" : t.block.textAlign === "right" ? "flex-end" : "center",
|
|
2038
|
+
fontSize: `${t.block.fontSize}px`,
|
|
2039
|
+
fontFamily: t.block.fontFamily || "inherit",
|
|
2040
|
+
alignItems: "center"
|
|
2041
|
+
})), i = C(() => t.block.items.length > 0);
|
|
2042
|
+
function a(e) {
|
|
2043
|
+
return e || t.block.linkColor || t.block.color;
|
|
2044
|
+
}
|
|
2045
|
+
return (t, o) => (l(), w("div", Lr, [i.value ? (l(), w("div", {
|
|
2046
|
+
key: 0,
|
|
2047
|
+
style: F(r.value)
|
|
2048
|
+
}, [(l(!0), w(I, null, f(e.block.items, (t, n) => (l(), w(I, { key: t.id }, [M("a", {
|
|
2049
|
+
href: t.url || "#",
|
|
2050
|
+
class: "tpl:cursor-default tpl:no-underline",
|
|
2051
|
+
style: F({
|
|
2052
|
+
color: a(t.color),
|
|
2053
|
+
fontWeight: t.bold ? "bold" : "normal",
|
|
2054
|
+
textDecoration: t.underline ? "underline" : "none"
|
|
2055
|
+
}),
|
|
2056
|
+
onClick: o[0] ||= O(() => {}, ["prevent"])
|
|
2057
|
+
}, [z(Pn, { text: t.text || "..." }, null, 8, ["text"])], 12, Rr), n < e.block.items.length - 1 ? (l(), w("span", {
|
|
2058
|
+
key: 0,
|
|
2059
|
+
style: F({
|
|
2060
|
+
color: e.block.separatorColor,
|
|
2061
|
+
padding: `0 ${e.block.spacing}px`
|
|
2062
|
+
})
|
|
2063
|
+
}, S(e.block.separator), 5)) : T("", !0)], 64))), 128))], 4)) : (l(), w("div", zr, [z(E(Ot), { size: 16 }), M("span", null, S(E(n).menu.addLinks), 1)]))]));
|
|
2064
|
+
}
|
|
2065
|
+
}), Vr = /* @__PURE__ */ new Set([
|
|
2066
|
+
"http",
|
|
2067
|
+
"https",
|
|
2068
|
+
"mailto",
|
|
2069
|
+
"tel",
|
|
2070
|
+
"ftp",
|
|
2071
|
+
"ftps",
|
|
2072
|
+
"sms",
|
|
2073
|
+
"xmpp",
|
|
2074
|
+
"cid"
|
|
2075
|
+
]), Hr = /* @__PURE__ */ new Set([
|
|
2076
|
+
"SCRIPT",
|
|
2077
|
+
"STYLE",
|
|
2078
|
+
"IFRAME",
|
|
2079
|
+
"OBJECT",
|
|
2080
|
+
"EMBED",
|
|
2081
|
+
"LINK",
|
|
2082
|
+
"META",
|
|
2083
|
+
"BASE",
|
|
2084
|
+
"FORM"
|
|
2085
|
+
]), Ur = /* @__PURE__ */ new Set([
|
|
2086
|
+
"href",
|
|
2087
|
+
"xlink:href",
|
|
2088
|
+
"formaction",
|
|
2089
|
+
"action",
|
|
2090
|
+
"ping",
|
|
2091
|
+
"background",
|
|
2092
|
+
"poster"
|
|
2093
|
+
]);
|
|
2094
|
+
function Wr(e, t) {
|
|
2095
|
+
let n = e.replace(/[\t\n\r]/g, "").replace(/^[\u0000-\u0020]+/, "").trimEnd();
|
|
2096
|
+
if (!n || n.startsWith("#")) return !0;
|
|
2097
|
+
let r = /^([a-z][a-z0-9+.-]*):/i.exec(n);
|
|
2098
|
+
if (!r) return !0;
|
|
2099
|
+
let i = r[1].toLowerCase();
|
|
2100
|
+
return Vr.has(i) ? !0 : t && i === "data" ? /^data:image\/(png|jpe?g|gif|webp|svg\+xml);/i.test(n) : !1;
|
|
2101
|
+
}
|
|
2102
|
+
function Gr(e) {
|
|
2103
|
+
if (Hr.has(e.tagName)) {
|
|
2104
|
+
e.remove();
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2107
|
+
let t = [];
|
|
2108
|
+
for (let n = 0; n < e.attributes.length; n++) t.push(e.attributes[n].name);
|
|
2109
|
+
for (let n of t) {
|
|
2110
|
+
let t = n.toLowerCase();
|
|
2111
|
+
if (t.startsWith("on")) {
|
|
2112
|
+
e.removeAttribute(n);
|
|
2113
|
+
continue;
|
|
2114
|
+
}
|
|
2115
|
+
if (Ur.has(t)) {
|
|
2116
|
+
Wr(e.getAttribute(n) ?? "", !1) || e.removeAttribute(n);
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
if (t === "src") {
|
|
2120
|
+
Wr(e.getAttribute(n) ?? "", !0) || e.removeAttribute(n);
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
t === "srcdoc" && e.removeAttribute(n);
|
|
2124
|
+
}
|
|
2125
|
+
let n = Array.from(e.children);
|
|
2126
|
+
for (let e of n) Gr(e);
|
|
2127
|
+
}
|
|
2128
|
+
function Kr(e) {
|
|
2129
|
+
if (typeof DOMParser > "u") return e;
|
|
2130
|
+
let t = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html").body, n = Array.from(t.children);
|
|
2131
|
+
for (let e of n) Gr(e);
|
|
2132
|
+
return t.innerHTML;
|
|
2133
|
+
}
|
|
2134
|
+
//#endregion
|
|
2135
|
+
//#region src/composables/useEditableTextBlock.ts
|
|
2136
|
+
function qr(e) {
|
|
2137
|
+
let t = p(Qe, []), { syntax: n } = q(), r = C(() => Kr(Oe(he(e(), t), n))), i = v(!1), a = v(null), { top: o, left: s } = Re(a), { toLocal: c } = St(), l = C(() => c({
|
|
2138
|
+
top: o.value - 8,
|
|
2139
|
+
left: s.value
|
|
2140
|
+
}));
|
|
2141
|
+
function u() {
|
|
2142
|
+
i.value = !0;
|
|
2143
|
+
}
|
|
2144
|
+
function d() {
|
|
2145
|
+
i.value = !1;
|
|
2146
|
+
}
|
|
2147
|
+
return {
|
|
2148
|
+
isEditing: i,
|
|
2149
|
+
blockRef: a,
|
|
2150
|
+
toolbarPosition: l,
|
|
2151
|
+
resolvedContent: r,
|
|
2152
|
+
handleDoubleClick: u,
|
|
2153
|
+
handleEditorDone: d
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
//#endregion
|
|
2157
|
+
//#region src/components/blocks/ParagraphBlock.vue?vue&type=script&setup=true&lang.ts
|
|
2158
|
+
var Jr = ["innerHTML"], Yr = /* @__PURE__ */ R({
|
|
2159
|
+
__name: "ParagraphBlock",
|
|
2160
|
+
props: {
|
|
2161
|
+
block: {},
|
|
2162
|
+
viewport: {}
|
|
2163
|
+
},
|
|
2164
|
+
setup(e) {
|
|
2165
|
+
let t = e, n = b(() => import("./ParagraphEditor-CtaRa1vr.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: s, handleEditorDone: c } = qr(() => t.block.content);
|
|
2166
|
+
return (t, u) => (l(), w("div", {
|
|
2167
|
+
ref_key: "blockRef",
|
|
2168
|
+
ref: i,
|
|
2169
|
+
class: "tpl:min-h-[1em] tpl:w-full",
|
|
2170
|
+
onDblclick: u[0] ||= (...e) => E(s) && E(s)(...e)
|
|
2171
|
+
}, [E(r) ? (l(), k(E(n), {
|
|
2172
|
+
key: 0,
|
|
2173
|
+
block: e.block,
|
|
2174
|
+
"toolbar-position": E(a),
|
|
2175
|
+
onDone: E(c)
|
|
2176
|
+
}, null, 8, [
|
|
2177
|
+
"block",
|
|
2178
|
+
"toolbar-position",
|
|
2179
|
+
"onDone"
|
|
2180
|
+
])) : (l(), w("div", {
|
|
2181
|
+
key: 1,
|
|
2182
|
+
class: "tpl-text-content tpl:outline-none [&_a]:tpl:underline [&_li]:tpl:my-1 [&_ol]:tpl:my-2 [&_ol]:tpl:pl-6 [&_p]:tpl:m-0 [&_p]:tpl:mb-2 [&_p:last-child]:tpl:mb-0 [&_s]:tpl:line-through [&_sub]:tpl:align-sub [&_sub]:tpl:text-[0.75em] [&_sup]:tpl:align-super [&_sup]:tpl:text-[0.75em] [&_ul]:tpl:my-2 [&_ul]:tpl:pl-6",
|
|
2183
|
+
innerHTML: E(o)
|
|
2184
|
+
}, null, 8, Jr))], 544));
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
//#endregion
|
|
2188
|
+
//#region src/utils/blockComponentResolver.ts
|
|
2189
|
+
function Xr(e) {
|
|
2190
|
+
let t = { fontFamily: e.fontFamily };
|
|
2191
|
+
return e.textColor && (t.color = e.textColor), e.linkColor && (t["--tpl-doc-link-color"] = e.linkColor), e.linkUnderline && (t["--tpl-doc-link-underline"] = "underline"), t;
|
|
2192
|
+
}
|
|
2193
|
+
function Zr(e, t, n) {
|
|
2194
|
+
if (t) {
|
|
2195
|
+
let n = t.getComponent(e);
|
|
2196
|
+
if (n) return n;
|
|
2197
|
+
}
|
|
2198
|
+
return n[e.type] ?? null;
|
|
2199
|
+
}
|
|
2200
|
+
function Qr(e) {
|
|
2201
|
+
let { padding: t, backgroundColor: n } = e.styles, r = {
|
|
2202
|
+
padding: `${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,
|
|
2203
|
+
backgroundColor: n || "transparent"
|
|
2204
|
+
};
|
|
2205
|
+
return e.type === "section" && e.borderRadius && e.borderRadius > 0 && (r.borderRadius = `${e.borderRadius}px`), r;
|
|
2206
|
+
}
|
|
2207
|
+
function $r(e) {
|
|
2208
|
+
if (e.type !== "section" || !e.wrapper) return null;
|
|
2209
|
+
let t = e.wrapper, n = {};
|
|
2210
|
+
return t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.padding && (n.padding = `${t.padding.top}px ${t.padding.right}px ${t.padding.bottom}px ${t.padding.left}px`), t.borderRadius && t.borderRadius > 0 && (n.borderRadius = `${t.borderRadius}px`), n;
|
|
2211
|
+
}
|
|
2212
|
+
//#endregion
|
|
2213
|
+
//#region src/components/blocks/BlockWrapper.vue?vue&type=script&setup=true&lang.ts
|
|
2214
|
+
var ei = [
|
|
2215
|
+
"data-block-id",
|
|
2216
|
+
"data-block-type",
|
|
2217
|
+
"data-tpl-picked"
|
|
2218
|
+
], ti = ["aria-label"], ni = [
|
|
2219
|
+
"aria-label",
|
|
2220
|
+
"aria-pressed",
|
|
2221
|
+
"title"
|
|
2222
|
+
], ri = ["aria-label", "title"], ii = ["aria-label", "title"], ai = ["aria-label", "title"], oi = {
|
|
2223
|
+
key: 1,
|
|
2224
|
+
class: "tpl-block-hidden-overlay tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-[5] tpl:flex tpl:items-center tpl:justify-center tpl:rounded-sm"
|
|
2225
|
+
}, si = { class: "tpl:flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-2 tpl:py-1 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-chrome-text-muted)] tpl:shadow-[var(--tpl-shadow-sm)]" }, ci = {
|
|
2226
|
+
key: 2,
|
|
2227
|
+
class: "tpl:absolute tpl:-left-1 tpl:top-1/2 tpl:z-[5] tpl:-translate-x-full tpl:-translate-y-1/2"
|
|
2228
|
+
}, li = ["aria-label", "title"], ui = {
|
|
2229
|
+
key: 3,
|
|
2230
|
+
class: "tpl:absolute tpl:-right-1 tpl:-top-1 tpl:z-[5] tpl:translate-x-full"
|
|
2231
|
+
}, di = ["aria-label"], fi = /*#__PURE__*/ Ht(/* @__PURE__ */ R({
|
|
2232
|
+
__name: "BlockWrapper",
|
|
2233
|
+
props: {
|
|
2234
|
+
block: {},
|
|
2235
|
+
isSelected: { type: Boolean },
|
|
2236
|
+
viewport: {},
|
|
2237
|
+
previewMode: { type: Boolean },
|
|
2238
|
+
nested: { type: Boolean },
|
|
2239
|
+
picked: { type: Boolean }
|
|
2240
|
+
},
|
|
2241
|
+
emits: ["select"],
|
|
2242
|
+
setup(e, { emit: t }) {
|
|
2243
|
+
let n = b(() => import("./BlockIssueBadge-Da4yR-mh.js")), i = e, a = t, { t: o, format: s } = G(), c = p(gt, null), u = v(null), f = C(() => c?.liftedBlockId.value === i.block.id), m = C(() => f.value ? s(o.blockActions.dragLifted, { block: i.block.type }) : o.blockActions.drag);
|
|
2244
|
+
async function h() {
|
|
2245
|
+
await d(), u.value?.focus();
|
|
2246
|
+
}
|
|
2247
|
+
function g(e) {
|
|
2248
|
+
if (c) {
|
|
2249
|
+
if (e.key === " " || e.key === "Enter") {
|
|
2250
|
+
e.preventDefault(), e.stopPropagation(), f.value ? c.drop(i.block.id) : c.lift(i.block.id);
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
if (f.value) {
|
|
2254
|
+
if (e.key === "Escape") {
|
|
2255
|
+
e.preventDefault(), e.stopPropagation(), c.cancel(), h();
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
if (e.key === "ArrowUp") {
|
|
2259
|
+
e.preventDefault(), e.stopPropagation(), c.moveUp(i.block.id), h();
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
e.key === "ArrowDown" && (e.preventDefault(), e.stopPropagation(), c.moveDown(i.block.id), h());
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
let _ = C(() => !i.viewport || !i.block.visibility ? !1 : i.block.visibility[i.viewport] === !1), y = C(() => i.previewMode === !0 && _.value), x = C(() => i.viewport ? {
|
|
2267
|
+
desktop: o.viewport.desktop,
|
|
2268
|
+
mobile: o.viewport.mobile
|
|
2269
|
+
}[i.viewport] ?? i.viewport : ""), D = C(() => !!i.block.displayCondition), k = p(at, null), A = p(nt, null), N = p(pt, {}), P = C(() => N.savedBlocks?.isPicking.value === !0), ee = C(() => !i.nested && N.savedBlocks?.isAvailable.value === !0 && N.savedBlocks?.canCreate.value === !0), I = C(() => i.isSelected && !P.value), R = C(() => N.comments?.getBlockCount(i.block.id) ?? 0), B = C(() => {
|
|
2270
|
+
let e = Qr(i.block), t = {
|
|
2271
|
+
padding: e.padding,
|
|
2272
|
+
backgroundColor: e.backgroundColor
|
|
2273
|
+
};
|
|
2274
|
+
return e.borderRadius && (t.borderRadius = e.borderRadius), t;
|
|
2275
|
+
}), V = C(() => $r(i.block));
|
|
2276
|
+
function te(e) {
|
|
2277
|
+
i.previewMode || (e.target?.closest("a") && e.preventDefault(), e.stopPropagation(), a("select"));
|
|
2278
|
+
}
|
|
2279
|
+
function ne() {
|
|
2280
|
+
k?.deleteBlock(i.block.id);
|
|
2281
|
+
}
|
|
2282
|
+
function re() {
|
|
2283
|
+
k?.duplicateBlock(i.block);
|
|
2284
|
+
}
|
|
2285
|
+
function ie() {
|
|
2286
|
+
N.savedBlocks?.startPicking(i.block.id);
|
|
2287
|
+
}
|
|
2288
|
+
function ae() {
|
|
2289
|
+
A?.toggleBlock(i.block.id);
|
|
2290
|
+
}
|
|
2291
|
+
return (t, i) => y.value ? T("", !0) : (l(), w("div", {
|
|
2292
|
+
key: 0,
|
|
2293
|
+
class: j(["tpl-block tpl:group tpl:relative tpl:cursor-pointer tpl:rounded-sm tpl:transition-shadow tpl:duration-150", {
|
|
2294
|
+
"tpl-block--selected": e.isSelected,
|
|
2295
|
+
"tpl-block--picked": e.picked,
|
|
2296
|
+
"tpl-block--idle": !e.isSelected && !e.picked,
|
|
2297
|
+
"tpl-block--lifted": f.value
|
|
2298
|
+
}]),
|
|
2299
|
+
"data-block-id": e.block.id,
|
|
2300
|
+
"data-block-type": e.block.type,
|
|
2301
|
+
"data-tpl-picked": e.picked || void 0,
|
|
2302
|
+
onClick: te
|
|
2303
|
+
}, [
|
|
2304
|
+
z(E(n), { "block-id": e.block.id }, null, 8, ["block-id"]),
|
|
2305
|
+
I.value ? (l(), w("div", {
|
|
2306
|
+
key: 0,
|
|
2307
|
+
role: "toolbar",
|
|
2308
|
+
"aria-label": E(o).blockActions.drag,
|
|
2309
|
+
class: "tpl-block-actions tpl-fade-in tpl:absolute tpl:-right-2 tpl:top-1/2 tpl:z-10 tpl:flex tpl:-translate-y-1/2 tpl:translate-x-full tpl:gap-0.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1 tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:shadow-[var(--tpl-shadow-md)] tpl:border tpl:border-[var(--tpl-border)]"
|
|
2310
|
+
}, [
|
|
2311
|
+
M("button", {
|
|
2312
|
+
ref_key: "dragButtonRef",
|
|
2313
|
+
ref: u,
|
|
2314
|
+
class: "tpl-block-btn tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-grab tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:duration-150 tpl:active:cursor-grabbing",
|
|
2315
|
+
"aria-label": m.value,
|
|
2316
|
+
"aria-pressed": f.value,
|
|
2317
|
+
"aria-keyshortcuts": "Space Enter ArrowUp ArrowDown Escape",
|
|
2318
|
+
title: E(o).blockActions.drag,
|
|
2319
|
+
onKeydown: g
|
|
2320
|
+
}, [z(E(Ft), {
|
|
2321
|
+
size: 14,
|
|
2322
|
+
"stroke-width": 1.5
|
|
2323
|
+
})], 40, ni),
|
|
2324
|
+
M("button", {
|
|
2325
|
+
class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:duration-150",
|
|
2326
|
+
"aria-label": E(o).blockActions.duplicate,
|
|
2327
|
+
title: E(o).blockActions.duplicate,
|
|
2328
|
+
onClick: O(re, ["stop"])
|
|
2329
|
+
}, [z(E(Bt), {
|
|
2330
|
+
size: 14,
|
|
2331
|
+
"stroke-width": 1.5
|
|
2332
|
+
})], 8, ri),
|
|
2333
|
+
ee.value ? (l(), w("button", {
|
|
2334
|
+
key: 0,
|
|
2335
|
+
class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:duration-150",
|
|
2336
|
+
"aria-label": E(o).blockActions.saveAsBlock,
|
|
2337
|
+
title: E(o).blockActions.saveAsBlock,
|
|
2338
|
+
onClick: O(ie, ["stop"])
|
|
2339
|
+
}, [z(E(Et), {
|
|
2340
|
+
size: 14,
|
|
2341
|
+
"stroke-width": 1.5
|
|
2342
|
+
})], 8, ii)) : T("", !0),
|
|
2343
|
+
M("button", {
|
|
2344
|
+
class: "tpl-block-action-btn tpl-block-delete-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:duration-150",
|
|
2345
|
+
"aria-label": E(o).blockActions.delete,
|
|
2346
|
+
title: E(o).blockActions.delete,
|
|
2347
|
+
onClick: O(ne, ["stop"])
|
|
2348
|
+
}, [z(E(At), {
|
|
2349
|
+
size: 14,
|
|
2350
|
+
"stroke-width": 1.5
|
|
2351
|
+
})], 8, ai)
|
|
2352
|
+
], 8, ti)) : T("", !0),
|
|
2353
|
+
_.value ? (l(), w("div", oi, [M("span", si, [z(E(Ct), {
|
|
2354
|
+
size: 12,
|
|
2355
|
+
"stroke-width": 1.5
|
|
2356
|
+
}), L(" " + S(E(s)(E(o).blockActions.hiddenOnViewport, { viewport: x.value })), 1)])])) : T("", !0),
|
|
2357
|
+
D.value && !_.value ? (l(), w("div", ci, [M("button", {
|
|
2358
|
+
class: "tpl-condition-toggle tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1 tpl:transition-colors tpl:duration-150 tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-primary)] tpl:border tpl:border-[var(--tpl-border)]",
|
|
2359
|
+
"aria-label": E(o).blockActions.conditionToggle,
|
|
2360
|
+
title: e.block.displayCondition?.label,
|
|
2361
|
+
onClick: O(ae, ["stop"])
|
|
2362
|
+
}, [z(E(kt), {
|
|
2363
|
+
size: 12,
|
|
2364
|
+
"stroke-width": 2
|
|
2365
|
+
})], 8, li)])) : T("", !0),
|
|
2366
|
+
R.value > 0 && !_.value ? (l(), w("div", ui, [M("button", {
|
|
2367
|
+
class: "tpl-comment-indicator tpl:flex tpl:min-h-6 tpl:min-w-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-0.5 tpl:rounded-full tpl:border-none tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-semibold tpl:transition-colors tpl:duration-150 tpl:bg-[var(--tpl-chrome-primary-light)] tpl:text-[var(--tpl-primary)]",
|
|
2368
|
+
"aria-label": E(s)(E(o).blockActions.comments, { count: String(R.value) }),
|
|
2369
|
+
onClick: i[0] ||= O((t) => E(N).comments?.openForBlock(e.block.id), ["stop"])
|
|
2370
|
+
}, [z(E(Mt), {
|
|
2371
|
+
size: 12,
|
|
2372
|
+
"stroke-width": 2.5
|
|
2373
|
+
}), L(" " + S(R.value), 1)], 8, di)])) : T("", !0),
|
|
2374
|
+
V.value ? (l(), w("div", {
|
|
2375
|
+
key: 4,
|
|
2376
|
+
class: "tpl-section-wrapper",
|
|
2377
|
+
style: F(V.value)
|
|
2378
|
+
}, [M("div", {
|
|
2379
|
+
class: "tpl-block-content",
|
|
2380
|
+
style: F(B.value)
|
|
2381
|
+
}, [r(t.$slots, "default", {}, void 0, !0)], 4)], 4)) : (l(), w("div", {
|
|
2382
|
+
key: 5,
|
|
2383
|
+
class: "tpl-block-content",
|
|
2384
|
+
style: F(B.value)
|
|
2385
|
+
}, [r(t.$slots, "default", {}, void 0, !0)], 4))
|
|
2386
|
+
], 10, ei));
|
|
2387
|
+
}
|
|
2388
|
+
}), [["__scopeId", "data-v-43c10a08"]]);
|
|
2389
|
+
//#endregion
|
|
2390
|
+
//#region src/utils/unwrapParagraph.ts
|
|
2391
|
+
function pi(e) {
|
|
2392
|
+
let t = e.match(/^\s*<p\b[^>]*>([\s\S]*)<\/p>\s*$/);
|
|
2393
|
+
return !t || /<\/p>\s*<p\b/i.test(t[1]) ? e : t[1];
|
|
2394
|
+
}
|
|
2395
|
+
//#endregion
|
|
2396
|
+
//#region src/components/blocks/TitleBlock.vue
|
|
2397
|
+
var mi = /* @__PURE__ */ R({
|
|
2398
|
+
__name: "TitleBlock",
|
|
2399
|
+
props: {
|
|
2400
|
+
block: {},
|
|
2401
|
+
viewport: {}
|
|
2402
|
+
},
|
|
2403
|
+
setup(e) {
|
|
2404
|
+
let t = e, n = b(() => import("./TitleEditor-BJ7LFykI.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: s, handleEditorDone: u } = qr(() => t.block.content), d = C(() => {
|
|
2405
|
+
let e = {
|
|
2406
|
+
fontSize: `${ae[t.block.level]}px`,
|
|
2407
|
+
textAlign: t.block.textAlign
|
|
2408
|
+
};
|
|
2409
|
+
return t.block.color && (e.color = t.block.color), t.block.fontFamily && (e.fontFamily = t.block.fontFamily), e;
|
|
2410
|
+
}), f = C(() => `h${t.block.level}`), p = C(() => pi(o.value));
|
|
2411
|
+
return (t, o) => (l(), w("div", {
|
|
2412
|
+
ref_key: "blockRef",
|
|
2413
|
+
ref: i,
|
|
2414
|
+
class: "tpl:min-h-[1em] tpl:w-full",
|
|
2415
|
+
style: F(d.value),
|
|
2416
|
+
onDblclick: o[0] ||= (...e) => E(s) && E(s)(...e)
|
|
2417
|
+
}, [E(r) ? (l(), k(E(n), {
|
|
2418
|
+
key: 0,
|
|
2419
|
+
block: e.block,
|
|
2420
|
+
"toolbar-position": E(a),
|
|
2421
|
+
onDone: E(u)
|
|
2422
|
+
}, null, 8, [
|
|
2423
|
+
"block",
|
|
2424
|
+
"toolbar-position",
|
|
2425
|
+
"onDone"
|
|
2426
|
+
])) : (l(), k(c(f.value), {
|
|
2427
|
+
key: 1,
|
|
2428
|
+
class: "tpl-text-content tpl:m-0 tpl:font-[inherit] tpl:text-[length:inherit] tpl:leading-tight tpl:outline-none [&_a]:tpl:underline [&_p]:tpl:m-0 [&_p]:tpl:mb-2 [&_p:last-child]:tpl:mb-0",
|
|
2429
|
+
style: { color: "inherit" },
|
|
2430
|
+
innerHTML: p.value
|
|
2431
|
+
}, null, 8, ["innerHTML"]))], 36));
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region src/utils/sectionColumnDrop.ts
|
|
2436
|
+
function hi(e) {
|
|
2437
|
+
return e.dataset.blockType !== "section" && e.dataset.paletteType !== "section";
|
|
2438
|
+
}
|
|
2439
|
+
//#endregion
|
|
2440
|
+
//#region src/components/blocks/SectionBlock.vue?vue&type=script&setup=true&lang.ts
|
|
2441
|
+
var gi = { class: "tpl:w-full" }, _i = {
|
|
2442
|
+
key: 0,
|
|
2443
|
+
"data-testid": "section-drop-hint",
|
|
2444
|
+
class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:text-xs tpl:text-[var(--tpl-chrome-text-dim)]"
|
|
2445
|
+
}, vi = /* @__PURE__ */ R({
|
|
2446
|
+
__name: "SectionBlock",
|
|
2447
|
+
props: {
|
|
2448
|
+
block: {},
|
|
2449
|
+
viewport: {}
|
|
2450
|
+
},
|
|
2451
|
+
setup(e) {
|
|
2452
|
+
let t = {
|
|
2453
|
+
title: mi,
|
|
2454
|
+
paragraph: Yr,
|
|
2455
|
+
image: Ir,
|
|
2456
|
+
button: Ln,
|
|
2457
|
+
divider: gr,
|
|
2458
|
+
custom: mr
|
|
2459
|
+
}, n = e, { t: r } = G(), i = Ve(W, "SectionBlock"), o = p(nt, null), s = p(dt, null), u = p(pt, {});
|
|
2460
|
+
function d(e) {
|
|
2461
|
+
let t = u.savedBlocks;
|
|
2462
|
+
if (t?.isPicking.value) {
|
|
2463
|
+
t.togglePick(n.block.id);
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
i.selectBlock(e);
|
|
2467
|
+
}
|
|
2468
|
+
let m = C(() => {
|
|
2469
|
+
switch (n.block.columns) {
|
|
2470
|
+
case "2": return ["50%", "50%"];
|
|
2471
|
+
case "3": return [
|
|
2472
|
+
"33.33%",
|
|
2473
|
+
"33.33%",
|
|
2474
|
+
"33.33%"
|
|
2475
|
+
];
|
|
2476
|
+
case "1-2": return ["33.33%", "66.67%"];
|
|
2477
|
+
case "2-1": return ["66.67%", "33.33%"];
|
|
2478
|
+
default: return ["100%"];
|
|
2479
|
+
}
|
|
2480
|
+
}), g = C(() => {
|
|
2481
|
+
let e = m.value.length, t = [...n.block.children];
|
|
2482
|
+
for (; t.length < e;) t.push([]);
|
|
2483
|
+
return t.slice(0, e);
|
|
2484
|
+
}), _ = C(() => n.viewport === "mobile" && n.block.stackOnMobile !== !1);
|
|
2485
|
+
function v(e) {
|
|
2486
|
+
return g.value[e] || [];
|
|
2487
|
+
}
|
|
2488
|
+
function y(e, t) {
|
|
2489
|
+
let r = t.map((e) => JSON.parse(JSON.stringify(e))), a = [...n.block.children];
|
|
2490
|
+
for (; a.length <= e;) a.push([]);
|
|
2491
|
+
a[e] = r, i.updateBlock(n.block.id, { children: a });
|
|
2492
|
+
}
|
|
2493
|
+
function b(e) {
|
|
2494
|
+
return Zr(e, s, t);
|
|
2495
|
+
}
|
|
2496
|
+
function x(e, t) {
|
|
2497
|
+
e.type === "custom" && i.updateBlock(e.id, {
|
|
2498
|
+
fieldValues: t.fieldValues,
|
|
2499
|
+
dataSourceFetched: t.dataSourceFetched
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
return (t, n) => (l(), w("div", gi, [M("div", { class: j(["tpl:flex tpl:gap-0", { "tpl:flex-col": _.value }]) }, [(l(!0), w(I, null, f(g.value, (t, n) => (l(), w("div", {
|
|
2503
|
+
key: n,
|
|
2504
|
+
class: j(["tpl:relative tpl:min-h-[60px] tpl:rounded", v(n).length === 0 ? "tpl:border tpl:border-dashed tpl:border-[var(--tpl-border)]" : ""]),
|
|
2505
|
+
style: F({ width: _.value ? "100%" : m.value[n] })
|
|
2506
|
+
}, [z(E(ee), {
|
|
2507
|
+
"model-value": v(n),
|
|
2508
|
+
group: {
|
|
2509
|
+
name: "blocks",
|
|
2510
|
+
pull: !0,
|
|
2511
|
+
put: (e, t, n) => E(hi)(n)
|
|
2512
|
+
},
|
|
2513
|
+
animation: 150,
|
|
2514
|
+
"ghost-class": "tpl-ghost",
|
|
2515
|
+
"drag-class": "tpl-dragging",
|
|
2516
|
+
handle: ".tpl-block-btn",
|
|
2517
|
+
"invert-swap": !0,
|
|
2518
|
+
"inverted-swap-threshold": .65,
|
|
2519
|
+
"empty-insert-threshold": 20,
|
|
2520
|
+
"force-fallback": !0,
|
|
2521
|
+
class: "tpl:min-h-[60px]",
|
|
2522
|
+
"onUpdate:modelValue": (e) => y(n, e)
|
|
2523
|
+
}, {
|
|
2524
|
+
default: h(() => [(l(!0), w(I, null, f(v(n), (t) => a((l(), w("div", { key: t.id }, [z(fi, {
|
|
2525
|
+
block: t,
|
|
2526
|
+
"is-selected": E(i).state.selectedBlockId === t.id,
|
|
2527
|
+
viewport: e.viewport,
|
|
2528
|
+
"preview-mode": E(i).state.previewMode,
|
|
2529
|
+
nested: "",
|
|
2530
|
+
onSelect: (e) => d(t.id)
|
|
2531
|
+
}, {
|
|
2532
|
+
default: h(() => [(l(), k(c(b(t)), {
|
|
2533
|
+
block: t,
|
|
2534
|
+
viewport: e.viewport,
|
|
2535
|
+
onFetchData: (e) => x(t, e),
|
|
2536
|
+
onUpdate: (e) => E(i).updateBlock(t.id, e)
|
|
2537
|
+
}, null, 40, [
|
|
2538
|
+
"block",
|
|
2539
|
+
"viewport",
|
|
2540
|
+
"onFetchData",
|
|
2541
|
+
"onUpdate"
|
|
2542
|
+
]))]),
|
|
2543
|
+
_: 2
|
|
2544
|
+
}, 1032, [
|
|
2545
|
+
"block",
|
|
2546
|
+
"is-selected",
|
|
2547
|
+
"viewport",
|
|
2548
|
+
"preview-mode",
|
|
2549
|
+
"onSelect"
|
|
2550
|
+
])])), [[P, !E(o)?.isHidden(t.id)]])), 128))]),
|
|
2551
|
+
_: 2
|
|
2552
|
+
}, 1032, [
|
|
2553
|
+
"model-value",
|
|
2554
|
+
"group",
|
|
2555
|
+
"onUpdate:modelValue"
|
|
2556
|
+
]), v(n).length === 0 ? (l(), w("div", _i, [M("span", null, S(E(r).section.dropHere), 1)])) : T("", !0)], 6))), 128))], 2)]));
|
|
2557
|
+
}
|
|
2558
|
+
}), yi = Te, bi = {
|
|
2559
|
+
small: 24,
|
|
2560
|
+
medium: 32,
|
|
2561
|
+
large: 48
|
|
2562
|
+
}, xi = [
|
|
2563
|
+
"facebook",
|
|
2564
|
+
"twitter",
|
|
2565
|
+
"instagram",
|
|
2566
|
+
"linkedin",
|
|
2567
|
+
"youtube",
|
|
2568
|
+
"tiktok",
|
|
2569
|
+
"pinterest",
|
|
2570
|
+
"email",
|
|
2571
|
+
"website",
|
|
2572
|
+
"whatsapp",
|
|
2573
|
+
"telegram",
|
|
2574
|
+
"discord",
|
|
2575
|
+
"snapchat",
|
|
2576
|
+
"reddit",
|
|
2577
|
+
"github",
|
|
2578
|
+
"dribbble",
|
|
2579
|
+
"behance"
|
|
2580
|
+
], Si = [
|
|
2581
|
+
"width",
|
|
2582
|
+
"height",
|
|
2583
|
+
"fill"
|
|
2584
|
+
], Ci = ["d"], wi = /* @__PURE__ */ R({
|
|
2585
|
+
__name: "SocialIconSvg",
|
|
2586
|
+
props: {
|
|
2587
|
+
platform: {},
|
|
2588
|
+
iconStyle: {},
|
|
2589
|
+
iconSize: {}
|
|
2590
|
+
},
|
|
2591
|
+
setup(e) {
|
|
2592
|
+
let t = e, n = C(() => yi[t.platform]), r = C(() => bi[t.iconSize]), i = C(() => {
|
|
2593
|
+
let e = {
|
|
2594
|
+
display: "inline-flex",
|
|
2595
|
+
alignItems: "center",
|
|
2596
|
+
justifyContent: "center",
|
|
2597
|
+
width: `${r.value}px`,
|
|
2598
|
+
height: `${r.value}px`
|
|
2599
|
+
};
|
|
2600
|
+
switch (t.iconStyle) {
|
|
2601
|
+
case "solid": return {
|
|
2602
|
+
...e,
|
|
2603
|
+
backgroundColor: n.value.color,
|
|
2604
|
+
borderRadius: "4px"
|
|
2605
|
+
};
|
|
2606
|
+
case "outlined": return {
|
|
2607
|
+
...e,
|
|
2608
|
+
backgroundColor: "transparent",
|
|
2609
|
+
border: `2px solid ${n.value.color}`,
|
|
2610
|
+
borderRadius: "4px"
|
|
2611
|
+
};
|
|
2612
|
+
case "rounded": return {
|
|
2613
|
+
...e,
|
|
2614
|
+
backgroundColor: n.value.color,
|
|
2615
|
+
borderRadius: "8px"
|
|
2616
|
+
};
|
|
2617
|
+
case "square": return {
|
|
2618
|
+
...e,
|
|
2619
|
+
backgroundColor: n.value.color,
|
|
2620
|
+
borderRadius: "0"
|
|
2621
|
+
};
|
|
2622
|
+
case "circle": return {
|
|
2623
|
+
...e,
|
|
2624
|
+
backgroundColor: n.value.color,
|
|
2625
|
+
borderRadius: "50%"
|
|
2626
|
+
};
|
|
2627
|
+
default: return e;
|
|
2628
|
+
}
|
|
2629
|
+
}), a = C(() => Math.floor(r.value * .6)), o = C(() => t.iconStyle === "outlined" ? n.value.color : "#ffffff");
|
|
2630
|
+
return (e, t) => (l(), w("span", { style: F(i.value) }, [(l(), w("svg", {
|
|
2631
|
+
width: a.value,
|
|
2632
|
+
height: a.value,
|
|
2633
|
+
viewBox: "0 0 24 24",
|
|
2634
|
+
fill: o.value,
|
|
2635
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2636
|
+
}, [M("path", { d: n.value.path }, null, 8, Ci)], 8, Si))], 4));
|
|
2637
|
+
}
|
|
2638
|
+
}), Ti = { class: "tpl:w-full" }, Ei = ["href"], Di = {
|
|
2639
|
+
key: 1,
|
|
2640
|
+
class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
|
|
2641
|
+
}, Oi = /* @__PURE__ */ R({
|
|
2642
|
+
__name: "SocialIconsBlock",
|
|
2643
|
+
props: {
|
|
2644
|
+
block: {},
|
|
2645
|
+
viewport: {}
|
|
2646
|
+
},
|
|
2647
|
+
setup(e) {
|
|
2648
|
+
let t = e, { t: n } = G(), r = C(() => ({
|
|
2649
|
+
display: "flex",
|
|
2650
|
+
flexWrap: "wrap",
|
|
2651
|
+
gap: `${t.block.spacing}px`,
|
|
2652
|
+
justifyContent: t.block.align === "left" ? "flex-start" : t.block.align === "right" ? "flex-end" : "center"
|
|
2653
|
+
})), i = C(() => t.block.icons.length > 0);
|
|
2654
|
+
return (t, a) => (l(), w("div", Ti, [i.value ? (l(), w("div", {
|
|
2655
|
+
key: 0,
|
|
2656
|
+
style: F(r.value)
|
|
2657
|
+
}, [(l(!0), w(I, null, f(e.block.icons, (t) => (l(), w("a", {
|
|
2658
|
+
key: t.id,
|
|
2659
|
+
href: t.url || "#",
|
|
2660
|
+
class: "tpl:cursor-default",
|
|
2661
|
+
onClick: a[0] ||= O(() => {}, ["prevent"])
|
|
2662
|
+
}, [z(wi, {
|
|
2663
|
+
platform: t.platform,
|
|
2664
|
+
"icon-style": e.block.iconStyle,
|
|
2665
|
+
"icon-size": e.block.iconSize
|
|
2666
|
+
}, null, 8, [
|
|
2667
|
+
"platform",
|
|
2668
|
+
"icon-style",
|
|
2669
|
+
"icon-size"
|
|
2670
|
+
])], 8, Ei))), 128))], 4)) : (l(), w("div", Di, [z(E(Pt), { size: 16 }), M("span", null, S(E(n).social.addIcons), 1)]))]));
|
|
2671
|
+
}
|
|
2672
|
+
}), ki = { class: "tpl:w-full" }, Ai = {
|
|
2673
|
+
key: 0,
|
|
2674
|
+
class: "tpl:absolute tpl:rounded tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium",
|
|
2675
|
+
style: {
|
|
2676
|
+
"background-color": "var(--tpl-bg-hover)",
|
|
2677
|
+
color: "var(--tpl-text-dim)"
|
|
2678
|
+
}
|
|
2679
|
+
}, ji = /* @__PURE__ */ R({
|
|
2680
|
+
__name: "SpacerBlock",
|
|
2681
|
+
props: {
|
|
2682
|
+
block: {},
|
|
2683
|
+
viewport: {}
|
|
2684
|
+
},
|
|
2685
|
+
setup(e) {
|
|
2686
|
+
let t = e, n = Ve(W, "SpacerBlock"), r = C(() => ({
|
|
2687
|
+
height: `${t.block.height}px`,
|
|
2688
|
+
minHeight: `${t.block.height}px`,
|
|
2689
|
+
...n.state.previewMode ? {} : { borderColor: "var(--tpl-border)" }
|
|
2690
|
+
}));
|
|
2691
|
+
return (t, i) => (l(), w("div", ki, [M("div", {
|
|
2692
|
+
style: F(r.value),
|
|
2693
|
+
class: j(["tpl:relative tpl:flex tpl:items-center tpl:justify-center", { "tpl:border-y tpl:border-dashed": !E(n).state.previewMode }])
|
|
2694
|
+
}, [E(n).state.previewMode ? T("", !0) : (l(), w("span", Ai, S(e.block.height) + "px ", 1))], 6)]));
|
|
2695
|
+
}
|
|
2696
|
+
}), Mi = { class: "tpl:w-full" }, Ni = { key: 0 }, Pi = [
|
|
2697
|
+
"aria-label",
|
|
2698
|
+
"data-placeholder",
|
|
2699
|
+
"onBlur"
|
|
2700
|
+
], Fi = [
|
|
2701
|
+
"aria-label",
|
|
2702
|
+
"data-placeholder",
|
|
2703
|
+
"onBlur"
|
|
2704
|
+
], Ii = {
|
|
2705
|
+
key: 1,
|
|
2706
|
+
class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
|
|
2707
|
+
}, Li = /*#__PURE__*/ Ht(/* @__PURE__ */ R({
|
|
2708
|
+
__name: "TableBlock",
|
|
2709
|
+
props: {
|
|
2710
|
+
block: {},
|
|
2711
|
+
viewport: {}
|
|
2712
|
+
},
|
|
2713
|
+
setup(e) {
|
|
2714
|
+
let t = {
|
|
2715
|
+
mounted(e, t) {
|
|
2716
|
+
e.textContent = t.value ?? "";
|
|
2717
|
+
},
|
|
2718
|
+
updated(e, t) {
|
|
2719
|
+
t.value !== t.oldValue && e.getRootNode().activeElement !== e && (e.textContent = t.value ?? "");
|
|
2720
|
+
}
|
|
2721
|
+
}, n = e, { t: r } = G(), i = Ve(W, "TableBlock"), o = C(() => n.block.rows.length > 0), s = C(() => {
|
|
2722
|
+
let e = {
|
|
2723
|
+
width: "100%",
|
|
2724
|
+
borderCollapse: "collapse",
|
|
2725
|
+
fontSize: `${n.block.fontSize}px`,
|
|
2726
|
+
textAlign: n.block.textAlign,
|
|
2727
|
+
fontFamily: n.block.fontFamily || "inherit"
|
|
2728
|
+
};
|
|
2729
|
+
return n.block.color && (e.color = n.block.color), e;
|
|
2730
|
+
}), c = C(() => ({
|
|
2731
|
+
border: `${n.block.borderWidth}px solid ${n.block.borderColor}`,
|
|
2732
|
+
padding: `${n.block.cellPadding}px`,
|
|
2733
|
+
textAlign: n.block.textAlign
|
|
2734
|
+
})), u = C(() => ({
|
|
2735
|
+
...c.value,
|
|
2736
|
+
fontWeight: "bold",
|
|
2737
|
+
backgroundColor: n.block.headerBackgroundColor || "transparent"
|
|
2738
|
+
})), d = C(() => n.block.hasHeaderRow && n.block.rows.length > 0 ? n.block.rows[0] : null), p = C(() => n.block.hasHeaderRow ? n.block.rows.slice(1) : n.block.rows);
|
|
2739
|
+
function m() {
|
|
2740
|
+
i.selectBlock(n.block.id);
|
|
2741
|
+
}
|
|
2742
|
+
function h(e, t, r) {
|
|
2743
|
+
let a = r.target.innerText.trim(), o = n.block.rows.map((n) => n.id === e ? {
|
|
2744
|
+
...n,
|
|
2745
|
+
cells: n.cells.map((e) => e.id === t ? {
|
|
2746
|
+
...e,
|
|
2747
|
+
content: a
|
|
2748
|
+
} : e)
|
|
2749
|
+
} : n);
|
|
2750
|
+
i.updateBlock(n.block.id, { rows: o });
|
|
2751
|
+
}
|
|
2752
|
+
return (e, n) => (l(), w("div", Mi, [o.value ? (l(), w("table", {
|
|
2753
|
+
key: 0,
|
|
2754
|
+
style: F(s.value),
|
|
2755
|
+
class: "tpl-table-editable"
|
|
2756
|
+
}, [d.value ? (l(), w("thead", Ni, [M("tr", null, [(l(!0), w(I, null, f(d.value.cells, (e) => a((l(), w("th", {
|
|
2757
|
+
key: e.id,
|
|
2758
|
+
style: F(u.value),
|
|
2759
|
+
"aria-label": E(r).table.cellPlaceholder,
|
|
2760
|
+
contenteditable: "true",
|
|
2761
|
+
"data-placeholder": E(r).table.cellPlaceholder,
|
|
2762
|
+
onBlur: (t) => h(d.value.id, e.id, t),
|
|
2763
|
+
onKeydown: n[0] ||= x(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
|
|
2764
|
+
onClick: O(m, ["stop"])
|
|
2765
|
+
}, null, 44, Pi)), [[t, e.content]])), 128))])])) : T("", !0), M("tbody", null, [(l(!0), w(I, null, f(p.value, (e) => (l(), w("tr", { key: e.id }, [(l(!0), w(I, null, f(e.cells, (i) => a((l(), w("td", {
|
|
2766
|
+
key: i.id,
|
|
2767
|
+
style: F(c.value),
|
|
2768
|
+
"aria-label": E(r).table.cellPlaceholder,
|
|
2769
|
+
contenteditable: "true",
|
|
2770
|
+
"data-placeholder": E(r).table.cellPlaceholder,
|
|
2771
|
+
onBlur: (t) => h(e.id, i.id, t),
|
|
2772
|
+
onKeydown: n[1] ||= x(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
|
|
2773
|
+
onClick: O(m, ["stop"])
|
|
2774
|
+
}, null, 44, Fi)), [[t, i.content]])), 128))]))), 128))])], 4)) : (l(), w("div", Ii, [z(E(Nt), { size: 16 }), M("span", null, S(E(r).table.empty), 1)]))]));
|
|
2775
|
+
}
|
|
2776
|
+
}), [["__scopeId", "data-v-963ac422"]]), Ri = /* @__PURE__ */ R({
|
|
2777
|
+
__name: "VideoPlayButton",
|
|
2778
|
+
props: { hoverEffect: {
|
|
2779
|
+
type: Boolean,
|
|
2780
|
+
default: !1
|
|
2781
|
+
} },
|
|
2782
|
+
setup(e) {
|
|
2783
|
+
return (t, n) => (l(), w("div", { class: j(["tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/30", e.hoverEffect && "tpl:transition-opacity tpl:group-hover:bg-black/40"]) }, [...n[0] ||= [M("div", { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-white/90 tpl:shadow-lg" }, [M("svg", {
|
|
2784
|
+
class: "tpl:ml-1 tpl:text-[var(--tpl-danger)]",
|
|
2785
|
+
width: "28",
|
|
2786
|
+
height: "28",
|
|
2787
|
+
viewBox: "0 0 24 24",
|
|
2788
|
+
fill: "currentColor"
|
|
2789
|
+
}, [M("polygon", { points: "5,3 19,12 5,21" })])], -1)]], 2));
|
|
2790
|
+
}
|
|
2791
|
+
});
|
|
2792
|
+
//#endregion
|
|
2793
|
+
//#region src/utils/videoThumbnail.ts
|
|
2794
|
+
function zi(e) {
|
|
2795
|
+
if (!e) return {
|
|
2796
|
+
platform: "unknown",
|
|
2797
|
+
videoId: null,
|
|
2798
|
+
thumbnailUrl: null
|
|
2799
|
+
};
|
|
2800
|
+
for (let t of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/i, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/i]) {
|
|
2801
|
+
let n = e.match(t);
|
|
2802
|
+
if (n) {
|
|
2803
|
+
let e = n[1];
|
|
2804
|
+
return {
|
|
2805
|
+
platform: "youtube",
|
|
2806
|
+
videoId: e,
|
|
2807
|
+
thumbnailUrl: `https://img.youtube.com/vi/${e}/maxresdefault.jpg`
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
let t = e.match(/vimeo\.com\/(?:video\/)?(\d+)/i);
|
|
2812
|
+
if (t) {
|
|
2813
|
+
let e = t[1];
|
|
2814
|
+
return {
|
|
2815
|
+
platform: "vimeo",
|
|
2816
|
+
videoId: e,
|
|
2817
|
+
thumbnailUrl: `https://vumbnail.com/${e}.jpg`
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2820
|
+
return {
|
|
2821
|
+
platform: "unknown",
|
|
2822
|
+
videoId: null,
|
|
2823
|
+
thumbnailUrl: null
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
function Bi(e, t) {
|
|
2827
|
+
return t || zi(e).thumbnailUrl;
|
|
2828
|
+
}
|
|
2829
|
+
//#endregion
|
|
2830
|
+
//#region src/components/blocks/VideoBlock.vue?vue&type=script&setup=true&lang.ts
|
|
2831
|
+
var Vi = ["src", "alt"], Hi = {
|
|
2832
|
+
class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
|
|
2833
|
+
style: { opacity: "0.7" }
|
|
2834
|
+
}, Ui = ["href"], Wi = ["src", "alt"], Gi = ["src", "alt"], Ki = {
|
|
2835
|
+
key: 3,
|
|
2836
|
+
class: "tpl:flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
|
|
2837
|
+
}, qi = /* @__PURE__ */ R({
|
|
2838
|
+
__name: "VideoBlock",
|
|
2839
|
+
props: {
|
|
2840
|
+
block: {},
|
|
2841
|
+
viewport: {}
|
|
2842
|
+
},
|
|
2843
|
+
setup(e) {
|
|
2844
|
+
let t = e, { t: n } = G(), { syntax: r } = q(), i = C(() => H(t.block.url, r) || H(t.block.thumbnailUrl, r)), a = X(() => i.value ? void 0 : t.block.thumbnailUrl || void 0), o = X(() => i.value ? t.block.placeholderUrl : void 0), s = C(() => i.value ? null : t.block.thumbnailUrl ? a.value ?? null : Bi(t.block.url)), c = C(() => ({ textAlign: t.block.align })), u = C(() => {
|
|
2845
|
+
let e = t.block.align;
|
|
2846
|
+
return {
|
|
2847
|
+
maxWidth: "100%",
|
|
2848
|
+
width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
|
|
2849
|
+
display: "block",
|
|
2850
|
+
marginLeft: e === "center" || e === "right" ? "auto" : void 0,
|
|
2851
|
+
marginRight: e === "center" ? "auto" : void 0
|
|
2852
|
+
};
|
|
2853
|
+
}), d = C(() => H(t.block.url, r) ? t.block.url : t.block.thumbnailUrl);
|
|
2854
|
+
return (t, r) => (l(), w("div", {
|
|
2855
|
+
class: "tpl:w-full",
|
|
2856
|
+
style: F(c.value)
|
|
2857
|
+
}, [i.value && e.block.placeholderUrl ? (l(), w("div", {
|
|
2858
|
+
key: 0,
|
|
2859
|
+
class: "tpl:relative tpl:inline-block",
|
|
2860
|
+
style: F(u.value)
|
|
2861
|
+
}, [M("img", {
|
|
2862
|
+
class: "tpl:w-full tpl:border-0",
|
|
2863
|
+
src: E(o),
|
|
2864
|
+
alt: e.block.alt
|
|
2865
|
+
}, null, 8, Vi), z(Ri)], 4)) : i.value ? (l(), w("div", {
|
|
2866
|
+
key: 1,
|
|
2867
|
+
class: "tpl:relative tpl:!flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
|
|
2868
|
+
style: F([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, u.value])
|
|
2869
|
+
}, [z(E(It), {
|
|
2870
|
+
size: 36,
|
|
2871
|
+
"stroke-width": 1.5,
|
|
2872
|
+
class: "tpl:text-[var(--tpl-primary)]",
|
|
2873
|
+
style: { opacity: "0.5" }
|
|
2874
|
+
}), M("span", Hi, [z(Pn, { text: d.value }, null, 8, ["text"])])], 4)) : s.value ? (l(), w(I, { key: 2 }, [e.block.url ? (l(), w("a", {
|
|
2875
|
+
key: 0,
|
|
2876
|
+
href: e.block.url,
|
|
2877
|
+
target: "_blank",
|
|
2878
|
+
rel: "noopener noreferrer",
|
|
2879
|
+
class: "tpl:group tpl:relative tpl:inline-block",
|
|
2880
|
+
style: F(u.value),
|
|
2881
|
+
onClick: r[0] ||= O(() => {}, ["prevent"])
|
|
2882
|
+
}, [M("img", {
|
|
2883
|
+
class: "tpl:w-full tpl:border-0",
|
|
2884
|
+
src: s.value,
|
|
2885
|
+
alt: e.block.alt
|
|
2886
|
+
}, null, 8, Wi), z(Ri, { "hover-effect": "" })], 12, Ui)) : (l(), w("div", {
|
|
2887
|
+
key: 1,
|
|
2888
|
+
class: "tpl:relative tpl:inline-block",
|
|
2889
|
+
style: F(u.value)
|
|
2890
|
+
}, [M("img", {
|
|
2891
|
+
class: "tpl:w-full tpl:border-0",
|
|
2892
|
+
src: s.value,
|
|
2893
|
+
alt: e.block.alt
|
|
2894
|
+
}, null, 8, Gi), z(Ri)], 4))], 64)) : (l(), w("div", Ki, [z(E(It), {
|
|
2895
|
+
size: 40,
|
|
2896
|
+
"stroke-width": 1.5,
|
|
2897
|
+
class: "tpl:text-[var(--tpl-border-light)]"
|
|
2898
|
+
}), M("span", null, S(E(n).video.addVideo), 1)]))], 4));
|
|
2899
|
+
}
|
|
2900
|
+
}), Ji = {
|
|
2901
|
+
section: vi,
|
|
2902
|
+
title: mi,
|
|
2903
|
+
paragraph: Yr,
|
|
2904
|
+
image: Ir,
|
|
2905
|
+
button: Ln,
|
|
2906
|
+
divider: gr,
|
|
2907
|
+
video: qi,
|
|
2908
|
+
social: Oi,
|
|
2909
|
+
menu: Br,
|
|
2910
|
+
table: Li,
|
|
2911
|
+
spacer: ji,
|
|
2912
|
+
html: Sr,
|
|
2913
|
+
countdown: b(() => import("./CountdownBlock-Bffpoppw.js"))
|
|
2914
|
+
};
|
|
2915
|
+
function Yi(e) {
|
|
2916
|
+
let { editor: t, config: n, translations: r, fontsManager: a } = e, { t: s, format: c } = G(r);
|
|
2917
|
+
t.setUiTheme(n.uiTheme ?? "auto");
|
|
2918
|
+
let { resolvedTheme: l } = gn(C(() => t.state.uiTheme)), d = v(n.theme ?? {}), { themeStyles: f } = vn({
|
|
2919
|
+
themeOverrides: d,
|
|
2920
|
+
resolvedTheme: l,
|
|
2921
|
+
extraStyles: e.themeExtraStyles
|
|
2922
|
+
}), p = Yt({
|
|
2923
|
+
content: t.content,
|
|
2924
|
+
setContent: (e, n) => t.setContent(e, n),
|
|
2925
|
+
...e.historyOptions
|
|
2926
|
+
});
|
|
2927
|
+
tn(t, p);
|
|
2928
|
+
let m = Zt({
|
|
2929
|
+
addBlock: t.addBlock,
|
|
2930
|
+
removeBlock: t.removeBlock,
|
|
2931
|
+
updateBlock: t.updateBlock,
|
|
2932
|
+
selectBlock: t.selectBlock,
|
|
2933
|
+
findBlockLocation: t.findBlockLocation,
|
|
2934
|
+
blockDefaults: n.blockDefaults
|
|
2935
|
+
}), h = $t(t), g = e.autoSaveOptions !== null && e.autoSaveOptions !== void 0 ? Qt({
|
|
2936
|
+
content: t.content,
|
|
2937
|
+
isDirty: () => t.state.isDirty,
|
|
2938
|
+
...e.autoSaveOptions
|
|
2939
|
+
}) : null, _ = null;
|
|
2940
|
+
g && (_ = B(p.isNavigating, (e) => {
|
|
2941
|
+
e ? g.pause() : g.resume();
|
|
2942
|
+
}));
|
|
2943
|
+
let y = hn(t, {
|
|
2944
|
+
t: s,
|
|
2945
|
+
format: c
|
|
2946
|
+
}, n.customBlocks ?? []), b = xt(n.colors);
|
|
2947
|
+
if (b.allowCustomIgnored && Q.warn("config.colors.allowCustom: false is ignored without presets — keeping the color wheel and hex input so a color can still be chosen."), b.invalidPresets.length > 0 && Q.warn(`config.colors.presets skipped invalid entries: ${b.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).`), b.allowCustom === !1) {
|
|
2948
|
+
let e = On(b.presets, n.blockDefaults, n.templateDefaults);
|
|
2949
|
+
e.length > 0 && Q.warn(`config.colors locks custom colours, but these block/template default colours fall outside colors.presets: ${e.join(", ")}. New blocks start on a colour the palette can't reselect — set blockDefaults / templateDefaults from the same palette.`);
|
|
2950
|
+
}
|
|
2951
|
+
let x = bn();
|
|
2952
|
+
Tn(x, Ji);
|
|
2953
|
+
let S = /* @__PURE__ */ new Set();
|
|
2954
|
+
function w(e) {
|
|
2955
|
+
for (let t of e) {
|
|
2956
|
+
x.registerCustom(t, mr);
|
|
2957
|
+
for (let e of An(t, b)) S.has(e.id) || (S.add(e.id), Q.warn(e.message));
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
n.customBlocks?.length && w(n.customBlocks);
|
|
2961
|
+
let T = sn();
|
|
2962
|
+
if (i() && o(T.dispose), e.containerEl) {
|
|
2963
|
+
let t = e.containerEl;
|
|
2964
|
+
U(document, "pointerdown", (e) => {
|
|
2965
|
+
let n = t.value;
|
|
2966
|
+
n && (e.composedPath?.() ?? []).includes(n) && T.claim();
|
|
2967
|
+
}, { capture: !0 });
|
|
2968
|
+
}
|
|
2969
|
+
function E(r) {
|
|
2970
|
+
T.isActive() && Mn(r, {
|
|
2971
|
+
history: p,
|
|
2972
|
+
selectBlock: (e) => t.selectBlock(e),
|
|
2973
|
+
getSelectedBlockId: () => t.state.selectedBlockId,
|
|
2974
|
+
removeBlock: (e) => t.removeBlock(e),
|
|
2975
|
+
onSave: n.onSave,
|
|
2976
|
+
onBeforeUndo: e.keyboardOptions?.onBeforeUndo,
|
|
2977
|
+
isPicking: () => e.capabilities?.savedBlocks?.isPicking.value === !0,
|
|
2978
|
+
onConfirmPick: () => e.capabilities?.savedBlocks?.confirmPicking(),
|
|
2979
|
+
onCancelPick: () => e.capabilities?.savedBlocks?.cancelPicking()
|
|
2980
|
+
});
|
|
2981
|
+
}
|
|
2982
|
+
U(document, "keydown", E);
|
|
2983
|
+
let D = v(null);
|
|
2984
|
+
u(it, e.editorRoot ?? document), u(Je, D), u(Xe, r), u(W, t), u(mt, p), u(at, m), u(nt, h), u($e, a), u(Ke, f), u(vt, l), u(et, n.blockDefaults), u(dt, x), u(rt, n.customBlocks ?? []), u(qe, n.paletteBlocks), u(_t, En(n.htmlBlockPreview)), u(ct, b), u(ft, xn(t.content, x));
|
|
2985
|
+
let O = ge(n.mergeTags?.syntax);
|
|
2986
|
+
u(Qe, n.mergeTags?.tags ?? []), u(Ye, O), u(ot, n.mergeTags?.onRequest ?? null), u(We, n.mergeTags?.autocomplete !== !1), u(Ue, ln()), u(He, n.logicTags?.tags ?? []), u(Ze, n.logicTags?.pairs ?? []), u(st, n.logicTags?.onRequest ?? null), u(ht, un()), u(Be, n.onRequestMedia ?? null), u(tt, n.resolveImageUrl ? cn(n.resolveImageUrl) : null), u(lt, n.displayConditions?.conditions ?? []), u(ut, n.displayConditions?.allowCustom ?? !1), u(pt, e.capabilities ?? {}), u(gt, y);
|
|
2987
|
+
let k = dn(n.lint) ? null : fn({
|
|
2988
|
+
content: t.content,
|
|
2989
|
+
options: n.lint ?? {},
|
|
2990
|
+
updateBlock: t.updateBlock,
|
|
2991
|
+
updateSettings: t.updateSettings,
|
|
2992
|
+
removeBlock: t.removeBlock
|
|
2993
|
+
});
|
|
2994
|
+
u(Ge, k);
|
|
2995
|
+
function A() {
|
|
2996
|
+
_?.(), k?.destroy(), g?.destroy(), p.destroy();
|
|
2997
|
+
}
|
|
2998
|
+
return {
|
|
2999
|
+
t: s,
|
|
3000
|
+
format: c,
|
|
3001
|
+
history: p,
|
|
3002
|
+
blockActions: m,
|
|
3003
|
+
conditionPreview: h,
|
|
3004
|
+
autoSave: g,
|
|
3005
|
+
resolvedTheme: l,
|
|
3006
|
+
themeStyles: f,
|
|
3007
|
+
themeOverrides: d,
|
|
3008
|
+
registry: x,
|
|
3009
|
+
keyboardReorder: y,
|
|
3010
|
+
templateLint: k,
|
|
3011
|
+
popoverRoot: D,
|
|
3012
|
+
registerCustomBlocks: w,
|
|
3013
|
+
destroy: A
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
3017
|
+
export { kn as A, Xn as C, Un as D, Wn as E, nn as F, en as I, Gt as L, mn as M, pn as N, Bn as O, an as P, tr as S, Gn as T, Sr as _, Oi as a, ar as b, mi as c, Xr as d, Zr as f, wr as g, Ir as h, ji as i, Q as j, Ln as k, fi as l, Br as m, qi as n, xi as o, Yr as p, Li as r, vi as s, Yi as t, Qr as u, gr as v, Yn as w, rr as x, mr as y };
|
|
3018
|
+
|
|
3019
|
+
//# sourceMappingURL=useEditorCore-BA6mspzD.js.map
|