@templatical/editor 0.0.1 → 0.0.2
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/AiChatSidebar-XBj5Rw2l.js +214 -0
- package/dist/AiFeatureMenu-my1mZ9DL.js +63 -0
- package/dist/CloudEditor-BVjgKwq3.js +940 -0
- package/dist/CollaboratorBar-BZq_Gv38.js +91 -0
- package/dist/CommentsSidebar-D9oxqO6l.js +439 -0
- package/dist/DesignReferenceSidebar-CyHq4SWt.js +272 -0
- package/dist/LoadingTrack-vK8W2PJf.js +10 -0
- package/dist/ModuleBrowserModal-Cus2Hdwl.js +205 -0
- package/dist/ModulePreviewCanvas-DaByXKY_.js +106 -0
- package/dist/ParagraphEditor-BSyk5B6S.js +670 -0
- package/dist/RichTextEditorContent-BRpjJ6SV.js +133 -0
- package/dist/SaveModuleDialog-BIZBQrd8.js +122 -0
- package/dist/SnapshotHistory-Ds1-QNbx.js +126 -0
- package/dist/TemplateScoringPanel-C8XSk_Ys.js +249 -0
- package/dist/TestEmailModal-CCVfaFgV.js +94 -0
- package/dist/TitleEditor-V4qaEULF.js +167 -0
- package/dist/TplModal-LT3FXlgs.js +44 -0
- package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
- package/dist/blockTypeIcons-BujoY5Dl.js +126 -0
- package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js +3 -0
- package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js.map +1 -0
- package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js +2 -0
- package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js.map +1 -0
- package/dist/cdn/chunks/TitleEditor-CC3Adjai.js +3 -0
- package/dist/cdn/chunks/TitleEditor-CC3Adjai.js.map +1 -0
- package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
- package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
- package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
- package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
- package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
- package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
- package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
- package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
- package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
- package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
- package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
- package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
- package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
- package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
- package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
- package/dist/cdn/chunks/extensions-BfjbWqOx.js +2 -0
- package/dist/cdn/chunks/extensions-BfjbWqOx.js.map +1 -0
- package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
- package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
- package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
- package/dist/cdn/chunks/styleConstants-UTJ94gco.js +2 -0
- package/dist/cdn/chunks/styleConstants-UTJ94gco.js.map +1 -0
- package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
- package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
- package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js +2 -0
- package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js.map +1 -0
- package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js +2 -0
- package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js.map +1 -0
- package/dist/cdn/editor.css +1 -0
- package/dist/cdn/editor.js +2 -0
- package/dist/cdn/editor.js.map +1 -0
- package/dist/check-B7kDuZmP.js +7 -0
- package/dist/chevron-down-DJLW2Q9Z.js +7 -0
- package/dist/circle-alert-E2vYPs5r.js +25 -0
- package/dist/clock-lWIIQA3C.js +12 -0
- package/dist/de-B4Ob4vCo.js +682 -0
- package/dist/dist-4LiM9FDd.js +35 -0
- package/dist/dist-Bu7veieH.js +776 -0
- package/dist/dist-C1BIRHCQ.js +61 -0
- package/dist/dist-CG-vEqSU.js +314 -0
- package/dist/dist-C_ymrGFi.js +10625 -0
- package/dist/dist-ChAGLpWo.js +35 -0
- package/dist/dist-DNjZKe2Z.js +513 -0
- package/dist/dist-D_HQYSY-.js +189 -0
- package/dist/dist-DkypH7qG.js +5 -0
- package/dist/dist-DmOE-Ubp.js +74 -0
- package/dist/dist-DrvKRSU6.js +47 -0
- package/dist/dist-Dxnd0GRf.js +5 -0
- package/dist/dist-DysAFIPy.js +2054 -0
- package/dist/emojiData-BfWQS72m.js +17 -0
- package/dist/en-YXsspZJG.js +682 -0
- package/dist/extensions-BA4NshZQ.js +420 -0
- package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
- package/dist/i18n-ikyi28RU.js +23 -0
- package/dist/image-up-X4xIq4ea.js +23 -0
- package/dist/keys-8B5MFafK.js +4 -0
- package/dist/liquid.browser-BemTg3sZ.js +3272 -0
- package/dist/loader-circle-BTQQxC3l.js +7 -0
- package/dist/message-circle-Blgm6V_h.js +7 -0
- package/dist/refresh-cw-Bb4PEeW1.js +44 -0
- package/dist/scan-line-7lZPfOdm.js +25 -0
- package/dist/send-C0ltAQrv.js +10 -0
- package/dist/shield-check-f-qv4RKs.js +10 -0
- package/dist/sparkles-KhBCGlqB.js +23 -0
- package/dist/styleConstants-CgtFM9hQ.js +43 -0
- package/dist/styles-hQgJKM4i.js +3406 -0
- package/dist/templatical-editor.css +2 -1
- package/dist/templatical-editor.js +242 -9
- package/dist/templatical-editor.umd.cjs +112 -524
- package/dist/timeouts-CmBrLeZA.js +4 -0
- package/dist/trash-2-OwjZ-guZ.js +25 -0
- package/dist/triangle-alert-DOSRIUYZ.js +17 -0
- package/dist/useEditorCore-DVp5qmtC.js +5552 -0
- package/dist/useI18n-DzH4KXDk.js +17 -0
- package/dist/useMergeTag-D9zQVE-e.js +33 -0
- package/dist/x-CGlq2XQe.js +10 -0
- package/package.json +30 -20
- package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
- package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
- package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
- package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
- package/dist/CommentsSidebar-PVUlloyB.js +0 -655
- package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
- package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
- package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
- package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
- package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
- package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
- package/dist/TestEmailModal-Cwre5elw.js +0 -128
- package/dist/TextEditor-BuUOIByX.js +0 -780
- package/dist/de-BWIAblxs.js +0 -685
- package/dist/en-cYyUzNV1.js +0 -685
- package/dist/index-0tWUczNu.js +0 -47
- package/dist/index-4okvXjqk.js +0 -41
- package/dist/index-BSc6h5zo.js +0 -967
- package/dist/index-CrvwWlhN.js +0 -41
- package/dist/index-D-iD-7lO.js +0 -10961
- package/dist/index-D-ygXbc8.js +0 -2452
- package/dist/index-DbrWKz-e.js +0 -1415
- package/dist/index-DeUeHy6g.js +0 -422
- package/dist/index-Ude6e9RU.js +0 -41
- package/dist/index-ZQzHBwkr.js +0 -12767
- package/dist/liquid.browser-CeNxS2GL.js +0 -3493
- package/dist/loader-circle-tM9j2mRh.js +0 -13
- package/dist/shield-check-Ngi9jAQc.js +0 -20
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { t as e } from "./useI18n-DzH4KXDk.js";
|
|
2
|
+
import { t } from "./useMergeTag-D9zQVE-e.js";
|
|
3
|
+
import { Wt as n, i as r, o as i, p as a, u as o } from "./dist-C_ymrGFi.js";
|
|
4
|
+
import { n as s, t as c } from "./dist-DNjZKe2Z.js";
|
|
5
|
+
import { computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, defineComponent as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, toDisplayString as b, unref as x, vModelText as S, withCtx as C, withDirectives as w, withKeys as T, withModifiers as E } from "vue";
|
|
6
|
+
import { SYNTAX_PRESETS as D, getLogicMergeTagKeyword as O, getMergeTagLabel as k, isLogicMergeTagValue as A } from "@templatical/types";
|
|
7
|
+
//#region src/extensions/FontSize.ts
|
|
8
|
+
var j = r.create({
|
|
9
|
+
name: "fontSize",
|
|
10
|
+
addOptions() {
|
|
11
|
+
return { types: ["textStyle"] };
|
|
12
|
+
},
|
|
13
|
+
addGlobalAttributes() {
|
|
14
|
+
return [{
|
|
15
|
+
types: this.options.types,
|
|
16
|
+
attributes: { fontSize: {
|
|
17
|
+
default: null,
|
|
18
|
+
parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, "") || null,
|
|
19
|
+
renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
|
|
20
|
+
} }
|
|
21
|
+
}];
|
|
22
|
+
},
|
|
23
|
+
addCommands() {
|
|
24
|
+
return {
|
|
25
|
+
setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
|
|
26
|
+
unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}), M = r.create({
|
|
30
|
+
name: "letterSpacing",
|
|
31
|
+
addOptions() {
|
|
32
|
+
return { types: ["textStyle"] };
|
|
33
|
+
},
|
|
34
|
+
addGlobalAttributes() {
|
|
35
|
+
return [{
|
|
36
|
+
types: this.options.types,
|
|
37
|
+
attributes: { letterSpacing: {
|
|
38
|
+
default: null,
|
|
39
|
+
parseHTML: (e) => e.style.letterSpacing?.replace(/['"]+/g, "") || null,
|
|
40
|
+
renderHTML: (e) => e.letterSpacing ? { style: `letter-spacing: ${e.letterSpacing}` } : {}
|
|
41
|
+
} }
|
|
42
|
+
}];
|
|
43
|
+
},
|
|
44
|
+
addCommands() {
|
|
45
|
+
return {
|
|
46
|
+
setLetterSpacing: (e) => ({ chain: t }) => t().setMark("textStyle", { letterSpacing: e }).run(),
|
|
47
|
+
unsetLetterSpacing: () => ({ chain: e }) => e().setMark("textStyle", { letterSpacing: null }).removeEmptyTextStyle().run()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}), N = r.create({
|
|
51
|
+
name: "lineHeight",
|
|
52
|
+
addOptions() {
|
|
53
|
+
return {
|
|
54
|
+
types: ["paragraph"],
|
|
55
|
+
defaultLineHeight: "1.5"
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
addGlobalAttributes() {
|
|
59
|
+
return [{
|
|
60
|
+
types: this.options.types,
|
|
61
|
+
attributes: { lineHeight: {
|
|
62
|
+
default: null,
|
|
63
|
+
parseHTML: (e) => e.style.lineHeight || null,
|
|
64
|
+
renderHTML: (e) => e.lineHeight ? { style: `line-height: ${e.lineHeight}` } : {}
|
|
65
|
+
} }
|
|
66
|
+
}];
|
|
67
|
+
},
|
|
68
|
+
addCommands() {
|
|
69
|
+
return {
|
|
70
|
+
setLineHeight: (e) => ({ commands: t }) => this.options.types.every((n) => t.updateAttributes(n, { lineHeight: e })),
|
|
71
|
+
unsetLineHeight: () => ({ commands: e }) => this.options.types.every((t) => e.resetAttributes(t, "lineHeight"))
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}), P = [
|
|
75
|
+
"aria-label",
|
|
76
|
+
"data-tooltip",
|
|
77
|
+
"onKeydown"
|
|
78
|
+
], F = ["aria-label", "onKeydown"], I = ["aria-label"], L = /* @__PURE__ */ m({
|
|
79
|
+
__name: "LogicMergeTagNodeView",
|
|
80
|
+
props: {
|
|
81
|
+
node: {},
|
|
82
|
+
editor: {},
|
|
83
|
+
getPos: { type: Function },
|
|
84
|
+
deleteNode: { type: Function },
|
|
85
|
+
updateAttributes: { type: Function }
|
|
86
|
+
},
|
|
87
|
+
setup(n) {
|
|
88
|
+
let r = n, { syntax: i } = t(), { t: a } = e(), o = l(() => A(r.node.attrs.value, i)), s = l(() => O(r.node.attrs.value, i)), m = y(!1), D = y(""), k = y(null), j = !1;
|
|
89
|
+
function M() {
|
|
90
|
+
D.value = r.node.attrs.value, j = !1, m.value = !0, h(() => {
|
|
91
|
+
k.value?.focus(), k.value?.select();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function N() {
|
|
95
|
+
if (j) return;
|
|
96
|
+
j = !0;
|
|
97
|
+
let e = D.value.trim();
|
|
98
|
+
if (!e) {
|
|
99
|
+
m.value = !1;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
e !== r.node.attrs.value && r.updateAttributes({
|
|
103
|
+
value: e,
|
|
104
|
+
keyword: A(e, i) ? O(e, i) : ""
|
|
105
|
+
}), m.value = !1;
|
|
106
|
+
}
|
|
107
|
+
function L(e) {
|
|
108
|
+
e.key === "Enter" ? (e.preventDefault(), N()) : e.key === "Escape" && (m.value = !1);
|
|
109
|
+
}
|
|
110
|
+
return (e, t) => (v(), u(x(c), {
|
|
111
|
+
as: "span",
|
|
112
|
+
class: g(o.value ? "tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none" : ""),
|
|
113
|
+
style: _(o.value ? "background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);" : ""),
|
|
114
|
+
contenteditable: "false"
|
|
115
|
+
}, {
|
|
116
|
+
default: C(() => [m.value ? w((v(), f("input", {
|
|
117
|
+
key: 0,
|
|
118
|
+
ref_key: "inputRef",
|
|
119
|
+
ref: k,
|
|
120
|
+
"onUpdate:modelValue": t[0] ||= (e) => D.value = e,
|
|
121
|
+
type: "text",
|
|
122
|
+
class: "tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]",
|
|
123
|
+
onBlur: N,
|
|
124
|
+
onKeydown: L
|
|
125
|
+
}, null, 544)), [[S, D.value]]) : o.value ? (v(), f("span", {
|
|
126
|
+
key: 1,
|
|
127
|
+
role: "button",
|
|
128
|
+
tabindex: "0",
|
|
129
|
+
"aria-label": x(a).mergeTag.editValue,
|
|
130
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
131
|
+
"data-tooltip": n.node.attrs.value,
|
|
132
|
+
onClick: E(M, ["stop"]),
|
|
133
|
+
onKeydown: [T(E(M, ["stop"]), ["enter"]), T(E(M, ["prevent", "stop"]), ["space"])]
|
|
134
|
+
}, b(s.value), 41, P)) : (v(), f("span", {
|
|
135
|
+
key: 2,
|
|
136
|
+
role: "button",
|
|
137
|
+
tabindex: "0",
|
|
138
|
+
"aria-label": x(a).mergeTag.editValue,
|
|
139
|
+
onClick: E(M, ["stop"]),
|
|
140
|
+
onKeydown: [T(E(M, ["stop"]), ["enter"]), T(E(M, ["prevent", "stop"]), ["space"])]
|
|
141
|
+
}, b(n.node.attrs.value), 41, F)), o.value ? (v(), f("button", {
|
|
142
|
+
key: 3,
|
|
143
|
+
type: "button",
|
|
144
|
+
"aria-label": x(a).mergeTag.deleteMergeTag,
|
|
145
|
+
class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
|
|
146
|
+
contenteditable: "false",
|
|
147
|
+
onClick: t[1] ||= E((...e) => n.deleteNode && n.deleteNode(...e), ["stop", "prevent"])
|
|
148
|
+
}, [...t[2] ||= [p("svg", {
|
|
149
|
+
width: "10",
|
|
150
|
+
height: "10",
|
|
151
|
+
viewBox: "0 0 24 24",
|
|
152
|
+
fill: "none",
|
|
153
|
+
stroke: "currentColor",
|
|
154
|
+
"stroke-width": "3",
|
|
155
|
+
"aria-hidden": "true"
|
|
156
|
+
}, [p("line", {
|
|
157
|
+
x1: "18",
|
|
158
|
+
y1: "6",
|
|
159
|
+
x2: "6",
|
|
160
|
+
y2: "18"
|
|
161
|
+
}), p("line", {
|
|
162
|
+
x1: "6",
|
|
163
|
+
y1: "6",
|
|
164
|
+
x2: "18",
|
|
165
|
+
y2: "18"
|
|
166
|
+
})], -1)]], 8, I)) : d("", !0)]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["class", "style"]));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/extensions/isNodeSelected.ts
|
|
173
|
+
function R(e, t) {
|
|
174
|
+
let { selection: n } = e.state, { $from: r, $to: i } = n, a = !1;
|
|
175
|
+
return e.state.doc.nodesBetween(r.pos, i.pos, (e) => {
|
|
176
|
+
if (e.type.name === t) return a = !0, !1;
|
|
177
|
+
}), !!(a || r.pos > 0 && r.nodeBefore?.type.name === t || r.nodeAfter?.type.name === t);
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/extensions/renderVueNodeView.ts
|
|
181
|
+
function z(e) {
|
|
182
|
+
return s(e);
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/extensions/LogicMergeTagNode.ts
|
|
186
|
+
var B = o.create({
|
|
187
|
+
name: "logicMergeTagNode",
|
|
188
|
+
group: "inline",
|
|
189
|
+
inline: !0,
|
|
190
|
+
atom: !0,
|
|
191
|
+
addOptions() {
|
|
192
|
+
return { syntax: D.liquid };
|
|
193
|
+
},
|
|
194
|
+
addAttributes() {
|
|
195
|
+
return {
|
|
196
|
+
value: {
|
|
197
|
+
default: "",
|
|
198
|
+
parseHTML: (e) => e.getAttribute("data-logic-merge-tag") || ""
|
|
199
|
+
},
|
|
200
|
+
keyword: {
|
|
201
|
+
default: "",
|
|
202
|
+
parseHTML: (e) => e.getAttribute("data-keyword") || e.textContent || ""
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
parseHTML() {
|
|
207
|
+
return [{ tag: "span[data-logic-merge-tag]" }];
|
|
208
|
+
},
|
|
209
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
210
|
+
if (!A(e.attrs.value, this.options.syntax)) return [
|
|
211
|
+
"span",
|
|
212
|
+
{},
|
|
213
|
+
e.attrs.value
|
|
214
|
+
];
|
|
215
|
+
let r = O(e.attrs.value, this.options.syntax);
|
|
216
|
+
return [
|
|
217
|
+
"span",
|
|
218
|
+
n(t, {
|
|
219
|
+
"data-logic-merge-tag": e.attrs.value,
|
|
220
|
+
"data-keyword": r
|
|
221
|
+
}),
|
|
222
|
+
r
|
|
223
|
+
];
|
|
224
|
+
},
|
|
225
|
+
addNodeView() {
|
|
226
|
+
return z(L);
|
|
227
|
+
},
|
|
228
|
+
addKeyboardShortcuts() {
|
|
229
|
+
return {
|
|
230
|
+
Backspace: () => R(this.editor, this.name),
|
|
231
|
+
Delete: () => R(this.editor, this.name)
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
addInputRules() {
|
|
235
|
+
return [new i({
|
|
236
|
+
find: RegExp(this.options.syntax.logic.source + "$", ""),
|
|
237
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
238
|
+
let r = n[0];
|
|
239
|
+
if (!A(r, this.options.syntax)) return;
|
|
240
|
+
let i = O(r, this.options.syntax), a = this.type.create({
|
|
241
|
+
value: r,
|
|
242
|
+
keyword: i
|
|
243
|
+
});
|
|
244
|
+
e.tr.replaceWith(t.from, t.to, a);
|
|
245
|
+
}
|
|
246
|
+
})];
|
|
247
|
+
},
|
|
248
|
+
addPasteRules() {
|
|
249
|
+
return [new a({
|
|
250
|
+
find: new RegExp(this.options.syntax.logic.source, "g"),
|
|
251
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
252
|
+
let r = n[0];
|
|
253
|
+
if (!A(r, this.options.syntax)) return;
|
|
254
|
+
let i = O(r, this.options.syntax), a = this.type.create({
|
|
255
|
+
value: r,
|
|
256
|
+
keyword: i
|
|
257
|
+
});
|
|
258
|
+
e.tr.replaceWith(t.from, t.to, a);
|
|
259
|
+
}
|
|
260
|
+
})];
|
|
261
|
+
}
|
|
262
|
+
}), V = [
|
|
263
|
+
"aria-label",
|
|
264
|
+
"data-tooltip",
|
|
265
|
+
"onKeydown"
|
|
266
|
+
], H = ["aria-label"], U = /* @__PURE__ */ m({
|
|
267
|
+
__name: "MergeTagNodeView",
|
|
268
|
+
props: {
|
|
269
|
+
node: {},
|
|
270
|
+
deleteNode: { type: Function },
|
|
271
|
+
updateAttributes: { type: Function }
|
|
272
|
+
},
|
|
273
|
+
setup(n) {
|
|
274
|
+
let r = n, { getMergeTagLabel: i } = t(), { t: a } = e(), o = l(() => i(r.node.attrs.value)), s = y(!1), d = y(""), m = y(null);
|
|
275
|
+
function g() {
|
|
276
|
+
d.value = r.node.attrs.value, s.value = !0, h(() => {
|
|
277
|
+
m.value?.focus(), m.value?.select();
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function _() {
|
|
281
|
+
let e = d.value.trim();
|
|
282
|
+
e && e !== r.node.attrs.value && r.updateAttributes({
|
|
283
|
+
value: e,
|
|
284
|
+
label: i(e)
|
|
285
|
+
}), s.value = !1;
|
|
286
|
+
}
|
|
287
|
+
function D(e) {
|
|
288
|
+
e.key === "Enter" ? (e.preventDefault(), _()) : e.key === "Escape" && (s.value = !1);
|
|
289
|
+
}
|
|
290
|
+
return (e, t) => (v(), u(x(c), {
|
|
291
|
+
as: "span",
|
|
292
|
+
class: "tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]",
|
|
293
|
+
style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)" },
|
|
294
|
+
contenteditable: "false"
|
|
295
|
+
}, {
|
|
296
|
+
default: C(() => [s.value ? w((v(), f("input", {
|
|
297
|
+
key: 0,
|
|
298
|
+
ref_key: "inputRef",
|
|
299
|
+
ref: m,
|
|
300
|
+
"onUpdate:modelValue": t[0] ||= (e) => d.value = e,
|
|
301
|
+
type: "text",
|
|
302
|
+
class: "tpl:w-32 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]",
|
|
303
|
+
onBlur: _,
|
|
304
|
+
onKeydown: D
|
|
305
|
+
}, null, 544)), [[S, d.value]]) : (v(), f("span", {
|
|
306
|
+
key: 1,
|
|
307
|
+
role: "button",
|
|
308
|
+
tabindex: "0",
|
|
309
|
+
"aria-label": x(a).mergeTag.editValue,
|
|
310
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
311
|
+
"data-tooltip": n.node.attrs.value,
|
|
312
|
+
onClick: E(g, ["stop"]),
|
|
313
|
+
onKeydown: [T(E(g, ["stop"]), ["enter"]), T(E(g, ["prevent", "stop"]), ["space"])]
|
|
314
|
+
}, b(o.value), 41, V)), p("button", {
|
|
315
|
+
type: "button",
|
|
316
|
+
"aria-label": x(a).mergeTag.deleteMergeTag,
|
|
317
|
+
class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
|
|
318
|
+
contenteditable: "false",
|
|
319
|
+
onClick: t[1] ||= E((...e) => n.deleteNode && n.deleteNode(...e), ["stop", "prevent"])
|
|
320
|
+
}, [...t[2] ||= [p("svg", {
|
|
321
|
+
width: "10",
|
|
322
|
+
height: "10",
|
|
323
|
+
viewBox: "0 0 24 24",
|
|
324
|
+
fill: "none",
|
|
325
|
+
stroke: "currentColor",
|
|
326
|
+
"stroke-width": "3",
|
|
327
|
+
"aria-hidden": "true"
|
|
328
|
+
}, [p("line", {
|
|
329
|
+
x1: "18",
|
|
330
|
+
y1: "6",
|
|
331
|
+
x2: "6",
|
|
332
|
+
y2: "18"
|
|
333
|
+
}), p("line", {
|
|
334
|
+
x1: "6",
|
|
335
|
+
y1: "6",
|
|
336
|
+
x2: "18",
|
|
337
|
+
y2: "18"
|
|
338
|
+
})], -1)]], 8, H)]),
|
|
339
|
+
_: 1
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
}), W = o.create({
|
|
343
|
+
name: "mergeTagNode",
|
|
344
|
+
group: "inline",
|
|
345
|
+
inline: !0,
|
|
346
|
+
atom: !0,
|
|
347
|
+
addOptions() {
|
|
348
|
+
return {
|
|
349
|
+
mergeTags: [],
|
|
350
|
+
syntax: D.liquid
|
|
351
|
+
};
|
|
352
|
+
},
|
|
353
|
+
addAttributes() {
|
|
354
|
+
return {
|
|
355
|
+
label: {
|
|
356
|
+
default: "",
|
|
357
|
+
parseHTML: (e) => e.getAttribute("data-label") || e.textContent || ""
|
|
358
|
+
},
|
|
359
|
+
value: {
|
|
360
|
+
default: "",
|
|
361
|
+
parseHTML: (e) => e.getAttribute("data-merge-tag") || ""
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
},
|
|
365
|
+
parseHTML() {
|
|
366
|
+
return [{ tag: "span[data-merge-tag]" }];
|
|
367
|
+
},
|
|
368
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
369
|
+
let r = k(e.attrs.value, this.options.mergeTags);
|
|
370
|
+
return [
|
|
371
|
+
"span",
|
|
372
|
+
n(t, {
|
|
373
|
+
"data-merge-tag": e.attrs.value,
|
|
374
|
+
"data-label": r
|
|
375
|
+
}),
|
|
376
|
+
r
|
|
377
|
+
];
|
|
378
|
+
},
|
|
379
|
+
addNodeView() {
|
|
380
|
+
return z(U);
|
|
381
|
+
},
|
|
382
|
+
addCommands() {
|
|
383
|
+
return { insertMergeTag: (e) => ({ commands: t }) => t.insertContent({
|
|
384
|
+
type: this.name,
|
|
385
|
+
attrs: e
|
|
386
|
+
}) };
|
|
387
|
+
},
|
|
388
|
+
addKeyboardShortcuts() {
|
|
389
|
+
return {
|
|
390
|
+
Backspace: () => R(this.editor, this.name),
|
|
391
|
+
Delete: () => R(this.editor, this.name)
|
|
392
|
+
};
|
|
393
|
+
},
|
|
394
|
+
addInputRules() {
|
|
395
|
+
return [new i({
|
|
396
|
+
find: RegExp(this.options.syntax.value.source + "$", ""),
|
|
397
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
398
|
+
let r = n[0], i = k(r, this.options.mergeTags), a = this.type.create({
|
|
399
|
+
label: i,
|
|
400
|
+
value: r
|
|
401
|
+
});
|
|
402
|
+
e.tr.replaceWith(t.from, t.to, a);
|
|
403
|
+
}
|
|
404
|
+
})];
|
|
405
|
+
},
|
|
406
|
+
addPasteRules() {
|
|
407
|
+
return [new a({
|
|
408
|
+
find: new RegExp(this.options.syntax.value.source, "g"),
|
|
409
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
410
|
+
let r = n[0], i = k(r, this.options.mergeTags), a = this.type.create({
|
|
411
|
+
label: i,
|
|
412
|
+
value: r
|
|
413
|
+
});
|
|
414
|
+
e.tr.replaceWith(t.from, t.to, a);
|
|
415
|
+
}
|
|
416
|
+
})];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
//#endregion
|
|
420
|
+
export { j as FontSize, M as LetterSpacing, N as LineHeight, B as LogicMergeTagNode, W as MergeTagNode };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/formatRelativeTime.ts
|
|
2
|
+
var e = 6e4, t = 36e5, n = 864e5;
|
|
3
|
+
function r(r, i, a, o) {
|
|
4
|
+
let s = new Date(r), c = Date.now() - s.getTime(), l = Math.floor(c / e), u = Math.floor(c / t), d = Math.floor(c / n);
|
|
5
|
+
return l < 1 ? i.justNow : l < 60 ? a ? a(i.minutesAgo, { minutes: l }) : i.minutesAgo.replace("{minutes}", String(l)) : u < 24 ? a ? a(i.hoursAgo, { hours: u }) : i.hoursAgo.replace("{hours}", String(u)) : o !== void 0 && d >= o ? null : a ? a(i.daysAgo, { days: d }) : i.daysAgo.replace("{days}", String(d));
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { r as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { F as e } from "./useEditorCore-DVp5qmtC.js";
|
|
2
|
+
//#region \0rolldown_dynamic_import_helper.js
|
|
3
|
+
var t = (e, t, n) => {
|
|
4
|
+
let r = t.lastIndexOf("?"), i = e[r === -1 || r < t.lastIndexOf("/") ? t : t.slice(0, r)];
|
|
5
|
+
return i ? typeof i == "function" ? i() : Promise.resolve(i) : new Promise((e, r) => {
|
|
6
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ Error("Unknown variable dynamic import: " + t + (t.split("/").length === n ? "" : ". Note that variables only represent file names one level deep."))));
|
|
7
|
+
});
|
|
8
|
+
}, n = /* @__PURE__ */ e({
|
|
9
|
+
getBaseLocale: () => i,
|
|
10
|
+
loadTranslations: () => a
|
|
11
|
+
}), r = ["en", "de"];
|
|
12
|
+
function i(e) {
|
|
13
|
+
return e.split("-")[0].toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
async function a(e) {
|
|
16
|
+
let n = i(e), a = r.includes(n) ? n : "en";
|
|
17
|
+
return (await t(/* @__PURE__ */ Object.assign({
|
|
18
|
+
"./locales/de.ts": () => import("./de-B4Ob4vCo.js"),
|
|
19
|
+
"./locales/en.ts": () => import("./en-YXsspZJG.js")
|
|
20
|
+
}), `./locales/${a}.ts`, 3)).default;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as n, n as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { n as e } from "./_plugin-vue_export-helper-B1-bu7yR.js";
|
|
2
|
+
var t = e("image-up", [
|
|
3
|
+
["path", {
|
|
4
|
+
d: "M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",
|
|
5
|
+
key: "9csbqa"
|
|
6
|
+
}],
|
|
7
|
+
["path", {
|
|
8
|
+
d: "m14 19.5 3-3 3 3",
|
|
9
|
+
key: "9vmjn0"
|
|
10
|
+
}],
|
|
11
|
+
["path", {
|
|
12
|
+
d: "M17 22v-5.5",
|
|
13
|
+
key: "1aa6fl"
|
|
14
|
+
}],
|
|
15
|
+
["circle", {
|
|
16
|
+
cx: "9",
|
|
17
|
+
cy: "9",
|
|
18
|
+
r: "2",
|
|
19
|
+
key: "af1f0g"
|
|
20
|
+
}]
|
|
21
|
+
]);
|
|
22
|
+
//#endregion
|
|
23
|
+
export { t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/keys.ts
|
|
2
|
+
var e = Symbol("translations"), t = Symbol("editor"), n = Symbol("history"), r = Symbol("blockActions"), i = Symbol("conditionPreview"), a = Symbol("fontsManager"), o = Symbol("themeStyles"), s = Symbol("tplUiTheme"), c = Symbol("blockDefaults"), l = Symbol("blockRegistry"), u = Symbol("customBlockDefinitions"), d = Symbol("mergeTags"), f = Symbol("mergeTagSyntax"), p = Symbol("onRequestMergeTag"), m = Symbol("onRequestMedia"), h = Symbol("displayConditions"), g = Symbol("allowCustomConditions"), _ = Symbol("capabilities"), v = Symbol("authManager"), y = Symbol("aiConfig"), b = Symbol("comments"), x = Symbol("savedModulesHeadless"), S = Symbol("scoring");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { s as C, e as S, m as _, c as a, S as b, b as c, h as d, t as f, f as g, d as h, r as i, i as l, n as m, g as n, l as o, a as p, v as r, _ as s, y as t, u, p as v, o as x, x as y };
|