@aswin.dev/editor 0.6.3 → 0.7.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/README.md +3 -3
- package/dist/AccessibilityPanel-COL6Wm7p.js +108 -0
- package/dist/AiChatSidebar-DWGPVtvC.js +229 -0
- package/dist/AiFeatureMenu-duUFSfDf.js +63 -0
- package/dist/BlockA11yBadge-Qs6HtXid.js +34 -0
- package/dist/CloudEditor-CFldoCOb.js +1207 -0
- package/dist/CollaboratorBar-Bw-lbt61.js +95 -0
- package/dist/CommentsSidebar-BaD5F53-.js +436 -0
- package/dist/CountdownBlock-DaYGxKqo.js +92 -0
- package/dist/CountdownToolbar-Dg4F8MTk.js +210 -0
- package/dist/DesignReferenceSidebar-BSH7uNP_.js +276 -0
- package/dist/LoadingTrack-Ba2pfF57.js +10 -0
- package/dist/ModuleBrowserModal-6phxZSKI.js +206 -0
- package/dist/ModulePreviewCanvas-BW8L3eQX.js +108 -0
- package/dist/NumberWithSuffix-BpUzQOJt.js +422 -0
- package/dist/ParagraphEditor-DNSzAB-I.js +695 -0
- package/dist/RichTextEditorContent-CrqPQdnk.js +137 -0
- package/dist/SaveModuleDialog-zMQTpez7.js +123 -0
- package/dist/SnapshotHistory-Do-A5rYU.js +122 -0
- package/dist/TemplateScoringPanel-CS7o62zS.js +256 -0
- package/dist/TestEmailModal-DGj_9V1u.js +94 -0
- package/dist/TitleEditor-C7IDnAoS.js +172 -0
- package/dist/TplModal-BAsVzcTb.js +44 -0
- package/dist/_plugin-vue_export-helper-BVAJ4lgT.js +8 -0
- package/dist/accessibility-BU09xZrQ.js +27 -0
- package/dist/blockTypeIcons-C6LDKvmd.js +140 -0
- package/dist/bundle-stats.json +10 -0
- package/dist/check-DJrpDKO_.js +7 -0
- package/dist/chevron-down-C5oBUhT8.js +7 -0
- package/dist/chevron-right-BqCptpdp.js +10 -0
- package/dist/circle-alert-ZQQc98HC.js +25 -0
- package/dist/clock-ik2pRJKG.js +12 -0
- package/dist/cloud-6ZmAvF0j.js +1791 -0
- package/dist/createLucideIcon-ClREiSx3.js +43 -0
- package/dist/de-DWcgp-7T.js +729 -0
- package/dist/de-GOtR9DwW.js +207 -0
- package/dist/dist-BUzw1buG.js +35 -0
- package/dist/dist-BZyY-SS4.js +74 -0
- package/dist/dist-BadNx4qo.js +5 -0
- package/dist/dist-BesOh2mk.js +35 -0
- package/dist/dist-Bz3M4RXG.js +2082 -0
- package/dist/dist-C04s_fLA.js +563 -0
- package/dist/dist-C3T2AKtB.js +776 -0
- package/dist/dist-C9ckKEZL.js +519 -0
- package/dist/dist-CBItRG-Z.js +47 -0
- package/dist/dist-COSzWQUs.js +5 -0
- package/dist/dist-CivF9P8b.js +382 -0
- package/dist/dist-DXa1uAMh.js +10658 -0
- package/dist/dist-DtiDUrX-.js +189 -0
- package/dist/dist-Dzt5foyL.js +61 -0
- package/dist/emojiData-DrBuvEoP.js +17 -0
- package/dist/en-Cxd4fhNm.js +729 -0
- package/dist/en-dFFQVzNn.js +207 -0
- package/dist/extensions-D__hOlV1.js +799 -0
- package/dist/formatRelativeTime-BhhO8yCl.js +12 -0
- package/dist/image-up-DT7gcJLN.js +23 -0
- package/dist/index.d.ts +352 -0
- package/dist/info-BSPGcsSM.js +19 -0
- package/dist/keys-CvX8D-8C.js +10 -0
- package/dist/liquid.browser-BvCyLQII.js +3277 -0
- package/dist/loader-circle-Balo8p3d.js +7 -0
- package/dist/message-circle-B39qAHxs.js +7 -0
- package/dist/pencil-BZJPNYWR.js +10 -0
- package/dist/readableTextColor-DVuzNX1y.js +30 -0
- package/dist/refresh-cw-DwDqGUM0.js +29 -0
- package/dist/rolldown-runtime-BZGGJVDF.js +20 -0
- package/dist/scan-line-CzfFJO1o.js +25 -0
- package/dist/send-D2eSo4GH.js +10 -0
- package/dist/shield-check-jkpgcC0-.js +10 -0
- package/dist/sparkles-Chm5CZfb.js +23 -0
- package/dist/style.css +2 -0
- package/dist/styleConstants-34eUKPOZ.js +55 -0
- package/dist/styles-B4tjX5SP.js +5224 -0
- package/dist/templatical-editor.js +312 -0
- package/dist/text-align-start-CzBnJsW8.js +43 -0
- package/dist/timeouts-BSGxjuUF.js +4 -0
- package/dist/trash-2-CtK2apEH.js +25 -0
- package/dist/triangle-alert-KpDVNbpn.js +17 -0
- package/dist/useCloudI18n-DOKSZql1.js +23 -0
- package/dist/useEditorCore-wslttMH-.js +9517 -0
- package/dist/useI18n-C2xQZ6K9.js +17 -0
- package/dist/useMergeTag-DX0XG5V9.js +34 -0
- package/dist/vue.runtime.esm-bundler-CjauPXjj.js +5775 -0
- package/dist/x-BkaOMosX.js +10 -0
- package/package.json +10 -10
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
import { At as e, C as t, F as n, Ft as r, N as i, T as a, U as o, W as s, _ as c, c as l, d as u, et as d, f, g as p, h as m, jt as h, k as g, m as _, n as v, st as y, u as b, v as x } from "./vue.runtime.esm-bundler-CjauPXjj.js";
|
|
2
|
+
import { D as S, O as C, i as w, j as T } from "./dist-C04s_fLA.js";
|
|
3
|
+
import { t as E } from "./useI18n-C2xQZ6K9.js";
|
|
4
|
+
import { t as D } from "./useMergeTag-DX0XG5V9.js";
|
|
5
|
+
import { F as O, Gt as k, _n as A, bn as j, i as M, o as N, p as P, u as F, vn as ee, xn as I } from "./dist-DXa1uAMh.js";
|
|
6
|
+
import { n as L, t as R } from "./dist-C9ckKEZL.js";
|
|
7
|
+
//#region src/extensions/FontSize.ts
|
|
8
|
+
var te = M.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
|
+
}), ne = M.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
|
+
}), re = M.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
|
+
}), z = [
|
|
75
|
+
"aria-label",
|
|
76
|
+
"data-tooltip",
|
|
77
|
+
"onKeydown"
|
|
78
|
+
], B = ["aria-label", "onKeydown"], V = ["aria-label"], H = /* @__PURE__ */ t({
|
|
79
|
+
__name: "LogicMergeTagNodeView",
|
|
80
|
+
props: {
|
|
81
|
+
node: {},
|
|
82
|
+
editor: {},
|
|
83
|
+
getPos: { type: Function },
|
|
84
|
+
deleteNode: { type: Function },
|
|
85
|
+
updateAttributes: { type: Function }
|
|
86
|
+
},
|
|
87
|
+
setup(t) {
|
|
88
|
+
let n = t, { syntax: a } = D(), { t: f } = E(), v = _(() => T(n.node.attrs.value, a)), C = _(() => S(n.node.attrs.value, a)), w = d(!1), O = d(""), k = d(null), A = !1;
|
|
89
|
+
function j() {
|
|
90
|
+
O.value = n.node.attrs.value, A = !1, w.value = !0, g(() => {
|
|
91
|
+
k.value?.focus(), k.value?.select();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function M() {
|
|
95
|
+
if (A) return;
|
|
96
|
+
A = !0;
|
|
97
|
+
let e = O.value.trim();
|
|
98
|
+
if (!e) {
|
|
99
|
+
w.value = !1;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
e !== n.node.attrs.value && n.updateAttributes({
|
|
103
|
+
value: e,
|
|
104
|
+
keyword: T(e, a) ? S(e, a) : ""
|
|
105
|
+
}), w.value = !1;
|
|
106
|
+
}
|
|
107
|
+
function N(e) {
|
|
108
|
+
e.key === "Enter" ? (e.preventDefault(), M()) : e.key === "Escape" && (w.value = !1);
|
|
109
|
+
}
|
|
110
|
+
return (n, a) => (i(), p(y(R), {
|
|
111
|
+
as: "span",
|
|
112
|
+
class: e(v.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: h(v.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: o(() => [w.value ? s((i(), x("input", {
|
|
117
|
+
key: 0,
|
|
118
|
+
ref_key: "inputRef",
|
|
119
|
+
ref: k,
|
|
120
|
+
"onUpdate:modelValue": a[0] ||= (e) => O.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: M,
|
|
124
|
+
onKeydown: N
|
|
125
|
+
}, null, 544)), [[l, O.value]]) : v.value ? (i(), x("span", {
|
|
126
|
+
key: 1,
|
|
127
|
+
role: "button",
|
|
128
|
+
tabindex: "0",
|
|
129
|
+
"aria-label": y(f).mergeTag.editValue,
|
|
130
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
131
|
+
"data-tooltip": t.node.attrs.value,
|
|
132
|
+
onClick: u(j, ["stop"]),
|
|
133
|
+
onKeydown: [b(u(j, ["stop"]), ["enter"]), b(u(j, ["prevent", "stop"]), ["space"])]
|
|
134
|
+
}, r(C.value), 41, z)) : (i(), x("span", {
|
|
135
|
+
key: 2,
|
|
136
|
+
role: "button",
|
|
137
|
+
tabindex: "0",
|
|
138
|
+
"aria-label": y(f).mergeTag.editValue,
|
|
139
|
+
onClick: u(j, ["stop"]),
|
|
140
|
+
onKeydown: [b(u(j, ["stop"]), ["enter"]), b(u(j, ["prevent", "stop"]), ["space"])]
|
|
141
|
+
}, r(t.node.attrs.value), 41, B)), v.value ? (i(), x("button", {
|
|
142
|
+
key: 3,
|
|
143
|
+
type: "button",
|
|
144
|
+
"aria-label": y(f).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: a[1] ||= u((...e) => t.deleteNode && t.deleteNode(...e), ["stop", "prevent"])
|
|
148
|
+
}, [...a[2] ||= [m("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
|
+
}, [m("line", {
|
|
157
|
+
x1: "18",
|
|
158
|
+
y1: "6",
|
|
159
|
+
x2: "6",
|
|
160
|
+
y2: "18"
|
|
161
|
+
}), m("line", {
|
|
162
|
+
x1: "6",
|
|
163
|
+
y1: "6",
|
|
164
|
+
x2: "18",
|
|
165
|
+
y2: "18"
|
|
166
|
+
})], -1)]], 8, V)) : c("", !0)]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["class", "style"]));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/extensions/isNodeSelected.ts
|
|
173
|
+
function U(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 W(e) {
|
|
182
|
+
return L(e);
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/extensions/LogicMergeTagNode.ts
|
|
186
|
+
var G = F.create({
|
|
187
|
+
name: "logicMergeTagNode",
|
|
188
|
+
group: "inline",
|
|
189
|
+
inline: !0,
|
|
190
|
+
atom: !0,
|
|
191
|
+
addOptions() {
|
|
192
|
+
return { syntax: w.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 (!T(e.attrs.value, this.options.syntax)) return [
|
|
211
|
+
"span",
|
|
212
|
+
{},
|
|
213
|
+
e.attrs.value
|
|
214
|
+
];
|
|
215
|
+
let n = S(e.attrs.value, this.options.syntax);
|
|
216
|
+
return [
|
|
217
|
+
"span",
|
|
218
|
+
k(t, {
|
|
219
|
+
"data-logic-merge-tag": e.attrs.value,
|
|
220
|
+
"data-keyword": n
|
|
221
|
+
}),
|
|
222
|
+
n
|
|
223
|
+
];
|
|
224
|
+
},
|
|
225
|
+
addNodeView() {
|
|
226
|
+
return W(H);
|
|
227
|
+
},
|
|
228
|
+
addKeyboardShortcuts() {
|
|
229
|
+
return {
|
|
230
|
+
Backspace: () => U(this.editor, this.name),
|
|
231
|
+
Delete: () => U(this.editor, this.name)
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
addInputRules() {
|
|
235
|
+
return [new N({
|
|
236
|
+
find: RegExp(this.options.syntax.logic.source + "$", ""),
|
|
237
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
238
|
+
let r = n[0];
|
|
239
|
+
if (!T(r, this.options.syntax)) return;
|
|
240
|
+
let i = S(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 P({
|
|
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 (!T(r, this.options.syntax)) return;
|
|
254
|
+
let i = S(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
|
+
}), K = [
|
|
263
|
+
"aria-label",
|
|
264
|
+
"data-tooltip",
|
|
265
|
+
"onKeydown"
|
|
266
|
+
], q = ["aria-label"], J = /* @__PURE__ */ t({
|
|
267
|
+
__name: "MergeTagNodeView",
|
|
268
|
+
props: {
|
|
269
|
+
node: {},
|
|
270
|
+
deleteNode: { type: Function },
|
|
271
|
+
updateAttributes: { type: Function }
|
|
272
|
+
},
|
|
273
|
+
setup(e) {
|
|
274
|
+
let t = e, { getMergeTagLabel: n } = D(), { t: a } = E(), c = _(() => n(t.node.attrs.value)), f = d(!1), h = d(""), v = d(null);
|
|
275
|
+
function S() {
|
|
276
|
+
h.value = t.node.attrs.value, f.value = !0, g(() => {
|
|
277
|
+
v.value?.focus(), v.value?.select();
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function C() {
|
|
281
|
+
let e = h.value.trim();
|
|
282
|
+
e && e !== t.node.attrs.value && t.updateAttributes({
|
|
283
|
+
value: e,
|
|
284
|
+
label: n(e)
|
|
285
|
+
}), f.value = !1;
|
|
286
|
+
}
|
|
287
|
+
function w(e) {
|
|
288
|
+
e.key === "Enter" ? (e.preventDefault(), C()) : e.key === "Escape" && (f.value = !1);
|
|
289
|
+
}
|
|
290
|
+
return (t, n) => (i(), p(y(R), {
|
|
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: o(() => [f.value ? s((i(), x("input", {
|
|
297
|
+
key: 0,
|
|
298
|
+
ref_key: "inputRef",
|
|
299
|
+
ref: v,
|
|
300
|
+
"onUpdate:modelValue": n[0] ||= (e) => h.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: C,
|
|
304
|
+
onKeydown: w
|
|
305
|
+
}, null, 544)), [[l, h.value]]) : (i(), x("span", {
|
|
306
|
+
key: 1,
|
|
307
|
+
role: "button",
|
|
308
|
+
tabindex: "0",
|
|
309
|
+
"aria-label": y(a).mergeTag.editValue,
|
|
310
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
311
|
+
"data-tooltip": e.node.attrs.value,
|
|
312
|
+
onClick: u(S, ["stop"]),
|
|
313
|
+
onKeydown: [b(u(S, ["stop"]), ["enter"]), b(u(S, ["prevent", "stop"]), ["space"])]
|
|
314
|
+
}, r(c.value), 41, K)), m("button", {
|
|
315
|
+
type: "button",
|
|
316
|
+
"aria-label": y(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: n[1] ||= u((...t) => e.deleteNode && e.deleteNode(...t), ["stop", "prevent"])
|
|
320
|
+
}, [...n[2] ||= [m("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
|
+
}, [m("line", {
|
|
329
|
+
x1: "18",
|
|
330
|
+
y1: "6",
|
|
331
|
+
x2: "6",
|
|
332
|
+
y2: "18"
|
|
333
|
+
}), m("line", {
|
|
334
|
+
x1: "6",
|
|
335
|
+
y1: "6",
|
|
336
|
+
x2: "18",
|
|
337
|
+
y2: "18"
|
|
338
|
+
})], -1)]], 8, q)]),
|
|
339
|
+
_: 1
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
}), Y = F.create({
|
|
343
|
+
name: "mergeTagNode",
|
|
344
|
+
group: "inline",
|
|
345
|
+
inline: !0,
|
|
346
|
+
atom: !0,
|
|
347
|
+
addOptions() {
|
|
348
|
+
return {
|
|
349
|
+
mergeTags: [],
|
|
350
|
+
syntax: w.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 n = C(e.attrs.value, this.options.mergeTags);
|
|
370
|
+
return [
|
|
371
|
+
"span",
|
|
372
|
+
k(t, {
|
|
373
|
+
"data-merge-tag": e.attrs.value,
|
|
374
|
+
"data-label": n
|
|
375
|
+
}),
|
|
376
|
+
n
|
|
377
|
+
];
|
|
378
|
+
},
|
|
379
|
+
addNodeView() {
|
|
380
|
+
return W(J);
|
|
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: () => U(this.editor, this.name),
|
|
391
|
+
Delete: () => U(this.editor, this.name)
|
|
392
|
+
};
|
|
393
|
+
},
|
|
394
|
+
addInputRules() {
|
|
395
|
+
return [new N({
|
|
396
|
+
find: RegExp(this.options.syntax.value.source + "$", ""),
|
|
397
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
398
|
+
let r = n[0], i = C(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 P({
|
|
408
|
+
find: new RegExp(this.options.syntax.value.source, "g"),
|
|
409
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
410
|
+
let r = n[0], i = C(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
|
+
//#region ../../node_modules/.pnpm/@tiptap+suggestion@3.22.5_@tiptap+core@3.22.5_@tiptap+pm@3.22.5__@tiptap+pm@3.22.5/node_modules/@tiptap/suggestion/dist/index.js
|
|
421
|
+
function ie(e) {
|
|
422
|
+
let { char: t, allowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, $position: o } = e, s = n && !r, c = O(t), l = RegExp(`\\s${c}$`), u = a ? "^" : "", d = r ? "" : c, f = RegExp(s ? `${u}${c}.*?(?=\\s${d}|$)` : `${u}(?:^)?${c}[^\\s${d}]*`, "gm"), p = o.nodeBefore?.isText && o.nodeBefore.text;
|
|
423
|
+
if (!p) return null;
|
|
424
|
+
let m = o.pos - p.length, h = Array.from(p.matchAll(f)).pop();
|
|
425
|
+
if (!h || h.input === void 0 || h.index === void 0) return null;
|
|
426
|
+
let g = h.input.slice(Math.max(0, h.index - 1), h.index), _ = RegExp(`^[${i?.join("")}\0]?$`).test(g);
|
|
427
|
+
if (i !== null && !_) return null;
|
|
428
|
+
let v = m + h.index, y = v + h[0].length;
|
|
429
|
+
return s && l.test(p.slice(y - 1, y + 1)) && (h[0] += " ", y += 1), v < o.pos && y >= o.pos ? {
|
|
430
|
+
range: {
|
|
431
|
+
from: v,
|
|
432
|
+
to: y
|
|
433
|
+
},
|
|
434
|
+
query: h[0].slice(t.length),
|
|
435
|
+
text: h[0]
|
|
436
|
+
} : null;
|
|
437
|
+
}
|
|
438
|
+
function ae(e) {
|
|
439
|
+
return e.docChanged ? e.steps.some((e) => {
|
|
440
|
+
let t = e.slice;
|
|
441
|
+
if (!t?.content) return !1;
|
|
442
|
+
let n = t.content.textBetween(0, t.content.size, "\n");
|
|
443
|
+
return /\s/.test(n);
|
|
444
|
+
}) : !1;
|
|
445
|
+
}
|
|
446
|
+
var oe = new I("suggestion");
|
|
447
|
+
function se({ pluginKey: e = oe, editor: t, char: n = "@", allowSpaces: r = !1, allowToIncludeChar: i = !1, allowedPrefixes: a = [" "], startOfLine: o = !1, decorationTag: s = "span", decorationClass: c = "suggestion", decorationContent: l = "", decorationEmptyClass: u = "is-empty", command: d = () => null, items: f = () => [], render: p = () => ({}), allow: m = () => !0, findSuggestionMatch: h = ie, shouldShow: g, shouldResetDismissed: _ }) {
|
|
448
|
+
let v, y = p?.(), b = r && !i, x = () => {
|
|
449
|
+
let e = t.state.selection.$anchor.pos, { top: n, right: r, bottom: i, left: a } = t.view.coordsAtPos(e);
|
|
450
|
+
try {
|
|
451
|
+
return new DOMRect(a, n, r - a, i - n);
|
|
452
|
+
} catch {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
}, S = (n, r) => r ? () => {
|
|
456
|
+
let r = e.getState(t.state)?.decorationId;
|
|
457
|
+
return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect() || null;
|
|
458
|
+
} : x, C = ({ match: e, dismissedRange: n, state: r, transaction: i }) => _?.({
|
|
459
|
+
editor: t,
|
|
460
|
+
state: r,
|
|
461
|
+
range: n,
|
|
462
|
+
match: e,
|
|
463
|
+
transaction: i,
|
|
464
|
+
allowSpaces: b
|
|
465
|
+
}) ? !1 : b ? e.range.from === n.from : e.range.from === n.from && !ae(i);
|
|
466
|
+
function w(n, r) {
|
|
467
|
+
var i;
|
|
468
|
+
try {
|
|
469
|
+
let r = e.getState(n.state), a = r?.decorationId ? n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`) : null, o = {
|
|
470
|
+
editor: t,
|
|
471
|
+
range: r?.range || {
|
|
472
|
+
from: 0,
|
|
473
|
+
to: 0
|
|
474
|
+
},
|
|
475
|
+
query: r?.query || null,
|
|
476
|
+
text: r?.text || null,
|
|
477
|
+
items: [],
|
|
478
|
+
command: (e) => d({
|
|
479
|
+
editor: t,
|
|
480
|
+
range: r?.range || {
|
|
481
|
+
from: 0,
|
|
482
|
+
to: 0
|
|
483
|
+
},
|
|
484
|
+
props: e
|
|
485
|
+
}),
|
|
486
|
+
decorationNode: a,
|
|
487
|
+
clientRect: S(n, a)
|
|
488
|
+
};
|
|
489
|
+
(i = y?.onExit) == null || i.call(y, o);
|
|
490
|
+
} catch {}
|
|
491
|
+
let a = n.state.tr.setMeta(r, { exit: !0 });
|
|
492
|
+
n.dispatch(a);
|
|
493
|
+
}
|
|
494
|
+
let T = new j({
|
|
495
|
+
key: e,
|
|
496
|
+
view() {
|
|
497
|
+
return {
|
|
498
|
+
update: async (e, n) => {
|
|
499
|
+
var r, i, a, o, s;
|
|
500
|
+
let c = this.key?.getState(n), l = this.key?.getState(e.state), u = c.active && l.active && c.range.from !== l.range.from, p = !c.active && l.active, m = c.active && !l.active, h = !p && !m && c.query !== l.query, g = p || u && h, _ = h || u, b = m || u && h;
|
|
501
|
+
if (!g && !_ && !b) return;
|
|
502
|
+
let x = b && !g ? c : l, C = e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);
|
|
503
|
+
v = {
|
|
504
|
+
editor: t,
|
|
505
|
+
range: x.range,
|
|
506
|
+
query: x.query,
|
|
507
|
+
text: x.text,
|
|
508
|
+
items: [],
|
|
509
|
+
command: (e) => d({
|
|
510
|
+
editor: t,
|
|
511
|
+
range: x.range,
|
|
512
|
+
props: e
|
|
513
|
+
}),
|
|
514
|
+
decorationNode: C,
|
|
515
|
+
clientRect: S(e, C)
|
|
516
|
+
}, g && ((r = y?.onBeforeStart) == null || r.call(y, v)), _ && ((i = y?.onBeforeUpdate) == null || i.call(y, v)), (_ || g) && (v.items = await f({
|
|
517
|
+
editor: t,
|
|
518
|
+
query: x.query
|
|
519
|
+
})), b && ((a = y?.onExit) == null || a.call(y, v)), _ && ((o = y?.onUpdate) == null || o.call(y, v)), g && ((s = y?.onStart) == null || s.call(y, v));
|
|
520
|
+
},
|
|
521
|
+
destroy: () => {
|
|
522
|
+
var e;
|
|
523
|
+
v && ((e = y?.onExit) == null || e.call(y, v));
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
},
|
|
527
|
+
state: {
|
|
528
|
+
init() {
|
|
529
|
+
return {
|
|
530
|
+
active: !1,
|
|
531
|
+
range: {
|
|
532
|
+
from: 0,
|
|
533
|
+
to: 0
|
|
534
|
+
},
|
|
535
|
+
query: null,
|
|
536
|
+
text: null,
|
|
537
|
+
composing: !1,
|
|
538
|
+
dismissedRange: null
|
|
539
|
+
};
|
|
540
|
+
},
|
|
541
|
+
apply(s, c, l, u) {
|
|
542
|
+
let { isEditable: d } = t, { composing: f } = t.view, { selection: p } = s, { empty: _, from: v } = p, y = { ...c }, b = s.getMeta(e);
|
|
543
|
+
if (b && b.exit) return y.active = !1, y.decorationId = null, y.range = {
|
|
544
|
+
from: 0,
|
|
545
|
+
to: 0
|
|
546
|
+
}, y.query = null, y.text = null, y.dismissedRange = c.active ? { ...c.range } : c.dismissedRange, y;
|
|
547
|
+
if (y.composing = f, s.docChanged && y.dismissedRange !== null && (y.dismissedRange = {
|
|
548
|
+
from: s.mapping.map(y.dismissedRange.from),
|
|
549
|
+
to: s.mapping.map(y.dismissedRange.to)
|
|
550
|
+
}), d && (_ || t.view.composing)) {
|
|
551
|
+
(v < c.range.from || v > c.range.to) && !f && !c.composing && (y.active = !1);
|
|
552
|
+
let e = h({
|
|
553
|
+
char: n,
|
|
554
|
+
allowSpaces: r,
|
|
555
|
+
allowToIncludeChar: i,
|
|
556
|
+
allowedPrefixes: a,
|
|
557
|
+
startOfLine: o,
|
|
558
|
+
$position: p.$from
|
|
559
|
+
}), l = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
560
|
+
e && m({
|
|
561
|
+
editor: t,
|
|
562
|
+
state: u,
|
|
563
|
+
range: e.range,
|
|
564
|
+
isActive: c.active
|
|
565
|
+
}) && (!g || g({
|
|
566
|
+
editor: t,
|
|
567
|
+
range: e.range,
|
|
568
|
+
query: e.query,
|
|
569
|
+
text: e.text,
|
|
570
|
+
transaction: s
|
|
571
|
+
})) ? (y.dismissedRange !== null && !C({
|
|
572
|
+
match: e,
|
|
573
|
+
dismissedRange: y.dismissedRange,
|
|
574
|
+
state: u,
|
|
575
|
+
transaction: s
|
|
576
|
+
}) && (y.dismissedRange = null), y.dismissedRange === null ? (y.active = !0, y.decorationId = c.decorationId ? c.decorationId : l, y.range = e.range, y.query = e.query, y.text = e.text) : y.active = !1) : (e || (y.dismissedRange = null), y.active = !1);
|
|
577
|
+
} else y.active = !1;
|
|
578
|
+
return y.active || (y.decorationId = null, y.range = {
|
|
579
|
+
from: 0,
|
|
580
|
+
to: 0
|
|
581
|
+
}, y.query = null, y.text = null), y;
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
props: {
|
|
585
|
+
handleKeyDown(t, n) {
|
|
586
|
+
var r;
|
|
587
|
+
let { active: i, range: a } = T.getState(t.state);
|
|
588
|
+
if (!i) return !1;
|
|
589
|
+
if (n.key === "Escape" || n.key === "Esc") {
|
|
590
|
+
let i = T.getState(t.state);
|
|
591
|
+
return (r = y?.onKeyDown) == null || r.call(y, {
|
|
592
|
+
view: t,
|
|
593
|
+
event: n,
|
|
594
|
+
range: i.range
|
|
595
|
+
}), w(t, e), !0;
|
|
596
|
+
}
|
|
597
|
+
return (y?.onKeyDown)?.call(y, {
|
|
598
|
+
view: t,
|
|
599
|
+
event: n,
|
|
600
|
+
range: a
|
|
601
|
+
}) || !1;
|
|
602
|
+
},
|
|
603
|
+
decorations(e) {
|
|
604
|
+
let { active: t, range: n, decorationId: r, query: i } = T.getState(e);
|
|
605
|
+
if (!t) return null;
|
|
606
|
+
let a = !i?.length, o = [c];
|
|
607
|
+
return a && o.push(u), ee.create(e.doc, [A.inline(n.from, n.to, {
|
|
608
|
+
nodeName: s,
|
|
609
|
+
class: o.join(" "),
|
|
610
|
+
"data-decoration-id": r,
|
|
611
|
+
"data-decoration-content": l
|
|
612
|
+
})]);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
return T;
|
|
617
|
+
}
|
|
618
|
+
var ce = se, le = ["id"], ue = {
|
|
619
|
+
key: 0,
|
|
620
|
+
class: "tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]",
|
|
621
|
+
"data-testid": "merge-tag-suggestion-empty"
|
|
622
|
+
}, de = [
|
|
623
|
+
"id",
|
|
624
|
+
"aria-selected",
|
|
625
|
+
"data-selected",
|
|
626
|
+
"data-merge-tag-value",
|
|
627
|
+
"onMousedown",
|
|
628
|
+
"onMousemove"
|
|
629
|
+
], X = { class: "tpl:font-medium" }, fe = { class: "tpl:text-[var(--tpl-text-dim)] tpl:font-mono" }, pe = /* @__PURE__ */ t({
|
|
630
|
+
__name: "MergeTagSuggestionList",
|
|
631
|
+
props: {
|
|
632
|
+
items: {},
|
|
633
|
+
selectedIndex: {},
|
|
634
|
+
emptyText: {},
|
|
635
|
+
listId: {}
|
|
636
|
+
},
|
|
637
|
+
emits: ["select", "hover"],
|
|
638
|
+
setup(t) {
|
|
639
|
+
let a = t;
|
|
640
|
+
function o(e) {
|
|
641
|
+
return a.listId ? `${a.listId}-opt-${e}` : void 0;
|
|
642
|
+
}
|
|
643
|
+
return (a, s) => (i(), x("div", {
|
|
644
|
+
id: t.listId,
|
|
645
|
+
class: "tpl:min-w-[200px] tpl:max-w-[320px] tpl:max-h-[50vh] tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:py-1 tpl:shadow-lg",
|
|
646
|
+
role: "listbox",
|
|
647
|
+
"data-testid": "merge-tag-suggestion-list"
|
|
648
|
+
}, [t.items.length === 0 ? (i(), x("div", ue, r(t.emptyText), 1)) : c("", !0), (i(!0), x(f, null, n(t.items, (n, s) => (i(), x("button", {
|
|
649
|
+
key: n.value,
|
|
650
|
+
id: o(s),
|
|
651
|
+
type: "button",
|
|
652
|
+
role: "option",
|
|
653
|
+
"aria-selected": s === t.selectedIndex,
|
|
654
|
+
"data-selected": s === t.selectedIndex ? "true" : "false",
|
|
655
|
+
"data-merge-tag-value": n.value,
|
|
656
|
+
class: e(["tpl:flex tpl:w-full tpl:flex-col tpl:items-start tpl:gap-0.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors", s === t.selectedIndex ? "tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]" : "tpl:text-[var(--tpl-text)] hover:tpl:bg-[var(--tpl-bg-hover)]"]),
|
|
657
|
+
onMousedown: u((e) => a.$emit("select", n), ["prevent", "stop"]),
|
|
658
|
+
onMousemove: (e) => s !== t.selectedIndex && a.$emit("hover", s)
|
|
659
|
+
}, [m("span", X, r(n.label), 1), m("span", fe, r(n.value), 1)], 42, de))), 128))], 8, le));
|
|
660
|
+
}
|
|
661
|
+
}), Z = 10, me = 0;
|
|
662
|
+
function Q(e, t) {
|
|
663
|
+
let n = t.trim().toLowerCase();
|
|
664
|
+
return n === "" ? e.slice(0, Z) : e.filter((e) => {
|
|
665
|
+
let t = e.label.toLowerCase(), r = e.value.toLowerCase();
|
|
666
|
+
return t.includes(n) || r.includes(n);
|
|
667
|
+
}).slice(0, Z);
|
|
668
|
+
}
|
|
669
|
+
function $(e, t, n, r) {
|
|
670
|
+
return t.length === 0 ? e.key === "Enter" || e.key === "Tab" : e.key === "ArrowDown" ? (n.value = (n.value + 1) % t.length, !0) : e.key === "ArrowUp" ? (n.value = (n.value - 1 + t.length) % t.length, !0) : e.key === "Enter" || e.key === "Tab" ? (r(t[n.value]), !0) : !1;
|
|
671
|
+
}
|
|
672
|
+
var he = M.create({
|
|
673
|
+
name: "mergeTagSuggestion",
|
|
674
|
+
addOptions() {
|
|
675
|
+
return {
|
|
676
|
+
mergeTags: [],
|
|
677
|
+
char: "{{",
|
|
678
|
+
emptyText: "No matching merge tags"
|
|
679
|
+
};
|
|
680
|
+
},
|
|
681
|
+
addProseMirrorPlugins() {
|
|
682
|
+
let e = this.options.mergeTags, t = this.options.emptyText, n = {
|
|
683
|
+
char: this.options.char,
|
|
684
|
+
allowSpaces: !1,
|
|
685
|
+
startOfLine: !1,
|
|
686
|
+
allowedPrefixes: null,
|
|
687
|
+
items: ({ query: t }) => Q(e, t),
|
|
688
|
+
command: ({ editor: e, range: t, props: n }) => {
|
|
689
|
+
e.chain().focus().insertContentAt(t, {
|
|
690
|
+
type: "mergeTagNode",
|
|
691
|
+
attrs: {
|
|
692
|
+
label: n.label,
|
|
693
|
+
value: n.value
|
|
694
|
+
}
|
|
695
|
+
}).run();
|
|
696
|
+
},
|
|
697
|
+
render: () => {
|
|
698
|
+
let e = null, n = null, r = null, i = d([]), o = d(0), s = null, c = `tpl-merge-tag-suggestion-${++me}`, l = null, u = [];
|
|
699
|
+
function f() {
|
|
700
|
+
_(l?.() ?? null);
|
|
701
|
+
}
|
|
702
|
+
function p() {
|
|
703
|
+
f(), requestAnimationFrame(f);
|
|
704
|
+
}
|
|
705
|
+
function m(e) {
|
|
706
|
+
let t = [], n = e?.parentElement ?? null;
|
|
707
|
+
for (; n && n !== document.body && n !== document.documentElement;) {
|
|
708
|
+
let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
|
|
709
|
+
/(auto|scroll|overlay)/.test(r) && t.push(n), n = n.parentElement;
|
|
710
|
+
}
|
|
711
|
+
return t;
|
|
712
|
+
}
|
|
713
|
+
function h(e) {
|
|
714
|
+
u = [window, ...m(e)];
|
|
715
|
+
for (let e of u) e.addEventListener("scroll", f, {
|
|
716
|
+
passive: !0,
|
|
717
|
+
capture: !0
|
|
718
|
+
});
|
|
719
|
+
window.addEventListener("resize", f, { passive: !0 });
|
|
720
|
+
}
|
|
721
|
+
function g() {
|
|
722
|
+
for (let e of u) e.removeEventListener("scroll", f, { capture: !0 });
|
|
723
|
+
window.removeEventListener("resize", f), u = [];
|
|
724
|
+
}
|
|
725
|
+
function _(e) {
|
|
726
|
+
if (!n || !e || e.bottom < 0 || e.top > window.innerHeight) return;
|
|
727
|
+
n.style.position = "fixed", n.style.left = `${e.left}px`, n.style.zIndex = "9999", n.style.top = `${e.bottom}px`;
|
|
728
|
+
let t = n.offsetHeight;
|
|
729
|
+
if (t !== 0 && window.innerHeight - e.bottom < t) {
|
|
730
|
+
let r = Math.max(0, e.top - t);
|
|
731
|
+
n.style.top = `${r}px`;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function y(e, t) {
|
|
735
|
+
let n = t?.closest("[data-tpl-theme]");
|
|
736
|
+
if (!n) return;
|
|
737
|
+
let r = n.getAttribute("data-tpl-theme");
|
|
738
|
+
r && e.setAttribute("data-tpl-theme", r);
|
|
739
|
+
let i = window.getComputedStyle(n);
|
|
740
|
+
for (let t = 0; t < i.length; t++) {
|
|
741
|
+
let n = i[t];
|
|
742
|
+
n.startsWith("--tpl-") && e.style.setProperty(n, i.getPropertyValue(n));
|
|
743
|
+
}
|
|
744
|
+
e.style.fontFamily = i.fontFamily, e.style.fontSize = i.fontSize, e.style.lineHeight = i.lineHeight;
|
|
745
|
+
}
|
|
746
|
+
function b(e) {
|
|
747
|
+
r && (e ? (r.setAttribute("role", "combobox"), r.setAttribute("aria-haspopup", "listbox"), r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-controls", c)) : (r.removeAttribute("aria-expanded"), r.removeAttribute("aria-controls"), r.removeAttribute("aria-activedescendant"), r.removeAttribute("aria-haspopup"), r.removeAttribute("role")));
|
|
748
|
+
}
|
|
749
|
+
function x() {
|
|
750
|
+
if (r) {
|
|
751
|
+
if (i.value.length === 0) {
|
|
752
|
+
r.removeAttribute("aria-activedescendant");
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
r.setAttribute("aria-activedescendant", `${c}-opt-${o.value}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function S(e) {
|
|
759
|
+
s?.(e);
|
|
760
|
+
}
|
|
761
|
+
return {
|
|
762
|
+
onStart: (u) => {
|
|
763
|
+
i.value = u.items, o.value = 0, s = (e) => u.command(e), n = document.createElement("div"), n.setAttribute("data-testid", "merge-tag-suggestion-popup");
|
|
764
|
+
let d = u.editor.view?.dom;
|
|
765
|
+
r = d ?? null, y(n, d ?? null), document.body.appendChild(n), e = v({ render() {
|
|
766
|
+
return a(pe, {
|
|
767
|
+
items: i.value,
|
|
768
|
+
selectedIndex: o.value,
|
|
769
|
+
emptyText: t,
|
|
770
|
+
listId: c,
|
|
771
|
+
onSelect: (e) => S(e),
|
|
772
|
+
onHover: (e) => {
|
|
773
|
+
o.value = e, x();
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
} }), e.mount(n), b(!0), x(), l = u.clientRect ?? null, p(), h(d ?? null);
|
|
777
|
+
},
|
|
778
|
+
onUpdate: (e) => {
|
|
779
|
+
i.value = e.items, o.value >= e.items.length && (o.value = 0), s = (t) => e.command(t), x(), l = e.clientRect ?? null, p();
|
|
780
|
+
},
|
|
781
|
+
onKeyDown: (e) => {
|
|
782
|
+
if (e.event.key === "Escape") return !0;
|
|
783
|
+
let t = $(e.event, i.value, o, S);
|
|
784
|
+
return t && x(), t;
|
|
785
|
+
},
|
|
786
|
+
onExit: () => {
|
|
787
|
+
g(), b(!1), e?.unmount(), n?.remove(), e = null, n = null, r = null, s = null, l = null;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
return [ce({
|
|
793
|
+
editor: this.editor,
|
|
794
|
+
...n
|
|
795
|
+
})];
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
//#endregion
|
|
799
|
+
export { te as FontSize, ne as LetterSpacing, re as LineHeight, G as LogicMergeTagNode, Y as MergeTagNode, he as MergeTagSuggestion, Q as filterMergeTags, $ as handleSuggestionKeyDown };
|