@templatical/editor 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AiChatSidebar-XBj5Rw2l.js +214 -0
- package/dist/AiFeatureMenu-my1mZ9DL.js +63 -0
- package/dist/CloudEditor-BVjgKwq3.js +940 -0
- package/dist/CollaboratorBar-BZq_Gv38.js +91 -0
- package/dist/CommentsSidebar-D9oxqO6l.js +439 -0
- package/dist/DesignReferenceSidebar-CyHq4SWt.js +272 -0
- package/dist/LoadingTrack-vK8W2PJf.js +10 -0
- package/dist/ModuleBrowserModal-Cus2Hdwl.js +205 -0
- package/dist/ModulePreviewCanvas-DaByXKY_.js +106 -0
- package/dist/ParagraphEditor-BSyk5B6S.js +670 -0
- package/dist/RichTextEditorContent-BRpjJ6SV.js +133 -0
- package/dist/SaveModuleDialog-BIZBQrd8.js +122 -0
- package/dist/SnapshotHistory-Ds1-QNbx.js +126 -0
- package/dist/TemplateScoringPanel-C8XSk_Ys.js +249 -0
- package/dist/TestEmailModal-CCVfaFgV.js +94 -0
- package/dist/TitleEditor-V4qaEULF.js +167 -0
- package/dist/TplModal-LT3FXlgs.js +44 -0
- package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
- package/dist/blockTypeIcons-BujoY5Dl.js +126 -0
- package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js +3 -0
- package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js.map +1 -0
- package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js +2 -0
- package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js.map +1 -0
- package/dist/cdn/chunks/TitleEditor-CC3Adjai.js +3 -0
- package/dist/cdn/chunks/TitleEditor-CC3Adjai.js.map +1 -0
- package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
- package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
- package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
- package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
- package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
- package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
- package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
- package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
- package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
- package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
- package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
- package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
- package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
- package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
- package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
- package/dist/cdn/chunks/extensions-BfjbWqOx.js +2 -0
- package/dist/cdn/chunks/extensions-BfjbWqOx.js.map +1 -0
- package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
- package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
- package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
- package/dist/cdn/chunks/styleConstants-UTJ94gco.js +2 -0
- package/dist/cdn/chunks/styleConstants-UTJ94gco.js.map +1 -0
- package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
- package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
- package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js +2 -0
- package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js.map +1 -0
- package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js +2 -0
- package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js.map +1 -0
- package/dist/cdn/editor.css +1 -0
- package/dist/cdn/editor.js +2 -0
- package/dist/cdn/editor.js.map +1 -0
- package/dist/check-B7kDuZmP.js +7 -0
- package/dist/chevron-down-DJLW2Q9Z.js +7 -0
- package/dist/circle-alert-E2vYPs5r.js +25 -0
- package/dist/clock-lWIIQA3C.js +12 -0
- package/dist/de-B4Ob4vCo.js +682 -0
- package/dist/dist-4LiM9FDd.js +35 -0
- package/dist/dist-Bu7veieH.js +776 -0
- package/dist/dist-C1BIRHCQ.js +61 -0
- package/dist/dist-CG-vEqSU.js +314 -0
- package/dist/dist-C_ymrGFi.js +10625 -0
- package/dist/dist-ChAGLpWo.js +35 -0
- package/dist/dist-DNjZKe2Z.js +513 -0
- package/dist/dist-D_HQYSY-.js +189 -0
- package/dist/dist-DkypH7qG.js +5 -0
- package/dist/dist-DmOE-Ubp.js +74 -0
- package/dist/dist-DrvKRSU6.js +47 -0
- package/dist/dist-Dxnd0GRf.js +5 -0
- package/dist/dist-DysAFIPy.js +2054 -0
- package/dist/emojiData-BfWQS72m.js +17 -0
- package/dist/en-YXsspZJG.js +682 -0
- package/dist/extensions-BA4NshZQ.js +420 -0
- package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
- package/dist/i18n-ikyi28RU.js +23 -0
- package/dist/image-up-X4xIq4ea.js +23 -0
- package/dist/keys-8B5MFafK.js +4 -0
- package/dist/liquid.browser-BemTg3sZ.js +3272 -0
- package/dist/loader-circle-BTQQxC3l.js +7 -0
- package/dist/message-circle-Blgm6V_h.js +7 -0
- package/dist/refresh-cw-Bb4PEeW1.js +44 -0
- package/dist/scan-line-7lZPfOdm.js +25 -0
- package/dist/send-C0ltAQrv.js +10 -0
- package/dist/shield-check-f-qv4RKs.js +10 -0
- package/dist/sparkles-KhBCGlqB.js +23 -0
- package/dist/styleConstants-CgtFM9hQ.js +43 -0
- package/dist/styles-hQgJKM4i.js +3406 -0
- package/dist/templatical-editor.css +2 -1
- package/dist/templatical-editor.js +242 -9
- package/dist/templatical-editor.umd.cjs +112 -524
- package/dist/timeouts-CmBrLeZA.js +4 -0
- package/dist/trash-2-OwjZ-guZ.js +25 -0
- package/dist/triangle-alert-DOSRIUYZ.js +17 -0
- package/dist/useEditorCore-DVp5qmtC.js +5552 -0
- package/dist/useI18n-DzH4KXDk.js +17 -0
- package/dist/useMergeTag-D9zQVE-e.js +33 -0
- package/dist/x-CGlq2XQe.js +10 -0
- package/package.json +30 -20
- package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
- package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
- package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
- package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
- package/dist/CommentsSidebar-PVUlloyB.js +0 -655
- package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
- package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
- package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
- package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
- package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
- package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
- package/dist/TestEmailModal-Cwre5elw.js +0 -128
- package/dist/TextEditor-BuUOIByX.js +0 -780
- package/dist/de-BWIAblxs.js +0 -685
- package/dist/en-cYyUzNV1.js +0 -685
- package/dist/index-0tWUczNu.js +0 -47
- package/dist/index-4okvXjqk.js +0 -41
- package/dist/index-BSc6h5zo.js +0 -967
- package/dist/index-CrvwWlhN.js +0 -41
- package/dist/index-D-iD-7lO.js +0 -10961
- package/dist/index-D-ygXbc8.js +0 -2452
- package/dist/index-DbrWKz-e.js +0 -1415
- package/dist/index-DeUeHy6g.js +0 -422
- package/dist/index-Ude6e9RU.js +0 -41
- package/dist/index-ZQzHBwkr.js +0 -12767
- package/dist/liquid.browser-CeNxS2GL.js +0 -3493
- package/dist/loader-circle-tM9j2mRh.js +0 -13
- package/dist/shield-check-Ngi9jAQc.js +0 -20
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Wt as e, c as t } from "./dist-C_ymrGFi.js";
|
|
2
|
+
//#region ../../node_modules/.bun/@tiptap+extension-subscript@3.22.1+ea875cbca4543ce7/node_modules/@tiptap/extension-subscript/dist/index.js
|
|
3
|
+
var n = t.create({
|
|
4
|
+
name: "subscript",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return { HTMLAttributes: {} };
|
|
7
|
+
},
|
|
8
|
+
parseHTML() {
|
|
9
|
+
return [{ tag: "sub" }, {
|
|
10
|
+
style: "vertical-align",
|
|
11
|
+
getAttrs(e) {
|
|
12
|
+
return e === "sub" ? null : !1;
|
|
13
|
+
}
|
|
14
|
+
}];
|
|
15
|
+
},
|
|
16
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
17
|
+
return [
|
|
18
|
+
"sub",
|
|
19
|
+
e(this.options.HTMLAttributes, t),
|
|
20
|
+
0
|
|
21
|
+
];
|
|
22
|
+
},
|
|
23
|
+
addCommands() {
|
|
24
|
+
return {
|
|
25
|
+
setSubscript: () => ({ commands: e }) => e.setMark(this.name),
|
|
26
|
+
toggleSubscript: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
27
|
+
unsetSubscript: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
addKeyboardShortcuts() {
|
|
31
|
+
return { "Mod-,": () => this.editor.commands.toggleSubscript() };
|
|
32
|
+
}
|
|
33
|
+
}), r = n;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { n as Subscript, r as default };
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { F as e } from "./useEditorCore-DVp5qmtC.js";
|
|
2
|
+
import { $ as t, $t as n, A as r, At as i, B as a, Bt as o, C as ee, Ct as te, D as ne, Dt as re, E as ie, Et as ae, F as oe, Ft as se, G as ce, Gt as le, H as ue, Ht as de, I as fe, It as pe, J as me, Jt as he, K as ge, Kt as _e, L as ve, Lt as ye, M as s, Mt as c, N as l, Nt as u, O as d, Ot as f, P as p, Pt as m, Q as h, Qt as g, R as _, Rt as v, S as y, St as b, T as x, Tt as S, U as C, Ut as w, V as T, Vt as E, W as D, Wt as O, X as k, Xt as A, Y as j, Yt as M, Z as N, Zt as P, _ as be, _t as F, a as xe, an as I, at as Se, b as Ce, bt as we, c as Te, cn as Ee, ct as De, d as Oe, dn as ke, dt as Ae, en as je, et as Me, f as L, fn as Ne, ft as Pe, g as Fe, gt as Ie, h as Le, ht as Re, i as ze, in as Be, it as Ve, j as He, jt as Ue, k as We, kt as Ge, l as R, ln as Ke, lt as qe, m as Je, mn as Ye, mt as Xe, n as z, nn as Ze, nt as Qe, o as $e, on as et, ot as tt, p as nt, pn as rt, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tn as mt, tt as ht, u as gt, un as _t, ut as vt, v as yt, vt as bt, w as xt, wt as St, x as Ct, xt as wt, y as B, yt as Tt, z as Et, zt as Dt } from "./dist-C_ymrGFi.js";
|
|
3
|
+
import { customRef as Ot, defineComponent as V, getCurrentInstance as kt, h as H, markRaw as U, nextTick as At, onBeforeUnmount as W, onMounted as jt, provide as G, reactive as Mt, ref as K, render as q, shallowRef as Nt, toRaw as Pt, unref as Ft, watchEffect as It } from "vue";
|
|
4
|
+
//#region ../../node_modules/.bun/@tiptap+vue-3@3.22.1+bbf5de022be137e7/node_modules/@tiptap/vue-3/dist/index.js
|
|
5
|
+
var Lt = /* @__PURE__ */ e({
|
|
6
|
+
CommandManager: () => pt,
|
|
7
|
+
Editor: () => Y,
|
|
8
|
+
EditorContent: () => Rt,
|
|
9
|
+
Extendable: () => st,
|
|
10
|
+
Extension: () => ze,
|
|
11
|
+
Fragment: () => xe,
|
|
12
|
+
InputRule: () => $e,
|
|
13
|
+
MappablePosition: () => ut,
|
|
14
|
+
Mark: () => Te,
|
|
15
|
+
MarkView: () => R,
|
|
16
|
+
MarkViewContent: () => Ht,
|
|
17
|
+
Node: () => gt,
|
|
18
|
+
NodePos: () => Oe,
|
|
19
|
+
NodeView: () => L,
|
|
20
|
+
NodeViewContent: () => zt,
|
|
21
|
+
NodeViewWrapper: () => X,
|
|
22
|
+
PasteRule: () => nt,
|
|
23
|
+
ResizableNodeView: () => Je,
|
|
24
|
+
ResizableNodeview: () => Le,
|
|
25
|
+
Tracker: () => Fe,
|
|
26
|
+
VueMarkView: () => Q,
|
|
27
|
+
VueMarkViewRenderer: () => Ut,
|
|
28
|
+
VueNodeViewRenderer: () => $,
|
|
29
|
+
VueRenderer: () => Z,
|
|
30
|
+
callOrReturn: () => be,
|
|
31
|
+
canInsertNode: () => yt,
|
|
32
|
+
cancelPositionCheck: () => B,
|
|
33
|
+
combineTransactionSteps: () => Ce,
|
|
34
|
+
commands: () => Ct,
|
|
35
|
+
createAtomBlockMarkdownSpec: () => y,
|
|
36
|
+
createBlockMarkdownSpec: () => ee,
|
|
37
|
+
createChainableState: () => xt,
|
|
38
|
+
createDocument: () => x,
|
|
39
|
+
createElement: () => F,
|
|
40
|
+
createInlineMarkdownSpec: () => ie,
|
|
41
|
+
createMappablePosition: () => ne,
|
|
42
|
+
createNodeFromContent: () => d,
|
|
43
|
+
createStyleTag: () => We,
|
|
44
|
+
decodeHtmlEntities: () => r,
|
|
45
|
+
defaultBlockAt: () => He,
|
|
46
|
+
deleteProps: () => s,
|
|
47
|
+
elementFromString: () => l,
|
|
48
|
+
encodeHtmlEntities: () => p,
|
|
49
|
+
escapeForRegEx: () => oe,
|
|
50
|
+
extensions: () => fe,
|
|
51
|
+
findChildren: () => ve,
|
|
52
|
+
findChildrenInRange: () => _,
|
|
53
|
+
findDuplicates: () => Et,
|
|
54
|
+
findParentNode: () => a,
|
|
55
|
+
findParentNodeClosestToPos: () => T,
|
|
56
|
+
flattenExtensions: () => ue,
|
|
57
|
+
fromString: () => C,
|
|
58
|
+
generateHTML: () => D,
|
|
59
|
+
generateJSON: () => ce,
|
|
60
|
+
generateText: () => ge,
|
|
61
|
+
getAttributes: () => at,
|
|
62
|
+
getAttributesFromExtensions: () => me,
|
|
63
|
+
getChangedRanges: () => j,
|
|
64
|
+
getDebugJSON: () => k,
|
|
65
|
+
getExtensionField: () => N,
|
|
66
|
+
getHTMLFromFragment: () => h,
|
|
67
|
+
getMarkAttributes: () => t,
|
|
68
|
+
getMarkRange: () => Me,
|
|
69
|
+
getMarkType: () => ht,
|
|
70
|
+
getMarksBetween: () => Qe,
|
|
71
|
+
getNodeAtPosition: () => lt,
|
|
72
|
+
getNodeAttributes: () => Ve,
|
|
73
|
+
getNodeType: () => Se,
|
|
74
|
+
getRenderedAttributes: () => tt,
|
|
75
|
+
getSchema: () => ft,
|
|
76
|
+
getSchemaByResolvedExtensions: () => De,
|
|
77
|
+
getSchemaTypeByName: () => qe,
|
|
78
|
+
getSchemaTypeNameByName: () => vt,
|
|
79
|
+
getSplittedAttributes: () => Ae,
|
|
80
|
+
getText: () => Pe,
|
|
81
|
+
getTextBetween: () => it,
|
|
82
|
+
getTextContentFromNodes: () => Xe,
|
|
83
|
+
getTextSerializersFromSchema: () => Re,
|
|
84
|
+
getUpdatedPosition: () => Ie,
|
|
85
|
+
h: () => F,
|
|
86
|
+
injectExtensionAttributesToParseRule: () => bt,
|
|
87
|
+
inputRulesPlugin: () => Tt,
|
|
88
|
+
isActive: () => we,
|
|
89
|
+
isAndroid: () => wt,
|
|
90
|
+
isAtEndOfNode: () => b,
|
|
91
|
+
isAtStartOfNode: () => te,
|
|
92
|
+
isEmptyObject: () => St,
|
|
93
|
+
isExtensionRulesEnabled: () => S,
|
|
94
|
+
isFirefox: () => ae,
|
|
95
|
+
isFunction: () => re,
|
|
96
|
+
isList: () => f,
|
|
97
|
+
isMacOS: () => Ge,
|
|
98
|
+
isMarkActive: () => i,
|
|
99
|
+
isNodeActive: () => Ue,
|
|
100
|
+
isNodeEmpty: () => c,
|
|
101
|
+
isNodeSelection: () => u,
|
|
102
|
+
isNumber: () => m,
|
|
103
|
+
isPlainObject: () => se,
|
|
104
|
+
isRegExp: () => pe,
|
|
105
|
+
isSafari: () => ye,
|
|
106
|
+
isString: () => v,
|
|
107
|
+
isTextSelection: () => Dt,
|
|
108
|
+
isiOS: () => o,
|
|
109
|
+
markInputRule: () => E,
|
|
110
|
+
markPasteRule: () => de,
|
|
111
|
+
markViewProps: () => Vt,
|
|
112
|
+
markdown: () => w,
|
|
113
|
+
mergeAttributes: () => O,
|
|
114
|
+
mergeDeep: () => le,
|
|
115
|
+
minMax: () => _e,
|
|
116
|
+
nodeInputRule: () => ot,
|
|
117
|
+
nodePasteRule: () => he,
|
|
118
|
+
nodeViewProps: () => Wt,
|
|
119
|
+
objectIncludes: () => M,
|
|
120
|
+
parseAttributes: () => A,
|
|
121
|
+
parseIndentedBlocks: () => P,
|
|
122
|
+
pasteRulesPlugin: () => g,
|
|
123
|
+
posToDOMRect: () => n,
|
|
124
|
+
removeDuplicates: () => je,
|
|
125
|
+
renderNestedMarkdownContent: () => mt,
|
|
126
|
+
resolveExtensions: () => Ze,
|
|
127
|
+
resolveFocusPosition: () => ct,
|
|
128
|
+
rewriteUnknownContent: () => Be,
|
|
129
|
+
schedulePositionCheck: () => I,
|
|
130
|
+
selectionToInsertionEnd: () => et,
|
|
131
|
+
serializeAttributes: () => dt,
|
|
132
|
+
sortExtensions: () => Ee,
|
|
133
|
+
splitExtensions: () => Ke,
|
|
134
|
+
textInputRule: () => _t,
|
|
135
|
+
textPasteRule: () => ke,
|
|
136
|
+
textblockTypeInputRule: () => Ne,
|
|
137
|
+
updateMarkViewAttributes: () => rt,
|
|
138
|
+
useEditor: () => Bt,
|
|
139
|
+
wrappingInputRule: () => Ye
|
|
140
|
+
});
|
|
141
|
+
function J(e) {
|
|
142
|
+
return Ot((t, n) => ({
|
|
143
|
+
get() {
|
|
144
|
+
return t(), e;
|
|
145
|
+
},
|
|
146
|
+
set(t) {
|
|
147
|
+
e = t, requestAnimationFrame(() => {
|
|
148
|
+
requestAnimationFrame(() => {
|
|
149
|
+
n();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
var Y = class extends z {
|
|
156
|
+
constructor(e = {}) {
|
|
157
|
+
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = J(this.view.state), this.reactiveExtensionStorage = J(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
158
|
+
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
159
|
+
}), U(this);
|
|
160
|
+
}
|
|
161
|
+
get state() {
|
|
162
|
+
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
163
|
+
}
|
|
164
|
+
get storage() {
|
|
165
|
+
return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
|
|
166
|
+
}
|
|
167
|
+
registerPlugin(e, t) {
|
|
168
|
+
let n = super.registerPlugin(e, t);
|
|
169
|
+
return this.reactiveState && (this.reactiveState.value = n), n;
|
|
170
|
+
}
|
|
171
|
+
unregisterPlugin(e) {
|
|
172
|
+
let t = super.unregisterPlugin(e);
|
|
173
|
+
return this.reactiveState && t && (this.reactiveState.value = t), t;
|
|
174
|
+
}
|
|
175
|
+
}, Rt = V({
|
|
176
|
+
name: "EditorContent",
|
|
177
|
+
props: { editor: {
|
|
178
|
+
default: null,
|
|
179
|
+
type: Object
|
|
180
|
+
} },
|
|
181
|
+
setup(e) {
|
|
182
|
+
let t = K(), n = kt();
|
|
183
|
+
return It(() => {
|
|
184
|
+
let r = e.editor;
|
|
185
|
+
r && r.options.element && t.value && At(() => {
|
|
186
|
+
if (!t.value || !r.view.dom?.parentNode) return;
|
|
187
|
+
let e = Ft(t.value);
|
|
188
|
+
t.value.append(...r.view.dom.parentNode.childNodes), r.contentComponent = n.ctx._, n && (r.appContext = {
|
|
189
|
+
...n.appContext,
|
|
190
|
+
provides: n.provides
|
|
191
|
+
}), r.setOptions({ element: e }), r.createNodeViews();
|
|
192
|
+
});
|
|
193
|
+
}), W(() => {
|
|
194
|
+
let t = e.editor;
|
|
195
|
+
t && (t.contentComponent = null, t.appContext = null);
|
|
196
|
+
}), { rootEl: t };
|
|
197
|
+
},
|
|
198
|
+
render() {
|
|
199
|
+
return H("div", { ref: (e) => {
|
|
200
|
+
this.rootEl = e;
|
|
201
|
+
} });
|
|
202
|
+
}
|
|
203
|
+
}), zt = V({
|
|
204
|
+
name: "NodeViewContent",
|
|
205
|
+
props: { as: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: "div"
|
|
208
|
+
} },
|
|
209
|
+
render() {
|
|
210
|
+
return H(this.as, {
|
|
211
|
+
style: { whiteSpace: "pre-wrap" },
|
|
212
|
+
"data-node-view-content": ""
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}), X = V({
|
|
216
|
+
name: "NodeViewWrapper",
|
|
217
|
+
props: { as: {
|
|
218
|
+
type: String,
|
|
219
|
+
default: "div"
|
|
220
|
+
} },
|
|
221
|
+
inject: ["onDragStart", "decorationClasses"],
|
|
222
|
+
render() {
|
|
223
|
+
var e;
|
|
224
|
+
return H(this.as, {
|
|
225
|
+
class: this.decorationClasses,
|
|
226
|
+
style: { whiteSpace: "normal" },
|
|
227
|
+
"data-node-view-wrapper": "",
|
|
228
|
+
onDragstart: this.onDragStart
|
|
229
|
+
}, (e = this.$slots).default?.call(e));
|
|
230
|
+
}
|
|
231
|
+
}), Bt = (e = {}) => {
|
|
232
|
+
let t = Nt();
|
|
233
|
+
return jt(() => {
|
|
234
|
+
t.value = new Y(e);
|
|
235
|
+
}), W(() => {
|
|
236
|
+
var e, n;
|
|
237
|
+
let r = t.value?.view.dom?.parentNode, i = r?.cloneNode(!0);
|
|
238
|
+
(e = r?.parentNode) == null || e.replaceChild(i, r), (n = t.value) == null || n.destroy();
|
|
239
|
+
}), t;
|
|
240
|
+
}, Z = class {
|
|
241
|
+
constructor(e, { props: t = {}, editor: n }) {
|
|
242
|
+
this.destroyed = !1, this.editor = n, this.component = U(e), this.el = document.createElement("div"), this.props = Mt(t), this.renderedComponent = this.renderComponent();
|
|
243
|
+
}
|
|
244
|
+
get element() {
|
|
245
|
+
return this.renderedComponent.el;
|
|
246
|
+
}
|
|
247
|
+
get ref() {
|
|
248
|
+
return this.renderedComponent.vNode?.component?.exposed ? this.renderedComponent.vNode.component.exposed : this.renderedComponent.vNode?.component?.proxy;
|
|
249
|
+
}
|
|
250
|
+
renderComponent() {
|
|
251
|
+
if (this.destroyed) return this.renderedComponent;
|
|
252
|
+
let e = H(this.component, this.props);
|
|
253
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && q(e, this.el), {
|
|
254
|
+
vNode: e,
|
|
255
|
+
destroy: () => {
|
|
256
|
+
this.el && q(null, this.el), this.el = null, e = null;
|
|
257
|
+
},
|
|
258
|
+
el: this.el ? this.el.firstElementChild : null
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
updateProps(e = {}) {
|
|
262
|
+
this.destroyed || (Object.entries(e).forEach(([e, t]) => {
|
|
263
|
+
this.props[e] = t;
|
|
264
|
+
}), this.renderComponent());
|
|
265
|
+
}
|
|
266
|
+
destroy() {
|
|
267
|
+
this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
|
|
268
|
+
}
|
|
269
|
+
}, Vt = {
|
|
270
|
+
editor: {
|
|
271
|
+
type: Object,
|
|
272
|
+
required: !0
|
|
273
|
+
},
|
|
274
|
+
mark: {
|
|
275
|
+
type: Object,
|
|
276
|
+
required: !0
|
|
277
|
+
},
|
|
278
|
+
extension: {
|
|
279
|
+
type: Object,
|
|
280
|
+
required: !0
|
|
281
|
+
},
|
|
282
|
+
inline: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
required: !0
|
|
285
|
+
},
|
|
286
|
+
view: {
|
|
287
|
+
type: Object,
|
|
288
|
+
required: !0
|
|
289
|
+
},
|
|
290
|
+
updateAttributes: {
|
|
291
|
+
type: Function,
|
|
292
|
+
required: !0
|
|
293
|
+
},
|
|
294
|
+
HTMLAttributes: {
|
|
295
|
+
type: Object,
|
|
296
|
+
required: !0
|
|
297
|
+
}
|
|
298
|
+
}, Ht = V({
|
|
299
|
+
name: "MarkViewContent",
|
|
300
|
+
props: { as: {
|
|
301
|
+
type: String,
|
|
302
|
+
default: "span"
|
|
303
|
+
} },
|
|
304
|
+
render() {
|
|
305
|
+
return H(this.as, {
|
|
306
|
+
style: { whiteSpace: "inherit" },
|
|
307
|
+
"data-mark-view-content": ""
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}), Q = class extends R {
|
|
311
|
+
constructor(e, t, n) {
|
|
312
|
+
super(e, t, n);
|
|
313
|
+
let r = {
|
|
314
|
+
...t,
|
|
315
|
+
updateAttributes: this.updateAttributes.bind(this)
|
|
316
|
+
};
|
|
317
|
+
this.renderer = new Z(V({
|
|
318
|
+
extends: { ...e },
|
|
319
|
+
props: Object.keys(r),
|
|
320
|
+
template: this.component.template,
|
|
321
|
+
setup: (t) => e.setup?.call(e, t, { expose: () => void 0 }),
|
|
322
|
+
__scopeId: e.__scopeId,
|
|
323
|
+
__cssModules: e.__cssModules,
|
|
324
|
+
__name: e.__name,
|
|
325
|
+
__file: e.__file
|
|
326
|
+
}), {
|
|
327
|
+
editor: this.editor,
|
|
328
|
+
props: r
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
get dom() {
|
|
332
|
+
return this.renderer.element;
|
|
333
|
+
}
|
|
334
|
+
get contentDOM() {
|
|
335
|
+
return this.dom.querySelector("[data-mark-view-content]");
|
|
336
|
+
}
|
|
337
|
+
updateAttributes(e) {
|
|
338
|
+
let t = Pt(this.mark);
|
|
339
|
+
super.updateAttributes(e, t);
|
|
340
|
+
}
|
|
341
|
+
destroy() {
|
|
342
|
+
this.renderer.destroy();
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
function Ut(e, t = {}) {
|
|
346
|
+
return (n) => n.editor.contentComponent ? new Q(e, n, t) : {};
|
|
347
|
+
}
|
|
348
|
+
var Wt = {
|
|
349
|
+
editor: {
|
|
350
|
+
type: Object,
|
|
351
|
+
required: !0
|
|
352
|
+
},
|
|
353
|
+
node: {
|
|
354
|
+
type: Object,
|
|
355
|
+
required: !0
|
|
356
|
+
},
|
|
357
|
+
decorations: {
|
|
358
|
+
type: Object,
|
|
359
|
+
required: !0
|
|
360
|
+
},
|
|
361
|
+
selected: {
|
|
362
|
+
type: Boolean,
|
|
363
|
+
required: !0
|
|
364
|
+
},
|
|
365
|
+
extension: {
|
|
366
|
+
type: Object,
|
|
367
|
+
required: !0
|
|
368
|
+
},
|
|
369
|
+
getPos: {
|
|
370
|
+
type: Function,
|
|
371
|
+
required: !0
|
|
372
|
+
},
|
|
373
|
+
updateAttributes: {
|
|
374
|
+
type: Function,
|
|
375
|
+
required: !0
|
|
376
|
+
},
|
|
377
|
+
deleteNode: {
|
|
378
|
+
type: Function,
|
|
379
|
+
required: !0
|
|
380
|
+
},
|
|
381
|
+
view: {
|
|
382
|
+
type: Object,
|
|
383
|
+
required: !0
|
|
384
|
+
},
|
|
385
|
+
innerDecorations: {
|
|
386
|
+
type: Object,
|
|
387
|
+
required: !0
|
|
388
|
+
},
|
|
389
|
+
HTMLAttributes: {
|
|
390
|
+
type: Object,
|
|
391
|
+
required: !0
|
|
392
|
+
}
|
|
393
|
+
}, Gt = class extends L {
|
|
394
|
+
constructor() {
|
|
395
|
+
super(...arguments), this.positionCheckCallback = null, this.cachedExtensionWithSyncedStorage = null;
|
|
396
|
+
}
|
|
397
|
+
get extensionWithSyncedStorage() {
|
|
398
|
+
if (!this.cachedExtensionWithSyncedStorage) {
|
|
399
|
+
let e = this.editor, t = this.extension;
|
|
400
|
+
this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) {
|
|
401
|
+
return r === "storage" ? e.storage[t.name] ?? {} : Reflect.get(n, r, i);
|
|
402
|
+
} });
|
|
403
|
+
}
|
|
404
|
+
return this.cachedExtensionWithSyncedStorage;
|
|
405
|
+
}
|
|
406
|
+
mount() {
|
|
407
|
+
let e = {
|
|
408
|
+
editor: this.editor,
|
|
409
|
+
node: this.node,
|
|
410
|
+
decorations: this.decorations,
|
|
411
|
+
innerDecorations: this.innerDecorations,
|
|
412
|
+
view: this.view,
|
|
413
|
+
selected: !1,
|
|
414
|
+
extension: this.extensionWithSyncedStorage,
|
|
415
|
+
HTMLAttributes: this.HTMLAttributes,
|
|
416
|
+
getPos: () => this.getPos(),
|
|
417
|
+
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
418
|
+
deleteNode: () => this.deleteNode()
|
|
419
|
+
}, t = this.onDragStart.bind(this);
|
|
420
|
+
this.decorationClasses = K(this.getDecorationClasses());
|
|
421
|
+
let n = V({
|
|
422
|
+
extends: { ...this.component },
|
|
423
|
+
props: Object.keys(e),
|
|
424
|
+
template: this.component.template,
|
|
425
|
+
setup: (e) => {
|
|
426
|
+
var n;
|
|
427
|
+
return G("onDragStart", t), G("decorationClasses", this.decorationClasses), (n = this.component).setup?.call(n, e, { expose: () => void 0 });
|
|
428
|
+
},
|
|
429
|
+
__scopeId: this.component.__scopeId,
|
|
430
|
+
__cssModules: this.component.__cssModules,
|
|
431
|
+
__name: this.component.__name,
|
|
432
|
+
__file: this.component.__file
|
|
433
|
+
});
|
|
434
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.currentPos = this.getPos(), this.positionCheckCallback = () => {
|
|
435
|
+
if (!this.renderer) return;
|
|
436
|
+
let e = this.getPos();
|
|
437
|
+
typeof e != "number" || e === this.currentPos || (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }));
|
|
438
|
+
}, I(this.editor, this.positionCheckCallback), this.renderer = new Z(n, {
|
|
439
|
+
editor: this.editor,
|
|
440
|
+
props: e
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
get dom() {
|
|
444
|
+
if (!this.renderer.element || !this.renderer.element.hasAttribute("data-node-view-wrapper")) throw Error("Please use the NodeViewWrapper component for your node view.");
|
|
445
|
+
return this.renderer.element;
|
|
446
|
+
}
|
|
447
|
+
get contentDOM() {
|
|
448
|
+
return this.node.isLeaf ? null : this.dom.querySelector("[data-node-view-content]");
|
|
449
|
+
}
|
|
450
|
+
handleSelectionUpdate() {
|
|
451
|
+
let { from: e, to: t } = this.editor.state.selection, n = this.getPos();
|
|
452
|
+
if (typeof n == "number") if (e <= n && t >= n + this.node.nodeSize) {
|
|
453
|
+
if (this.renderer.props.selected) return;
|
|
454
|
+
this.selectNode();
|
|
455
|
+
} else {
|
|
456
|
+
if (!this.renderer.props.selected) return;
|
|
457
|
+
this.deselectNode();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
update(e, t, n) {
|
|
461
|
+
let r = (e) => {
|
|
462
|
+
this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(e);
|
|
463
|
+
};
|
|
464
|
+
if (typeof this.options.update == "function") {
|
|
465
|
+
let i = this.node, a = this.decorations, o = this.innerDecorations;
|
|
466
|
+
return this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = this.getPos(), this.options.update({
|
|
467
|
+
oldNode: i,
|
|
468
|
+
oldDecorations: a,
|
|
469
|
+
newNode: e,
|
|
470
|
+
newDecorations: t,
|
|
471
|
+
oldInnerDecorations: o,
|
|
472
|
+
innerDecorations: n,
|
|
473
|
+
updateProps: () => r({
|
|
474
|
+
node: e,
|
|
475
|
+
decorations: t,
|
|
476
|
+
innerDecorations: n,
|
|
477
|
+
extension: this.extensionWithSyncedStorage
|
|
478
|
+
})
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
if (e.type !== this.node.type) return !1;
|
|
482
|
+
let i = this.getPos();
|
|
483
|
+
return e === this.node && this.decorations === t && this.innerDecorations === n ? i === this.currentPos ? !0 : (this.currentPos = i, r({
|
|
484
|
+
node: e,
|
|
485
|
+
decorations: t,
|
|
486
|
+
innerDecorations: n,
|
|
487
|
+
extension: this.extensionWithSyncedStorage,
|
|
488
|
+
getPos: () => this.getPos()
|
|
489
|
+
}), !0) : (this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = i, r({
|
|
490
|
+
node: e,
|
|
491
|
+
decorations: t,
|
|
492
|
+
innerDecorations: n,
|
|
493
|
+
extension: this.extensionWithSyncedStorage
|
|
494
|
+
}), !0);
|
|
495
|
+
}
|
|
496
|
+
selectNode() {
|
|
497
|
+
this.renderer.updateProps({ selected: !0 }), this.renderer.element && this.renderer.element.classList.add("ProseMirror-selectednode");
|
|
498
|
+
}
|
|
499
|
+
deselectNode() {
|
|
500
|
+
this.renderer.updateProps({ selected: !1 }), this.renderer.element && this.renderer.element.classList.remove("ProseMirror-selectednode");
|
|
501
|
+
}
|
|
502
|
+
getDecorationClasses() {
|
|
503
|
+
return this.decorations.flatMap((e) => e.type.attrs.class).join(" ");
|
|
504
|
+
}
|
|
505
|
+
destroy() {
|
|
506
|
+
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.positionCheckCallback &&= (B(this.editor, this.positionCheckCallback), null);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
function $(e, t) {
|
|
510
|
+
return (n) => n.editor.contentComponent ? new Gt(typeof e == "function" && "__vccOpts" in e ? e.__vccOpts : e, n, t) : {};
|
|
511
|
+
}
|
|
512
|
+
//#endregion
|
|
513
|
+
export { $ as n, Lt as r, X as t };
|