@templatical/editor 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiChatSidebar-Djjqrmoh.js → AiChatSidebar-Cm5RM5Qh.js} +8 -8
- package/dist/{AiFeatureMenu-DR56EYbL.js → AiFeatureMenu-D4D2Sqfk.js} +6 -6
- package/dist/{BlockIssueBadge-ySMhwDRR.js → BlockIssueBadge-BF4sdsr4.js} +4 -4
- package/dist/{CloudEditor-BLlRKq5D.js → CloudEditor-CLwyq3kf.js} +18 -17
- package/dist/{CollaboratorBar-BlXmZrIj.js → CollaboratorBar-DjX-o5Pi.js} +3 -3
- package/dist/{CommentsSidebar-XcYtqAn8.js → CommentsSidebar-BQJzyCc6.js} +11 -11
- package/dist/{CountdownBlock-sAAv3BHE.js → CountdownBlock-D_AsF4F3.js} +1 -1
- package/dist/{CountdownToolbar-CUvqPILZ.js → CountdownToolbar-BGTkFky9.js} +2 -2
- package/dist/{DesignReferenceSidebar-B0Upq2MY.js → DesignReferenceSidebar-O3epZMXD.js} +6 -6
- package/dist/{IssuesPanel-BvcqQ0ec.js → IssuesPanel-CPBbR8yp.js} +7 -7
- package/dist/{ModuleBrowserModal-BdOB1Lbt.js → ModuleBrowserModal-CVS4Sf7H.js} +9 -9
- package/dist/{ModulePreviewCanvas-BeglLfBF.js → ModulePreviewCanvas-C10YXsL_.js} +2 -2
- package/dist/{NumberWithSuffix-Cb7HI_yW.js → NumberWithSuffix-eI9pPDWT.js} +1 -1
- package/dist/{ParagraphEditor-4Wrd3nnB.js → ParagraphEditor-BKoqcKIt.js} +22 -22
- package/dist/{RichTextEditorContent-D-uKzBDa.js → RichTextEditorContent-Dvn4woIt.js} +6 -6
- package/dist/{SaveModuleDialog-ueFhCVWN.js → SaveModuleDialog-BMuIjxVn.js} +6 -6
- package/dist/{SnapshotHistory-DNuw_gCY.js → SnapshotHistory-DZ5_W7e4.js} +7 -7
- package/dist/{TemplateScoringPanel-bkIhEokb.js → TemplateScoringPanel-Bt5Rsgen.js} +12 -12
- package/dist/{TestEmailModal-Tg30-itu.js → TestEmailModal-EjpH-F-W.js} +4 -4
- package/dist/{TitleEditor-CY8QWbEw.js → TitleEditor-Rv1deuV7.js} +12 -12
- package/dist/{TplModal-D338Vv9U.js → TplModal-DSmCQIm4.js} +3 -3
- package/dist/{blockTypeIcons-CYoPwoH9.js → blockTypeIcons-OhEkQhYj.js} +2 -2
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js → AiFeatureMenu-Dm9CL3u0.js} +4 -4
- package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js.map → AiFeatureMenu-Dm9CL3u0.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js → BlockIssueBadge-DjnFAeWq.js} +4 -4
- package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js.map → BlockIssueBadge-DjnFAeWq.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-gvOOuXac.js → CloudEditor-XSmLmdgp.js} +157 -156
- package/dist/cdn/chunks/CloudEditor-XSmLmdgp.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js → CollaboratorBar-BfoGJhns.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js.map → CollaboratorBar-BfoGJhns.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js → CountdownBlock-GRio55a1.js} +2 -2
- package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js.map → CountdownBlock-GRio55a1.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js → CountdownToolbar-Cd1oEopw.js} +3 -3
- package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js.map → CountdownToolbar-Cd1oEopw.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js → IssuesPanel-C-BiFQDQ.js} +5 -5
- package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js.map → IssuesPanel-C-BiFQDQ.js.map} +1 -1
- package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js → ModuleBrowserModal-Dj7gRT4Q.js} +8 -8
- package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js.map → ModuleBrowserModal-Dj7gRT4Q.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js → ModulePreviewCanvas-hwdveKb0.js} +2 -2
- package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js.map → ModulePreviewCanvas-hwdveKb0.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js → NumberWithSuffix-bE_6cfiA.js} +2 -2
- package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js.map → NumberWithSuffix-bE_6cfiA.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js → ParagraphEditor-y1kGJRBX.js} +48 -48
- package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js.map → ParagraphEditor-y1kGJRBX.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js → RichTextEditorContent-DPy9D4hc.js} +3 -3
- package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js.map → RichTextEditorContent-DPy9D4hc.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js → SaveModuleDialog-CPu5e2VG.js} +4 -4
- package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js.map → SaveModuleDialog-CPu5e2VG.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js → TitleEditor-CMzzOPye.js} +9 -9
- package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js.map → TitleEditor-CMzzOPye.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js → blockTypeIcons-BC5qpvuV.js} +3 -3
- package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js.map → blockTypeIcons-BC5qpvuV.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-2LuW8PHB.js → extensions-DH7ESsaz.js} +22 -22
- package/dist/cdn/chunks/{extensions-2LuW8PHB.js.map → extensions-DH7ESsaz.js.map} +1 -1
- package/dist/cdn/chunks/{features-CxHQG9xr.js → features-DmUOSthI.js} +647 -678
- package/dist/cdn/chunks/features-DmUOSthI.js.map +1 -0
- package/dist/cdn/chunks/{icons-DrsFvnNP.js → icons-DguD4x_X.js} +2 -2
- package/dist/cdn/chunks/{icons-DrsFvnNP.js.map → icons-DguD4x_X.js.map} +1 -1
- package/dist/cdn/chunks/{media-library-CDXkfBa7.js → media-library-ClQUPxRM.js} +71 -71
- package/dist/cdn/chunks/{media-library-CDXkfBa7.js.map → media-library-ClQUPxRM.js.map} +1 -1
- package/dist/cdn/chunks/{quality-HR87TCZc.js → quality-CIw_7cXv.js} +479 -479
- package/dist/cdn/chunks/{quality-HR87TCZc.js.map → quality-CIw_7cXv.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-Dh5WdraW.js → renderer-Bx8I7_Rb.js} +19 -19
- package/dist/cdn/chunks/{renderer-Dh5WdraW.js.map → renderer-Bx8I7_Rb.js.map} +1 -1
- package/dist/cdn/chunks/{src-fyYLC_tY.js → src-C-GlM149.js} +4 -4
- package/dist/cdn/chunks/{src-fyYLC_tY.js.map → src-C-GlM149.js.map} +1 -1
- package/dist/cdn/chunks/{styles-NhU45rEI.js → styles-CfqCvq0Z.js} +666 -635
- package/dist/cdn/chunks/styles-CfqCvq0Z.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-CfnwT9a8.js → tiptap-BAwu9VcJ.js} +4454 -3328
- package/dist/cdn/chunks/tiptap-BAwu9VcJ.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +11 -10
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-B4oiQEsJ.js → check-BsNM6BDs.js} +1 -1
- package/dist/{chevron-down-BrL7CDST.js → chevron-down-fcsZ5DU7.js} +1 -1
- package/dist/{circle-alert-Ddf06I0D.js → circle-alert-BZTbwc-B.js} +1 -1
- package/dist/{clock-CbIkIHL5.js → clock-B7iQRubC.js} +1 -1
- package/dist/{createLucideIcon-Bn5l6hkC.js → createLucideIcon-C_fetdGM.js} +2 -2
- package/dist/{dist-BRvZBY6r.js → dist-B4NkMBYc.js} +2 -2
- package/dist/{dist-DDB4TfTY.js → dist-BLcYl_de.js} +2 -2
- package/dist/{dist-DS9NXb20.js → dist-BOHAk4zI.js} +2 -2
- package/dist/dist-BsB4nPJD.js +5 -0
- package/dist/{dist-B6B8IO1W.js → dist-ByBVNmRN.js} +2 -2
- package/dist/dist-CD3wbUoR.js +5 -0
- package/dist/{dist-DbGsZrPu.js → dist-Cwl7XXr4.js} +806 -601
- package/dist/{dist-BShwEwPy.js → dist-Dem8ODLh.js} +1512 -1501
- package/dist/{dist-BdIM5Jt8.js → dist-Dhs3W2WW.js} +2 -2
- package/dist/{dist-ZiEahccA.js → dist-XdF11ZkX.js} +2 -2
- package/dist/{dist-BhZo8-eC.js → dist-c2sj5PQ5.js} +2 -2
- package/dist/{dist-Ctv43HTN.js → dist-eVlXvuKI.js} +3 -3
- package/dist/extensions-B2lSGCA8.js +1720 -0
- package/dist/{image-up-D3KvvHLf.js → image-up-1xrPPJYH.js} +1 -1
- package/dist/index.d.ts +29 -0
- package/dist/{info-RwcI2EUD.js → info-ByAFxArD.js} +1 -1
- package/dist/keys-DsRdOmg3.js +10 -0
- package/dist/{list-checks-ruqK9lCo.js → list-checks-CKUP4UZU.js} +1 -1
- package/dist/{loader-circle-D4SXJ8eQ.js → loader-circle-BuxX338d.js} +1 -1
- package/dist/{message-circle-p9UiFyS7.js → message-circle-nLwqegRi.js} +1 -1
- package/dist/{refresh-cw-C8HbO4hg.js → refresh-cw-DAkD6iDI.js} +1 -1
- package/dist/{scan-line-CmPIMm63.js → scan-line-DEELRJJ5.js} +1 -1
- package/dist/{send-DacXlri3.js → send-DCMgrNT4.js} +1 -1
- package/dist/{shield-check-BdrHnTnJ.js → shield-check-BFtVr_ov.js} +1 -1
- package/dist/{sparkles-tT7wcus5.js → sparkles-CeYIQ5RJ.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-BmZWc8sc.js → styles-D_ztiOsh.js} +768 -737
- package/dist/templatical-editor.js +6 -5
- package/dist/{text-align-start-DaSSBZVi.js → text-align-start-BsmIoqLS.js} +1 -1
- package/dist/{trash-2-B0uIJOwX.js → trash-2-C2S4-CIH.js} +1 -1
- package/dist/{triangle-alert-FLQWRf-c.js → triangle-alert-DMdedF6W.js} +1 -1
- package/dist/{useCloudI18n-Lh0xWlQ4.js → useCloudI18n-BEuiZdzs.js} +1 -1
- package/dist/{useEditorCore-CMukR8kX.js → useEditorCore-tZGAVvNz.js} +649 -680
- package/dist/{useI18n-CNEz8RK7.js → useI18n-DNspT6uw.js} +1 -1
- package/dist/{useMergeTag-C54tabTK.js → useMergeTag-abutjUud.js} +1 -1
- package/dist/{usePopoverRoot-dvg2XFmj.js → usePopoverRoot-DG3mlvd1.js} +1 -1
- package/dist/{x-BROzFhGs.js → x-_9jw816B.js} +1 -1
- package/package.json +24 -24
- package/dist/cdn/chunks/CloudEditor-gvOOuXac.js.map +0 -1
- package/dist/cdn/chunks/features-CxHQG9xr.js.map +0 -1
- package/dist/cdn/chunks/styles-NhU45rEI.js.map +0 -1
- package/dist/cdn/chunks/tiptap-CfnwT9a8.js.map +0 -1
- package/dist/dist-BVKpiz3S.js +0 -5
- package/dist/dist-BzeOnbU8.js +0 -5
- package/dist/extensions-CqrSpX_i.js +0 -806
- package/dist/keys-DSm2p8zn.js +0 -10
|
@@ -1,806 +0,0 @@
|
|
|
1
|
-
import { A as e, B as t, E as n, M as r, S as i, X as a, a as o, at as s, b as c, c as l, d as u, f as d, h as f, l as p, m, n as h, ot as g, p as _, rt as v, s as y, st as b, z as x } from "./vue.runtime.esm-bundler-mPytWZFh.js";
|
|
2
|
-
import { C as S, D as C, n as w, w as T } from "./dist-D6L_WdRL.js";
|
|
3
|
-
import { t as E } from "./useI18n-CNEz8RK7.js";
|
|
4
|
-
import { t as D } from "./useMergeTag-C54tabTK.js";
|
|
5
|
-
import { F as O, Sn as k, i as A, o as j, p as M, qt as N, u as P, vn as F, xn as ee, yn as I } from "./dist-BShwEwPy.js";
|
|
6
|
-
import { n as L, t as R } from "./dist-BhZo8-eC.js";
|
|
7
|
-
//#region src/extensions/FontSize.ts
|
|
8
|
-
var te = A.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 = A.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 = A.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__ */ c({
|
|
79
|
-
__name: "LogicMergeTagNodeView",
|
|
80
|
-
props: {
|
|
81
|
-
node: {},
|
|
82
|
-
editor: {},
|
|
83
|
-
getPos: { type: Function },
|
|
84
|
-
deleteNode: { type: Function },
|
|
85
|
-
updateAttributes: { type: Function }
|
|
86
|
-
},
|
|
87
|
-
setup(r) {
|
|
88
|
-
let i = r, { syntax: c } = D(), { t: p } = E(), h = u(() => C(i.node.attrs.value, c)), w = u(() => S(i.node.attrs.value, c)), T = a(!1), O = a(""), k = a(null), A = !1;
|
|
89
|
-
function j() {
|
|
90
|
-
O.value = i.node.attrs.value, A = !1, T.value = !0, n(() => {
|
|
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
|
-
T.value = !1;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
e !== i.node.attrs.value && i.updateAttributes({
|
|
103
|
-
value: e,
|
|
104
|
-
keyword: C(e, c) ? S(e, c) : ""
|
|
105
|
-
}), T.value = !1;
|
|
106
|
-
}
|
|
107
|
-
function N(e) {
|
|
108
|
-
e.key === "Enter" ? (e.preventDefault(), M()) : e.key === "Escape" && (T.value = !1);
|
|
109
|
-
}
|
|
110
|
-
return (n, i) => (e(), _(v(R), {
|
|
111
|
-
as: "span",
|
|
112
|
-
class: s(h.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: g(h.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: x(() => [T.value ? t((e(), f("input", {
|
|
117
|
-
key: 0,
|
|
118
|
-
ref_key: "inputRef",
|
|
119
|
-
ref: k,
|
|
120
|
-
"onUpdate:modelValue": i[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)), [[o, O.value]]) : h.value ? (e(), f("span", {
|
|
126
|
-
key: 1,
|
|
127
|
-
role: "button",
|
|
128
|
-
tabindex: "0",
|
|
129
|
-
"aria-label": v(p).mergeTag.editValue,
|
|
130
|
-
class: "tpl-tooltip tpl:cursor-pointer",
|
|
131
|
-
"data-tooltip": r.node.attrs.value,
|
|
132
|
-
onClick: l(j, ["stop"]),
|
|
133
|
-
onKeydown: [y(l(j, ["stop"]), ["enter"]), y(l(j, ["prevent", "stop"]), ["space"])]
|
|
134
|
-
}, b(w.value), 41, z)) : (e(), f("span", {
|
|
135
|
-
key: 2,
|
|
136
|
-
role: "button",
|
|
137
|
-
tabindex: "0",
|
|
138
|
-
"aria-label": v(p).mergeTag.editValue,
|
|
139
|
-
onClick: l(j, ["stop"]),
|
|
140
|
-
onKeydown: [y(l(j, ["stop"]), ["enter"]), y(l(j, ["prevent", "stop"]), ["space"])]
|
|
141
|
-
}, b(r.node.attrs.value), 41, B)), h.value ? (e(), f("button", {
|
|
142
|
-
key: 3,
|
|
143
|
-
type: "button",
|
|
144
|
-
"aria-label": v(p).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: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
|
|
148
|
-
}, [...i[2] ||= [d("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
|
-
}, [d("line", {
|
|
157
|
-
x1: "18",
|
|
158
|
-
y1: "6",
|
|
159
|
-
x2: "6",
|
|
160
|
-
y2: "18"
|
|
161
|
-
}), d("line", {
|
|
162
|
-
x1: "6",
|
|
163
|
-
y1: "6",
|
|
164
|
-
x2: "18",
|
|
165
|
-
y2: "18"
|
|
166
|
-
})], -1)]], 8, V)) : m("", !0)]),
|
|
167
|
-
_: 1
|
|
168
|
-
}, 8, ["class", "style"]));
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/extensions/isNodeSelected.ts
|
|
173
|
-
function U(e, t) {
|
|
174
|
-
let { $from: n, $to: r } = e.state.selection;
|
|
175
|
-
return n.pos === r.pos ? n.pos > 0 && n.nodeBefore?.type.name === t || n.nodeAfter?.type.name === t : !1;
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/extensions/renderVueNodeView.ts
|
|
179
|
-
function W(e) {
|
|
180
|
-
return L(e);
|
|
181
|
-
}
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region src/extensions/LogicMergeTagNode.ts
|
|
184
|
-
var G = P.create({
|
|
185
|
-
name: "logicMergeTagNode",
|
|
186
|
-
group: "inline",
|
|
187
|
-
inline: !0,
|
|
188
|
-
atom: !0,
|
|
189
|
-
addOptions() {
|
|
190
|
-
return { syntax: w.liquid };
|
|
191
|
-
},
|
|
192
|
-
addAttributes() {
|
|
193
|
-
return {
|
|
194
|
-
value: {
|
|
195
|
-
default: "",
|
|
196
|
-
parseHTML: (e) => e.getAttribute("data-logic-merge-tag") || ""
|
|
197
|
-
},
|
|
198
|
-
keyword: {
|
|
199
|
-
default: "",
|
|
200
|
-
parseHTML: (e) => e.getAttribute("data-keyword") || e.textContent || ""
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
},
|
|
204
|
-
parseHTML() {
|
|
205
|
-
return [{ tag: "span[data-logic-merge-tag]" }];
|
|
206
|
-
},
|
|
207
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
208
|
-
if (!C(e.attrs.value, this.options.syntax)) return [
|
|
209
|
-
"span",
|
|
210
|
-
{},
|
|
211
|
-
e.attrs.value
|
|
212
|
-
];
|
|
213
|
-
let n = S(e.attrs.value, this.options.syntax);
|
|
214
|
-
return [
|
|
215
|
-
"span",
|
|
216
|
-
N(t, {
|
|
217
|
-
"data-logic-merge-tag": e.attrs.value,
|
|
218
|
-
"data-keyword": n
|
|
219
|
-
}),
|
|
220
|
-
n
|
|
221
|
-
];
|
|
222
|
-
},
|
|
223
|
-
addNodeView() {
|
|
224
|
-
return W(H);
|
|
225
|
-
},
|
|
226
|
-
addKeyboardShortcuts() {
|
|
227
|
-
return {
|
|
228
|
-
Backspace: () => U(this.editor, this.name),
|
|
229
|
-
Delete: () => U(this.editor, this.name)
|
|
230
|
-
};
|
|
231
|
-
},
|
|
232
|
-
addInputRules() {
|
|
233
|
-
return [new j({
|
|
234
|
-
find: RegExp(this.options.syntax.logic.source + "$", ""),
|
|
235
|
-
handler: ({ state: e, range: t, match: n }) => {
|
|
236
|
-
let r = n[0];
|
|
237
|
-
if (!C(r, this.options.syntax)) return;
|
|
238
|
-
let i = S(r, this.options.syntax), a = this.type.create({
|
|
239
|
-
value: r,
|
|
240
|
-
keyword: i
|
|
241
|
-
});
|
|
242
|
-
e.tr.replaceWith(t.from, t.to, a);
|
|
243
|
-
}
|
|
244
|
-
})];
|
|
245
|
-
},
|
|
246
|
-
addPasteRules() {
|
|
247
|
-
return [new M({
|
|
248
|
-
find: new RegExp(this.options.syntax.logic.source, "g"),
|
|
249
|
-
handler: ({ state: e, range: t, match: n }) => {
|
|
250
|
-
let r = n[0];
|
|
251
|
-
if (!C(r, this.options.syntax)) return;
|
|
252
|
-
let i = S(r, this.options.syntax), a = this.type.create({
|
|
253
|
-
value: r,
|
|
254
|
-
keyword: i
|
|
255
|
-
});
|
|
256
|
-
e.tr.replaceWith(t.from, t.to, a);
|
|
257
|
-
}
|
|
258
|
-
})];
|
|
259
|
-
}
|
|
260
|
-
}), K = [
|
|
261
|
-
"aria-label",
|
|
262
|
-
"data-tooltip",
|
|
263
|
-
"onKeydown"
|
|
264
|
-
], q = ["aria-label"], J = /* @__PURE__ */ c({
|
|
265
|
-
__name: "MergeTagNodeView",
|
|
266
|
-
props: {
|
|
267
|
-
node: {},
|
|
268
|
-
deleteNode: { type: Function },
|
|
269
|
-
updateAttributes: { type: Function }
|
|
270
|
-
},
|
|
271
|
-
setup(r) {
|
|
272
|
-
let i = r, { getMergeTagLabel: s } = D(), { t: c } = E(), p = u(() => s(i.node.attrs.value)), m = a(!1), h = a(""), g = a(null);
|
|
273
|
-
function S() {
|
|
274
|
-
h.value = i.node.attrs.value, m.value = !0, n(() => {
|
|
275
|
-
g.value?.focus(), g.value?.select();
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
function C() {
|
|
279
|
-
let e = h.value.trim();
|
|
280
|
-
e && e !== i.node.attrs.value && i.updateAttributes({
|
|
281
|
-
value: e,
|
|
282
|
-
label: s(e)
|
|
283
|
-
}), m.value = !1;
|
|
284
|
-
}
|
|
285
|
-
function w(e) {
|
|
286
|
-
e.key === "Enter" ? (e.preventDefault(), C()) : e.key === "Escape" && (m.value = !1);
|
|
287
|
-
}
|
|
288
|
-
return (n, i) => (e(), _(v(R), {
|
|
289
|
-
as: "span",
|
|
290
|
-
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)]",
|
|
291
|
-
style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)" },
|
|
292
|
-
contenteditable: "false"
|
|
293
|
-
}, {
|
|
294
|
-
default: x(() => [m.value ? t((e(), f("input", {
|
|
295
|
-
key: 0,
|
|
296
|
-
ref_key: "inputRef",
|
|
297
|
-
ref: g,
|
|
298
|
-
"onUpdate:modelValue": i[0] ||= (e) => h.value = e,
|
|
299
|
-
type: "text",
|
|
300
|
-
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)]",
|
|
301
|
-
onBlur: C,
|
|
302
|
-
onKeydown: w
|
|
303
|
-
}, null, 544)), [[o, h.value]]) : (e(), f("span", {
|
|
304
|
-
key: 1,
|
|
305
|
-
role: "button",
|
|
306
|
-
tabindex: "0",
|
|
307
|
-
"aria-label": v(c).mergeTag.editValue,
|
|
308
|
-
class: "tpl-tooltip tpl:cursor-pointer",
|
|
309
|
-
"data-tooltip": r.node.attrs.value,
|
|
310
|
-
onClick: l(S, ["stop"]),
|
|
311
|
-
onKeydown: [y(l(S, ["stop"]), ["enter"]), y(l(S, ["prevent", "stop"]), ["space"])]
|
|
312
|
-
}, b(p.value), 41, K)), d("button", {
|
|
313
|
-
type: "button",
|
|
314
|
-
"aria-label": v(c).mergeTag.deleteMergeTag,
|
|
315
|
-
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)]",
|
|
316
|
-
contenteditable: "false",
|
|
317
|
-
onClick: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
|
|
318
|
-
}, [...i[2] ||= [d("svg", {
|
|
319
|
-
width: "10",
|
|
320
|
-
height: "10",
|
|
321
|
-
viewBox: "0 0 24 24",
|
|
322
|
-
fill: "none",
|
|
323
|
-
stroke: "currentColor",
|
|
324
|
-
"stroke-width": "3",
|
|
325
|
-
"aria-hidden": "true"
|
|
326
|
-
}, [d("line", {
|
|
327
|
-
x1: "18",
|
|
328
|
-
y1: "6",
|
|
329
|
-
x2: "6",
|
|
330
|
-
y2: "18"
|
|
331
|
-
}), d("line", {
|
|
332
|
-
x1: "6",
|
|
333
|
-
y1: "6",
|
|
334
|
-
x2: "18",
|
|
335
|
-
y2: "18"
|
|
336
|
-
})], -1)]], 8, q)]),
|
|
337
|
-
_: 1
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
|
-
}), Y = P.create({
|
|
341
|
-
name: "mergeTagNode",
|
|
342
|
-
group: "inline",
|
|
343
|
-
inline: !0,
|
|
344
|
-
atom: !0,
|
|
345
|
-
addOptions() {
|
|
346
|
-
return {
|
|
347
|
-
mergeTags: [],
|
|
348
|
-
syntax: w.liquid
|
|
349
|
-
};
|
|
350
|
-
},
|
|
351
|
-
addAttributes() {
|
|
352
|
-
return {
|
|
353
|
-
label: {
|
|
354
|
-
default: "",
|
|
355
|
-
parseHTML: (e) => e.getAttribute("data-label") || e.textContent || ""
|
|
356
|
-
},
|
|
357
|
-
value: {
|
|
358
|
-
default: "",
|
|
359
|
-
parseHTML: (e) => e.getAttribute("data-merge-tag") || ""
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
},
|
|
363
|
-
parseHTML() {
|
|
364
|
-
return [{ tag: "span[data-merge-tag]" }];
|
|
365
|
-
},
|
|
366
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
367
|
-
let n = T(e.attrs.value, this.options.mergeTags);
|
|
368
|
-
return [
|
|
369
|
-
"span",
|
|
370
|
-
N(t, {
|
|
371
|
-
"data-merge-tag": e.attrs.value,
|
|
372
|
-
"data-label": n
|
|
373
|
-
}),
|
|
374
|
-
n
|
|
375
|
-
];
|
|
376
|
-
},
|
|
377
|
-
addNodeView() {
|
|
378
|
-
return W(J);
|
|
379
|
-
},
|
|
380
|
-
addCommands() {
|
|
381
|
-
return { insertMergeTag: (e) => ({ commands: t }) => t.insertContent({
|
|
382
|
-
type: this.name,
|
|
383
|
-
attrs: {
|
|
384
|
-
label: e.label,
|
|
385
|
-
value: e.value
|
|
386
|
-
}
|
|
387
|
-
}) };
|
|
388
|
-
},
|
|
389
|
-
addKeyboardShortcuts() {
|
|
390
|
-
return {
|
|
391
|
-
Backspace: () => U(this.editor, this.name),
|
|
392
|
-
Delete: () => U(this.editor, this.name)
|
|
393
|
-
};
|
|
394
|
-
},
|
|
395
|
-
addInputRules() {
|
|
396
|
-
return [new j({
|
|
397
|
-
find: RegExp(this.options.syntax.value.source + "$", ""),
|
|
398
|
-
handler: ({ state: e, range: t, match: n }) => {
|
|
399
|
-
let r = n[0], i = T(r, this.options.mergeTags), a = this.type.create({
|
|
400
|
-
label: i,
|
|
401
|
-
value: r
|
|
402
|
-
});
|
|
403
|
-
e.tr.replaceWith(t.from, t.to, a);
|
|
404
|
-
}
|
|
405
|
-
})];
|
|
406
|
-
},
|
|
407
|
-
addPasteRules() {
|
|
408
|
-
return [new M({
|
|
409
|
-
find: new RegExp(this.options.syntax.value.source, "g"),
|
|
410
|
-
handler: ({ state: e, range: t, match: n }) => {
|
|
411
|
-
let r = n[0], i = T(r, this.options.mergeTags), a = this.type.create({
|
|
412
|
-
label: i,
|
|
413
|
-
value: r
|
|
414
|
-
});
|
|
415
|
-
e.tr.replaceWith(t.from, t.to, a);
|
|
416
|
-
}
|
|
417
|
-
})];
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
//#endregion
|
|
421
|
-
//#region ../../node_modules/.pnpm/@tiptap+suggestion@3.26.1_@tiptap+core@3.26.1_@tiptap+pm@3.26.1__@tiptap+pm@3.26.1/node_modules/@tiptap/suggestion/dist/index.js
|
|
422
|
-
function ie(e) {
|
|
423
|
-
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;
|
|
424
|
-
if (!p) return null;
|
|
425
|
-
let m = o.pos - p.length, h = Array.from(p.matchAll(f)).pop();
|
|
426
|
-
if (!h || h.input === void 0 || h.index === void 0) return null;
|
|
427
|
-
let g = h.input.slice(Math.max(0, h.index - 1), h.index), _ = RegExp(`^[${i?.join("")}\0]?$`).test(g);
|
|
428
|
-
if (i !== null && !_) return null;
|
|
429
|
-
let v = m + h.index, y = v + h[0].length;
|
|
430
|
-
return s && l.test(p.slice(y - 1, y + 1)) && (h[0] += " ", y += 1), v < o.pos && y >= o.pos ? {
|
|
431
|
-
range: {
|
|
432
|
-
from: v,
|
|
433
|
-
to: y
|
|
434
|
-
},
|
|
435
|
-
query: h[0].slice(t.length),
|
|
436
|
-
text: h[0]
|
|
437
|
-
} : null;
|
|
438
|
-
}
|
|
439
|
-
function ae(e) {
|
|
440
|
-
return e.docChanged ? e.steps.some((e) => {
|
|
441
|
-
let t = e.slice;
|
|
442
|
-
if (!t?.content) return !1;
|
|
443
|
-
let n = t.content.textBetween(0, t.content.size, "\n");
|
|
444
|
-
return /\s/.test(n);
|
|
445
|
-
}) : !1;
|
|
446
|
-
}
|
|
447
|
-
var oe = new k("suggestion");
|
|
448
|
-
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: _ }) {
|
|
449
|
-
let v, y = p?.(), b = r && !i, x = () => {
|
|
450
|
-
let e = t.state.selection.$anchor.pos, { top: n, right: r, bottom: i, left: a } = t.view.coordsAtPos(e);
|
|
451
|
-
try {
|
|
452
|
-
return new DOMRect(a, n, r - a, i - n);
|
|
453
|
-
} catch {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
}, S = (n, r) => r ? () => {
|
|
457
|
-
let r = e.getState(t.state)?.decorationId;
|
|
458
|
-
return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect() || null;
|
|
459
|
-
} : x, C = ({ match: e, dismissedRange: n, state: r, transaction: i }) => _?.({
|
|
460
|
-
editor: t,
|
|
461
|
-
state: r,
|
|
462
|
-
range: n,
|
|
463
|
-
match: e,
|
|
464
|
-
transaction: i,
|
|
465
|
-
allowSpaces: b
|
|
466
|
-
}) ? !1 : b ? e.range.from === n.from : e.range.from === n.from && !ae(i);
|
|
467
|
-
function w(n, r) {
|
|
468
|
-
var i;
|
|
469
|
-
try {
|
|
470
|
-
let r = e.getState(n.state), a = r?.decorationId ? n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`) : null, o = {
|
|
471
|
-
editor: t,
|
|
472
|
-
range: r?.range || {
|
|
473
|
-
from: 0,
|
|
474
|
-
to: 0
|
|
475
|
-
},
|
|
476
|
-
query: r?.query || null,
|
|
477
|
-
text: r?.text || null,
|
|
478
|
-
items: [],
|
|
479
|
-
command: (e) => d({
|
|
480
|
-
editor: t,
|
|
481
|
-
range: r?.range || {
|
|
482
|
-
from: 0,
|
|
483
|
-
to: 0
|
|
484
|
-
},
|
|
485
|
-
props: e
|
|
486
|
-
}),
|
|
487
|
-
decorationNode: a,
|
|
488
|
-
clientRect: S(n, a)
|
|
489
|
-
};
|
|
490
|
-
(i = y?.onExit) == null || i.call(y, o);
|
|
491
|
-
} catch {}
|
|
492
|
-
let a = n.state.tr.setMeta(r, { exit: !0 });
|
|
493
|
-
n.dispatch(a);
|
|
494
|
-
}
|
|
495
|
-
let T = new ee({
|
|
496
|
-
key: e,
|
|
497
|
-
view() {
|
|
498
|
-
return {
|
|
499
|
-
update: async (e, n) => {
|
|
500
|
-
var r, i, a, o, s;
|
|
501
|
-
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;
|
|
502
|
-
if (!g && !_ && !b) return;
|
|
503
|
-
let x = b && !g ? c : l, C = e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);
|
|
504
|
-
v = {
|
|
505
|
-
editor: t,
|
|
506
|
-
range: x.range,
|
|
507
|
-
query: x.query,
|
|
508
|
-
text: x.text,
|
|
509
|
-
items: [],
|
|
510
|
-
command: (e) => d({
|
|
511
|
-
editor: t,
|
|
512
|
-
range: x.range,
|
|
513
|
-
props: e
|
|
514
|
-
}),
|
|
515
|
-
decorationNode: C,
|
|
516
|
-
clientRect: S(e, C)
|
|
517
|
-
}, g && ((r = y?.onBeforeStart) == null || r.call(y, v)), _ && ((i = y?.onBeforeUpdate) == null || i.call(y, v)), (_ || g) && (v.items = await f({
|
|
518
|
-
editor: t,
|
|
519
|
-
query: x.query
|
|
520
|
-
})), 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));
|
|
521
|
-
},
|
|
522
|
-
destroy: () => {
|
|
523
|
-
var e;
|
|
524
|
-
v && ((e = y?.onExit) == null || e.call(y, v));
|
|
525
|
-
}
|
|
526
|
-
};
|
|
527
|
-
},
|
|
528
|
-
state: {
|
|
529
|
-
init() {
|
|
530
|
-
return {
|
|
531
|
-
active: !1,
|
|
532
|
-
range: {
|
|
533
|
-
from: 0,
|
|
534
|
-
to: 0
|
|
535
|
-
},
|
|
536
|
-
query: null,
|
|
537
|
-
text: null,
|
|
538
|
-
composing: !1,
|
|
539
|
-
dismissedRange: null
|
|
540
|
-
};
|
|
541
|
-
},
|
|
542
|
-
apply(s, c, l, u) {
|
|
543
|
-
let { isEditable: d } = t, { composing: f } = t.view, { selection: p } = s, { empty: _, from: v } = p, y = { ...c }, b = s.getMeta(e);
|
|
544
|
-
if (b && b.exit) return y.active = !1, y.decorationId = null, y.range = {
|
|
545
|
-
from: 0,
|
|
546
|
-
to: 0
|
|
547
|
-
}, y.query = null, y.text = null, y.dismissedRange = c.active ? { ...c.range } : c.dismissedRange, y;
|
|
548
|
-
if (y.composing = f, s.docChanged && y.dismissedRange !== null && (y.dismissedRange = {
|
|
549
|
-
from: s.mapping.map(y.dismissedRange.from),
|
|
550
|
-
to: s.mapping.map(y.dismissedRange.to)
|
|
551
|
-
}), d && (_ || t.view.composing)) {
|
|
552
|
-
(v < c.range.from || v > c.range.to) && !f && !c.composing && (y.active = !1);
|
|
553
|
-
let e = h({
|
|
554
|
-
char: n,
|
|
555
|
-
allowSpaces: r,
|
|
556
|
-
allowToIncludeChar: i,
|
|
557
|
-
allowedPrefixes: a,
|
|
558
|
-
startOfLine: o,
|
|
559
|
-
$position: p.$from
|
|
560
|
-
}), l = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
561
|
-
e && m({
|
|
562
|
-
editor: t,
|
|
563
|
-
state: u,
|
|
564
|
-
range: e.range,
|
|
565
|
-
isActive: c.active
|
|
566
|
-
}) && (!g || g({
|
|
567
|
-
editor: t,
|
|
568
|
-
range: e.range,
|
|
569
|
-
query: e.query,
|
|
570
|
-
text: e.text,
|
|
571
|
-
transaction: s
|
|
572
|
-
})) ? (y.dismissedRange !== null && !C({
|
|
573
|
-
match: e,
|
|
574
|
-
dismissedRange: y.dismissedRange,
|
|
575
|
-
state: u,
|
|
576
|
-
transaction: s
|
|
577
|
-
}) && (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);
|
|
578
|
-
} else y.active = !1;
|
|
579
|
-
return y.active || (y.decorationId = null, y.range = {
|
|
580
|
-
from: 0,
|
|
581
|
-
to: 0
|
|
582
|
-
}, y.query = null, y.text = null), y;
|
|
583
|
-
}
|
|
584
|
-
},
|
|
585
|
-
props: {
|
|
586
|
-
handleKeyDown(t, n) {
|
|
587
|
-
var r;
|
|
588
|
-
let { active: i, range: a } = T.getState(t.state);
|
|
589
|
-
if (!i) return !1;
|
|
590
|
-
if (n.key === "Escape" || n.key === "Esc") {
|
|
591
|
-
let i = T.getState(t.state);
|
|
592
|
-
return (r = y?.onKeyDown) == null || r.call(y, {
|
|
593
|
-
view: t,
|
|
594
|
-
event: n,
|
|
595
|
-
range: i.range
|
|
596
|
-
}), w(t, e), !0;
|
|
597
|
-
}
|
|
598
|
-
return (y?.onKeyDown)?.call(y, {
|
|
599
|
-
view: t,
|
|
600
|
-
event: n,
|
|
601
|
-
range: a
|
|
602
|
-
}) || !1;
|
|
603
|
-
},
|
|
604
|
-
decorations(e) {
|
|
605
|
-
let { active: t, range: n, decorationId: r, query: i } = T.getState(e);
|
|
606
|
-
if (!t) return null;
|
|
607
|
-
let a = !i?.length, o = [c];
|
|
608
|
-
return a && o.push(u), I.create(e.doc, [F.inline(n.from, n.to, {
|
|
609
|
-
nodeName: s,
|
|
610
|
-
class: o.join(" "),
|
|
611
|
-
"data-decoration-id": r,
|
|
612
|
-
"data-decoration-content": l
|
|
613
|
-
})]);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
return T;
|
|
618
|
-
}
|
|
619
|
-
var ce = se, le = ["id"], ue = {
|
|
620
|
-
key: 0,
|
|
621
|
-
class: "tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]",
|
|
622
|
-
"data-testid": "merge-tag-suggestion-empty"
|
|
623
|
-
}, de = [
|
|
624
|
-
"id",
|
|
625
|
-
"aria-selected",
|
|
626
|
-
"data-selected",
|
|
627
|
-
"data-merge-tag-value",
|
|
628
|
-
"onMousedown",
|
|
629
|
-
"onMousemove"
|
|
630
|
-
], X = { class: "tpl:font-medium" }, fe = { class: "tpl:text-[var(--tpl-text-dim)] tpl:font-mono" }, pe = /* @__PURE__ */ c({
|
|
631
|
-
__name: "MergeTagSuggestionList",
|
|
632
|
-
props: {
|
|
633
|
-
items: {},
|
|
634
|
-
selectedIndex: {},
|
|
635
|
-
emptyText: {},
|
|
636
|
-
listId: {}
|
|
637
|
-
},
|
|
638
|
-
emits: ["select", "hover"],
|
|
639
|
-
setup(t) {
|
|
640
|
-
let n = t;
|
|
641
|
-
function i(e) {
|
|
642
|
-
return n.listId ? `${n.listId}-opt-${e}` : void 0;
|
|
643
|
-
}
|
|
644
|
-
return (n, a) => (e(), f("div", {
|
|
645
|
-
id: t.listId,
|
|
646
|
-
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",
|
|
647
|
-
role: "listbox",
|
|
648
|
-
"data-testid": "merge-tag-suggestion-list"
|
|
649
|
-
}, [t.items.length === 0 ? (e(), f("div", ue, b(t.emptyText), 1)) : m("", !0), (e(!0), f(p, null, r(t.items, (r, a) => (e(), f("button", {
|
|
650
|
-
key: r.value,
|
|
651
|
-
id: i(a),
|
|
652
|
-
type: "button",
|
|
653
|
-
role: "option",
|
|
654
|
-
"aria-selected": a === t.selectedIndex,
|
|
655
|
-
"data-selected": a === t.selectedIndex ? "true" : "false",
|
|
656
|
-
"data-merge-tag-value": r.value,
|
|
657
|
-
class: s(["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", a === 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)]"]),
|
|
658
|
-
onMousedown: l((e) => n.$emit("select", r), ["prevent", "stop"]),
|
|
659
|
-
onMousemove: (e) => a !== t.selectedIndex && n.$emit("hover", a)
|
|
660
|
-
}, [d("span", X, b(r.label), 1), d("span", fe, b(r.value), 1)], 42, de))), 128))], 8, le));
|
|
661
|
-
}
|
|
662
|
-
}), Z = 10, me = 0;
|
|
663
|
-
function Q(e, t) {
|
|
664
|
-
let n = t.trim().toLowerCase();
|
|
665
|
-
return n === "" ? e.slice(0, Z) : e.filter((e) => {
|
|
666
|
-
let t = e.label.toLowerCase(), r = e.value.toLowerCase();
|
|
667
|
-
return t.includes(n) || r.includes(n);
|
|
668
|
-
}).slice(0, Z);
|
|
669
|
-
}
|
|
670
|
-
function $(e, t, n, r) {
|
|
671
|
-
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;
|
|
672
|
-
}
|
|
673
|
-
function he(e, t) {
|
|
674
|
-
return () => {
|
|
675
|
-
let n = null, r = null, o = null, s = a([]), c = a(0), l = null, u = `tpl-merge-tag-suggestion-${++me}`, d = null, f = [], p = null;
|
|
676
|
-
function m() {
|
|
677
|
-
b(d?.() ?? null);
|
|
678
|
-
}
|
|
679
|
-
function g() {
|
|
680
|
-
m(), p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
|
|
681
|
-
p = null, m();
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
function _(e) {
|
|
685
|
-
let t = [], n = e?.parentElement ?? null;
|
|
686
|
-
for (; n && n !== document.body && n !== document.documentElement;) {
|
|
687
|
-
let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
|
|
688
|
-
/(auto|scroll|overlay)/.test(r) && t.push(n), n = n.parentElement;
|
|
689
|
-
}
|
|
690
|
-
return t;
|
|
691
|
-
}
|
|
692
|
-
function v(e) {
|
|
693
|
-
f = [window, ..._(e)];
|
|
694
|
-
for (let e of f) e.addEventListener("scroll", m, {
|
|
695
|
-
passive: !0,
|
|
696
|
-
capture: !0
|
|
697
|
-
});
|
|
698
|
-
window.addEventListener("resize", m, { passive: !0 });
|
|
699
|
-
}
|
|
700
|
-
function y() {
|
|
701
|
-
for (let e of f) e.removeEventListener("scroll", m, { capture: !0 });
|
|
702
|
-
window.removeEventListener("resize", m), f = [];
|
|
703
|
-
}
|
|
704
|
-
function b(e) {
|
|
705
|
-
if (!r || !e || e.bottom < 0 || e.top > window.innerHeight) return;
|
|
706
|
-
r.style.position = "fixed", r.style.left = `${e.left}px`, r.style.zIndex = "9999", r.style.top = `${e.bottom}px`;
|
|
707
|
-
let t = r.offsetHeight;
|
|
708
|
-
if (t !== 0 && window.innerHeight - e.bottom < t) {
|
|
709
|
-
let n = Math.max(0, e.top - t);
|
|
710
|
-
r.style.top = `${n}px`;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
function x(e, t) {
|
|
714
|
-
let n = t?.closest("[data-tpl-theme]");
|
|
715
|
-
if (!n) return;
|
|
716
|
-
let r = n.getAttribute("data-tpl-theme");
|
|
717
|
-
r && e.setAttribute("data-tpl-theme", r);
|
|
718
|
-
let i = window.getComputedStyle(n);
|
|
719
|
-
for (let t = 0; t < i.length; t++) {
|
|
720
|
-
let n = i[t];
|
|
721
|
-
n.startsWith("--tpl-") && e.style.setProperty(n, i.getPropertyValue(n));
|
|
722
|
-
}
|
|
723
|
-
e.style.fontFamily = i.fontFamily, e.style.fontSize = i.fontSize, e.style.lineHeight = i.lineHeight;
|
|
724
|
-
}
|
|
725
|
-
function S(e) {
|
|
726
|
-
o && (e ? (o.setAttribute("role", "combobox"), o.setAttribute("aria-haspopup", "listbox"), o.setAttribute("aria-expanded", "true"), o.setAttribute("aria-controls", u)) : (o.removeAttribute("aria-expanded"), o.removeAttribute("aria-controls"), o.removeAttribute("aria-activedescendant"), o.removeAttribute("aria-haspopup"), o.removeAttribute("role")));
|
|
727
|
-
}
|
|
728
|
-
function C() {
|
|
729
|
-
if (o) {
|
|
730
|
-
if (s.value.length === 0) {
|
|
731
|
-
o.removeAttribute("aria-activedescendant");
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
o.setAttribute("aria-activedescendant", `${u}-opt-${c.value}`);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
function w(e) {
|
|
738
|
-
l?.(e);
|
|
739
|
-
}
|
|
740
|
-
return {
|
|
741
|
-
onStart: (a) => {
|
|
742
|
-
s.value = a.items, c.value = 0, l = (e) => a.command(e), r = document.createElement("div"), r.setAttribute("data-testid", "merge-tag-suggestion-popup");
|
|
743
|
-
let f = a.editor.view?.dom;
|
|
744
|
-
o = f ?? null, x(r, f ?? null), (t?.value ?? document.body).appendChild(r), n = h({ render() {
|
|
745
|
-
return i(pe, {
|
|
746
|
-
items: s.value,
|
|
747
|
-
selectedIndex: c.value,
|
|
748
|
-
emptyText: e,
|
|
749
|
-
listId: u,
|
|
750
|
-
onSelect: (e) => w(e),
|
|
751
|
-
onHover: (e) => {
|
|
752
|
-
c.value = e, C();
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
} }), n.mount(r), S(!0), C(), d = a.clientRect ?? null, g(), v(f ?? null);
|
|
756
|
-
},
|
|
757
|
-
onUpdate: (e) => {
|
|
758
|
-
s.value = e.items, c.value >= e.items.length && (c.value = 0), l = (t) => e.command(t), C(), d = e.clientRect ?? null, g();
|
|
759
|
-
},
|
|
760
|
-
onKeyDown: (e) => {
|
|
761
|
-
if (e.event.key === "Escape") return !0;
|
|
762
|
-
let t = $(e.event, s.value, c, w);
|
|
763
|
-
return t && C(), t;
|
|
764
|
-
},
|
|
765
|
-
onExit: () => {
|
|
766
|
-
p !== null && (cancelAnimationFrame(p), p = null), y(), S(!1), n?.unmount(), r?.remove(), n = null, r = null, o = null, l = null, d = null;
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
var ge = A.create({
|
|
772
|
-
name: "mergeTagSuggestion",
|
|
773
|
-
addOptions() {
|
|
774
|
-
return {
|
|
775
|
-
mergeTags: [],
|
|
776
|
-
char: "{{",
|
|
777
|
-
emptyText: "No matching merge tags",
|
|
778
|
-
popoverRoot: null
|
|
779
|
-
};
|
|
780
|
-
},
|
|
781
|
-
addProseMirrorPlugins() {
|
|
782
|
-
let e = this.options.mergeTags, t = this.options.emptyText, n = this.options.popoverRoot, r = {
|
|
783
|
-
char: this.options.char,
|
|
784
|
-
allowSpaces: !1,
|
|
785
|
-
startOfLine: !1,
|
|
786
|
-
allowedPrefixes: null,
|
|
787
|
-
items: ({ query: t }) => Q(e, t),
|
|
788
|
-
command: ({ editor: e, range: t, props: n }) => {
|
|
789
|
-
e.chain().focus().insertContentAt(t, {
|
|
790
|
-
type: "mergeTagNode",
|
|
791
|
-
attrs: {
|
|
792
|
-
label: n.label,
|
|
793
|
-
value: n.value
|
|
794
|
-
}
|
|
795
|
-
}).run();
|
|
796
|
-
},
|
|
797
|
-
render: he(t, n)
|
|
798
|
-
};
|
|
799
|
-
return [ce({
|
|
800
|
-
editor: this.editor,
|
|
801
|
-
...r
|
|
802
|
-
})];
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
//#endregion
|
|
806
|
-
export { te as FontSize, ne as LetterSpacing, re as LineHeight, G as LogicMergeTagNode, Y as MergeTagNode, ge as MergeTagSuggestion, Q as filterMergeTags, $ as handleSuggestionKeyDown };
|