@templatical/editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AiChatSidebar-0vx9TP5B.js +305 -0
- package/dist/AiFeatureMenu-CI-v74ND.js +69 -0
- package/dist/CloudEditor-Wdfv_9xn.js +1132 -0
- package/dist/CollaboratorBar-B3uV4Wtw.js +89 -0
- package/dist/CommentsSidebar-PVUlloyB.js +655 -0
- package/dist/DesignReferenceSidebar-DAlAWrxU.js +351 -0
- package/dist/ModuleBrowserModal-1JEcChd8.js +323 -0
- package/dist/ModulePreviewCanvas-Cdp484Ae.js +169 -0
- package/dist/SaveModuleDialog-eNyr3XKn.js +168 -0
- package/dist/SnapshotHistory-D-ZiIj1v.js +169 -0
- package/dist/TemplateScoringPanel-DSZPo15C.js +385 -0
- package/dist/TestEmailModal-Cwre5elw.js +128 -0
- package/dist/TextEditor-BuUOIByX.js +780 -0
- package/dist/de-BWIAblxs.js +685 -0
- package/dist/en-cYyUzNV1.js +685 -0
- package/dist/index-0tWUczNu.js +47 -0
- package/dist/index-4okvXjqk.js +41 -0
- package/dist/index-BSc6h5zo.js +967 -0
- package/dist/index-CrvwWlhN.js +41 -0
- package/dist/index-D-iD-7lO.js +10961 -0
- package/dist/index-D-ygXbc8.js +2452 -0
- package/dist/index-DbrWKz-e.js +1415 -0
- package/dist/index-DeUeHy6g.js +422 -0
- package/dist/index-Ude6e9RU.js +41 -0
- package/dist/index-ZQzHBwkr.js +12767 -0
- package/dist/liquid.browser-CeNxS2GL.js +3493 -0
- package/dist/loader-circle-tM9j2mRh.js +13 -0
- package/dist/shield-check-Ngi9jAQc.js +20 -0
- package/dist/templatical-editor.css +1 -0
- package/dist/templatical-editor.js +9 -0
- package/dist/templatical-editor.umd.cjs +600 -0
- package/package.json +64 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { defineComponent as N, computed as T, ref as m, openBlock as d, createBlock as V, unref as R, normalizeStyle as z, normalizeClass as H, withCtx as E, withDirectives as C, createElementBlock as y, vModelText as L, withModifiers as x, toDisplayString as M, createElementVNode as g, createCommentVNode as I, nextTick as B } from "vue";
|
|
2
|
+
import { w as S } from "./index-D-iD-7lO.js";
|
|
3
|
+
import { isLogicMergeTagValue as w, getLogicMergeTagKeyword as h, SYNTAX_PRESETS as A, getMergeTagLabel as k } from "@templatical/types";
|
|
4
|
+
import { NodeViewWrapper as K, VueNodeViewRenderer as $ } from "./index-D-ygXbc8.js";
|
|
5
|
+
import { N as D, v as F, I as P, m as W } from "./index-ZQzHBwkr.js";
|
|
6
|
+
const j = ["data-tooltip"], q = /* @__PURE__ */ N({
|
|
7
|
+
__name: "LogicMergeTagNodeView",
|
|
8
|
+
props: {
|
|
9
|
+
node: {},
|
|
10
|
+
editor: {},
|
|
11
|
+
getPos: { type: Function },
|
|
12
|
+
deleteNode: { type: Function },
|
|
13
|
+
updateAttributes: { type: Function }
|
|
14
|
+
},
|
|
15
|
+
setup(t) {
|
|
16
|
+
const n = t, { syntax: e } = S(), s = T(
|
|
17
|
+
() => w(n.node.attrs.value, e)
|
|
18
|
+
), r = T(
|
|
19
|
+
() => h(n.node.attrs.value, e)
|
|
20
|
+
), o = m(!1), l = m(""), v = m(null);
|
|
21
|
+
let f = !1;
|
|
22
|
+
function b() {
|
|
23
|
+
l.value = n.node.attrs.value, f = !1, o.value = !0, B(() => {
|
|
24
|
+
var a, u;
|
|
25
|
+
(a = v.value) == null || a.focus(), (u = v.value) == null || u.select();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function i() {
|
|
29
|
+
if (f)
|
|
30
|
+
return;
|
|
31
|
+
f = !0;
|
|
32
|
+
const a = l.value.trim();
|
|
33
|
+
if (!a) {
|
|
34
|
+
o.value = !1;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
a !== n.node.attrs.value && n.updateAttributes({
|
|
38
|
+
value: a,
|
|
39
|
+
keyword: w(a, e) ? h(a, e) : ""
|
|
40
|
+
}), o.value = !1;
|
|
41
|
+
}
|
|
42
|
+
function p(a) {
|
|
43
|
+
a.key === "Enter" ? (a.preventDefault(), i()) : a.key === "Escape" && (o.value = !1);
|
|
44
|
+
}
|
|
45
|
+
return (a, u) => (d(), V(R(K), {
|
|
46
|
+
as: "span",
|
|
47
|
+
class: H(
|
|
48
|
+
s.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" : ""
|
|
49
|
+
),
|
|
50
|
+
style: z(
|
|
51
|
+
s.value ? "background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);" : ""
|
|
52
|
+
),
|
|
53
|
+
contenteditable: "false"
|
|
54
|
+
}, {
|
|
55
|
+
default: E(() => [
|
|
56
|
+
o.value ? C((d(), y("input", {
|
|
57
|
+
key: 0,
|
|
58
|
+
ref_key: "inputRef",
|
|
59
|
+
ref: v,
|
|
60
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => l.value = c),
|
|
61
|
+
type: "text",
|
|
62
|
+
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",
|
|
63
|
+
style: { color: "var(--tpl-primary)" },
|
|
64
|
+
onBlur: i,
|
|
65
|
+
onKeydown: p
|
|
66
|
+
}, null, 544)), [
|
|
67
|
+
[L, l.value]
|
|
68
|
+
]) : s.value ? (d(), y("span", {
|
|
69
|
+
key: 1,
|
|
70
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
71
|
+
"data-tooltip": t.node.attrs.value,
|
|
72
|
+
onClick: x(b, ["stop"])
|
|
73
|
+
}, M(r.value), 9, j)) : (d(), y("span", {
|
|
74
|
+
key: 2,
|
|
75
|
+
onClick: x(b, ["stop"])
|
|
76
|
+
}, M(t.node.attrs.value), 1)),
|
|
77
|
+
s.value ? (d(), y("button", {
|
|
78
|
+
key: 3,
|
|
79
|
+
type: "button",
|
|
80
|
+
class: "tpl:flex tpl:size-4 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",
|
|
81
|
+
style: { color: "var(--tpl-primary)" },
|
|
82
|
+
contenteditable: "false",
|
|
83
|
+
onClick: u[1] || (u[1] = x(
|
|
84
|
+
//@ts-ignore
|
|
85
|
+
(...c) => t.deleteNode && t.deleteNode(...c),
|
|
86
|
+
["stop", "prevent"]
|
|
87
|
+
)),
|
|
88
|
+
onMouseenter: u[2] || (u[2] = (c) => c.target.style.color = "var(--tpl-danger)"),
|
|
89
|
+
onMouseleave: u[3] || (u[3] = (c) => c.target.style.color = "var(--tpl-primary)")
|
|
90
|
+
}, [...u[4] || (u[4] = [
|
|
91
|
+
g("svg", {
|
|
92
|
+
width: "10",
|
|
93
|
+
height: "10",
|
|
94
|
+
viewBox: "0 0 24 24",
|
|
95
|
+
fill: "none",
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
"stroke-width": "3"
|
|
98
|
+
}, [
|
|
99
|
+
g("line", {
|
|
100
|
+
x1: "18",
|
|
101
|
+
y1: "6",
|
|
102
|
+
x2: "6",
|
|
103
|
+
y2: "18"
|
|
104
|
+
}),
|
|
105
|
+
g("line", {
|
|
106
|
+
x1: "6",
|
|
107
|
+
y1: "6",
|
|
108
|
+
x2: "18",
|
|
109
|
+
y2: "18"
|
|
110
|
+
})
|
|
111
|
+
], -1)
|
|
112
|
+
])], 32)) : I("", !0)
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["class", "style"]));
|
|
116
|
+
}
|
|
117
|
+
}), Z = D.create({
|
|
118
|
+
name: "logicMergeTagNode",
|
|
119
|
+
group: "inline",
|
|
120
|
+
inline: !0,
|
|
121
|
+
atom: !0,
|
|
122
|
+
addOptions() {
|
|
123
|
+
return {
|
|
124
|
+
syntax: A.liquid
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
addAttributes() {
|
|
128
|
+
return {
|
|
129
|
+
value: {
|
|
130
|
+
default: ""
|
|
131
|
+
},
|
|
132
|
+
keyword: {
|
|
133
|
+
default: ""
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
parseHTML() {
|
|
138
|
+
return [
|
|
139
|
+
{
|
|
140
|
+
tag: "span[data-logic-merge-tag]"
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
},
|
|
144
|
+
renderHTML({ node: t, HTMLAttributes: n }) {
|
|
145
|
+
if (!w(t.attrs.value, this.options.syntax))
|
|
146
|
+
return ["span", {}, t.attrs.value];
|
|
147
|
+
const e = h(
|
|
148
|
+
t.attrs.value,
|
|
149
|
+
this.options.syntax
|
|
150
|
+
);
|
|
151
|
+
return [
|
|
152
|
+
"span",
|
|
153
|
+
W(n, {
|
|
154
|
+
"data-logic-merge-tag": t.attrs.value,
|
|
155
|
+
"data-keyword": e
|
|
156
|
+
}),
|
|
157
|
+
e
|
|
158
|
+
];
|
|
159
|
+
},
|
|
160
|
+
addNodeView() {
|
|
161
|
+
return $(q);
|
|
162
|
+
},
|
|
163
|
+
addKeyboardShortcuts() {
|
|
164
|
+
const t = () => {
|
|
165
|
+
const { selection: n } = this.editor.state, { $from: e, $to: s } = n;
|
|
166
|
+
let r = !1;
|
|
167
|
+
if (this.editor.state.doc.nodesBetween(e.pos, s.pos, (l) => {
|
|
168
|
+
if (l.type.name === this.name)
|
|
169
|
+
return r = !0, !1;
|
|
170
|
+
}), r)
|
|
171
|
+
return !0;
|
|
172
|
+
if (e.pos > 0) {
|
|
173
|
+
const l = e.nodeBefore;
|
|
174
|
+
if ((l == null ? void 0 : l.type.name) === this.name)
|
|
175
|
+
return !0;
|
|
176
|
+
}
|
|
177
|
+
const o = e.nodeAfter;
|
|
178
|
+
return (o == null ? void 0 : o.type.name) === this.name;
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
Backspace: () => t(),
|
|
182
|
+
Delete: () => t()
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
addInputRules() {
|
|
186
|
+
const t = new RegExp(this.options.syntax.logic.source + "$", "");
|
|
187
|
+
return [
|
|
188
|
+
new P({
|
|
189
|
+
find: t,
|
|
190
|
+
handler: ({ state: n, range: e, match: s }) => {
|
|
191
|
+
const r = s[0];
|
|
192
|
+
if (!w(r, this.options.syntax))
|
|
193
|
+
return;
|
|
194
|
+
const o = h(
|
|
195
|
+
r,
|
|
196
|
+
this.options.syntax
|
|
197
|
+
), l = this.type.create({
|
|
198
|
+
value: r,
|
|
199
|
+
keyword: o
|
|
200
|
+
});
|
|
201
|
+
n.tr.replaceWith(e.from, e.to, l);
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
];
|
|
205
|
+
},
|
|
206
|
+
addPasteRules() {
|
|
207
|
+
const t = new RegExp(this.options.syntax.logic.source, "g");
|
|
208
|
+
return [
|
|
209
|
+
new F({
|
|
210
|
+
find: t,
|
|
211
|
+
handler: ({ state: n, range: e, match: s }) => {
|
|
212
|
+
const r = s[0];
|
|
213
|
+
if (!w(r, this.options.syntax))
|
|
214
|
+
return;
|
|
215
|
+
const o = h(
|
|
216
|
+
r,
|
|
217
|
+
this.options.syntax
|
|
218
|
+
), l = this.type.create({
|
|
219
|
+
value: r,
|
|
220
|
+
keyword: o
|
|
221
|
+
});
|
|
222
|
+
n.tr.replaceWith(e.from, e.to, l);
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
}), O = ["data-tooltip"], U = /* @__PURE__ */ N({
|
|
228
|
+
__name: "MergeTagNodeView",
|
|
229
|
+
props: {
|
|
230
|
+
node: {},
|
|
231
|
+
deleteNode: { type: Function },
|
|
232
|
+
updateAttributes: { type: Function }
|
|
233
|
+
},
|
|
234
|
+
setup(t) {
|
|
235
|
+
const n = t, { getMergeTagLabel: e } = S(), s = T(() => e(n.node.attrs.value)), r = m(!1), o = m(""), l = m(null);
|
|
236
|
+
function v() {
|
|
237
|
+
o.value = n.node.attrs.value, r.value = !0, B(() => {
|
|
238
|
+
var i, p;
|
|
239
|
+
(i = l.value) == null || i.focus(), (p = l.value) == null || p.select();
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function f() {
|
|
243
|
+
const i = o.value.trim();
|
|
244
|
+
i && i !== n.node.attrs.value && n.updateAttributes({
|
|
245
|
+
value: i,
|
|
246
|
+
label: e(i)
|
|
247
|
+
}), r.value = !1;
|
|
248
|
+
}
|
|
249
|
+
function b(i) {
|
|
250
|
+
i.key === "Enter" ? (i.preventDefault(), f()) : i.key === "Escape" && (r.value = !1);
|
|
251
|
+
}
|
|
252
|
+
return (i, p) => (d(), V(R(K), {
|
|
253
|
+
as: "span",
|
|
254
|
+
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",
|
|
255
|
+
style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)", color: "var(--tpl-primary)" },
|
|
256
|
+
contenteditable: "false"
|
|
257
|
+
}, {
|
|
258
|
+
default: E(() => [
|
|
259
|
+
r.value ? C((d(), y("input", {
|
|
260
|
+
key: 0,
|
|
261
|
+
ref_key: "inputRef",
|
|
262
|
+
ref: l,
|
|
263
|
+
"onUpdate:modelValue": p[0] || (p[0] = (a) => o.value = a),
|
|
264
|
+
type: "text",
|
|
265
|
+
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",
|
|
266
|
+
style: { color: "var(--tpl-primary)" },
|
|
267
|
+
onBlur: f,
|
|
268
|
+
onKeydown: b
|
|
269
|
+
}, null, 544)), [
|
|
270
|
+
[L, o.value]
|
|
271
|
+
]) : (d(), y("span", {
|
|
272
|
+
key: 1,
|
|
273
|
+
class: "tpl-tooltip tpl:cursor-pointer",
|
|
274
|
+
"data-tooltip": t.node.attrs.value,
|
|
275
|
+
onClick: x(v, ["stop"])
|
|
276
|
+
}, M(s.value), 9, O)),
|
|
277
|
+
g("button", {
|
|
278
|
+
type: "button",
|
|
279
|
+
class: "tpl:flex tpl:size-4 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",
|
|
280
|
+
style: { color: "var(--tpl-primary)" },
|
|
281
|
+
contenteditable: "false",
|
|
282
|
+
onClick: p[1] || (p[1] = x(
|
|
283
|
+
//@ts-ignore
|
|
284
|
+
(...a) => t.deleteNode && t.deleteNode(...a),
|
|
285
|
+
["stop", "prevent"]
|
|
286
|
+
)),
|
|
287
|
+
onMouseenter: p[2] || (p[2] = (a) => a.target.style.color = "var(--tpl-danger)"),
|
|
288
|
+
onMouseleave: p[3] || (p[3] = (a) => a.target.style.color = "var(--tpl-primary)")
|
|
289
|
+
}, [...p[4] || (p[4] = [
|
|
290
|
+
g("svg", {
|
|
291
|
+
width: "10",
|
|
292
|
+
height: "10",
|
|
293
|
+
viewBox: "0 0 24 24",
|
|
294
|
+
fill: "none",
|
|
295
|
+
stroke: "currentColor",
|
|
296
|
+
"stroke-width": "3"
|
|
297
|
+
}, [
|
|
298
|
+
g("line", {
|
|
299
|
+
x1: "18",
|
|
300
|
+
y1: "6",
|
|
301
|
+
x2: "6",
|
|
302
|
+
y2: "18"
|
|
303
|
+
}),
|
|
304
|
+
g("line", {
|
|
305
|
+
x1: "6",
|
|
306
|
+
y1: "6",
|
|
307
|
+
x2: "18",
|
|
308
|
+
y2: "18"
|
|
309
|
+
})
|
|
310
|
+
], -1)
|
|
311
|
+
])], 32)
|
|
312
|
+
]),
|
|
313
|
+
_: 1
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
}), _ = D.create({
|
|
317
|
+
name: "mergeTagNode",
|
|
318
|
+
group: "inline",
|
|
319
|
+
inline: !0,
|
|
320
|
+
atom: !0,
|
|
321
|
+
addOptions() {
|
|
322
|
+
return {
|
|
323
|
+
mergeTags: [],
|
|
324
|
+
syntax: A.liquid
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
addAttributes() {
|
|
328
|
+
return {
|
|
329
|
+
label: {
|
|
330
|
+
default: ""
|
|
331
|
+
},
|
|
332
|
+
value: {
|
|
333
|
+
default: ""
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
parseHTML() {
|
|
338
|
+
return [
|
|
339
|
+
{
|
|
340
|
+
tag: "span[data-merge-tag]"
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
},
|
|
344
|
+
renderHTML({ node: t, HTMLAttributes: n }) {
|
|
345
|
+
const e = k(t.attrs.value, this.options.mergeTags);
|
|
346
|
+
return [
|
|
347
|
+
"span",
|
|
348
|
+
W(n, {
|
|
349
|
+
"data-merge-tag": t.attrs.value,
|
|
350
|
+
"data-label": e
|
|
351
|
+
}),
|
|
352
|
+
e
|
|
353
|
+
];
|
|
354
|
+
},
|
|
355
|
+
addNodeView() {
|
|
356
|
+
return $(U);
|
|
357
|
+
},
|
|
358
|
+
addCommands() {
|
|
359
|
+
return {
|
|
360
|
+
insertMergeTag: (t) => ({ commands: n }) => n.insertContent({
|
|
361
|
+
type: this.name,
|
|
362
|
+
attrs: t
|
|
363
|
+
})
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
addKeyboardShortcuts() {
|
|
367
|
+
const t = () => {
|
|
368
|
+
const { selection: n } = this.editor.state, { $from: e, $to: s } = n;
|
|
369
|
+
let r = !1;
|
|
370
|
+
if (this.editor.state.doc.nodesBetween(e.pos, s.pos, (l) => {
|
|
371
|
+
if (l.type.name === this.name)
|
|
372
|
+
return r = !0, !1;
|
|
373
|
+
}), r)
|
|
374
|
+
return !0;
|
|
375
|
+
if (e.pos > 0) {
|
|
376
|
+
const l = e.nodeBefore;
|
|
377
|
+
if ((l == null ? void 0 : l.type.name) === this.name)
|
|
378
|
+
return !0;
|
|
379
|
+
}
|
|
380
|
+
const o = e.nodeAfter;
|
|
381
|
+
return (o == null ? void 0 : o.type.name) === this.name;
|
|
382
|
+
};
|
|
383
|
+
return {
|
|
384
|
+
Backspace: () => t(),
|
|
385
|
+
Delete: () => t()
|
|
386
|
+
};
|
|
387
|
+
},
|
|
388
|
+
addInputRules() {
|
|
389
|
+
const t = new RegExp(this.options.syntax.value.source + "$", "");
|
|
390
|
+
return [
|
|
391
|
+
new P({
|
|
392
|
+
find: t,
|
|
393
|
+
handler: ({ state: n, range: e, match: s }) => {
|
|
394
|
+
const r = s[0], o = k(r, this.options.mergeTags), l = this.type.create({
|
|
395
|
+
label: o,
|
|
396
|
+
value: r
|
|
397
|
+
});
|
|
398
|
+
n.tr.replaceWith(e.from, e.to, l);
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
];
|
|
402
|
+
},
|
|
403
|
+
addPasteRules() {
|
|
404
|
+
const t = new RegExp(this.options.syntax.value.source, "g");
|
|
405
|
+
return [
|
|
406
|
+
new F({
|
|
407
|
+
find: t,
|
|
408
|
+
handler: ({ state: n, range: e, match: s }) => {
|
|
409
|
+
const r = s[0], o = k(r, this.options.mergeTags), l = this.type.create({
|
|
410
|
+
label: o,
|
|
411
|
+
value: r
|
|
412
|
+
});
|
|
413
|
+
n.tr.replaceWith(e.from, e.to, l);
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
export {
|
|
420
|
+
Z as LogicMergeTagNode,
|
|
421
|
+
_ as MergeTagNode
|
|
422
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { M as t, m as e } from "./index-ZQzHBwkr.js";
|
|
2
|
+
const u = t.create({
|
|
3
|
+
name: "superscript",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
HTMLAttributes: {}
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
parseHTML() {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
tag: "sup"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
style: "vertical-align",
|
|
16
|
+
getAttrs(r) {
|
|
17
|
+
return r !== "super" ? !1 : null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
},
|
|
22
|
+
renderHTML({ HTMLAttributes: r }) {
|
|
23
|
+
return ["sup", e(this.options.HTMLAttributes, r), 0];
|
|
24
|
+
},
|
|
25
|
+
addCommands() {
|
|
26
|
+
return {
|
|
27
|
+
setSuperscript: () => ({ commands: r }) => r.setMark(this.name),
|
|
28
|
+
toggleSuperscript: () => ({ commands: r }) => r.toggleMark(this.name),
|
|
29
|
+
unsetSuperscript: () => ({ commands: r }) => r.unsetMark(this.name)
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
addKeyboardShortcuts() {
|
|
33
|
+
return {
|
|
34
|
+
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
u as Superscript,
|
|
40
|
+
u as default
|
|
41
|
+
};
|