tiptop-editor 2.3.1 → 2.3.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/tiptop-editor.css +1 -1
- package/dist/tiptop-editor.es.js +161 -146
- package/dist/tiptop-editor.umd.js +9 -9
- package/package.json +1 -1
package/dist/tiptop-editor.es.js
CHANGED
|
@@ -13698,7 +13698,7 @@ var ps = class {
|
|
|
13698
13698
|
...this.config,
|
|
13699
13699
|
addOptions: () => ju(this.options, t)
|
|
13700
13700
|
});
|
|
13701
|
-
return e.name = this.name, e.parent = this.parent, e;
|
|
13701
|
+
return e.name = this.name, e.parent = this.parent, this.child = null, e;
|
|
13702
13702
|
}
|
|
13703
13703
|
extend(t = {}) {
|
|
13704
13704
|
const e = new this.constructor({ ...this.config, ...t });
|
|
@@ -14006,12 +14006,20 @@ var xe = class Bu extends ps {
|
|
|
14006
14006
|
}
|
|
14007
14007
|
}), Sx = xe.create({
|
|
14008
14008
|
name: "tabindex",
|
|
14009
|
+
addOptions() {
|
|
14010
|
+
return {
|
|
14011
|
+
value: void 0
|
|
14012
|
+
};
|
|
14013
|
+
},
|
|
14009
14014
|
addProseMirrorPlugins() {
|
|
14010
14015
|
return [
|
|
14011
14016
|
new _e({
|
|
14012
14017
|
key: new De("tabindex"),
|
|
14013
14018
|
props: {
|
|
14014
|
-
attributes: () =>
|
|
14019
|
+
attributes: () => {
|
|
14020
|
+
var t;
|
|
14021
|
+
return !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: (t = this.options.value) != null ? t : "0" };
|
|
14022
|
+
}
|
|
14015
14023
|
}
|
|
14016
14024
|
})
|
|
14017
14025
|
];
|
|
@@ -14521,21 +14529,24 @@ var Pn = class zu extends ps {
|
|
|
14521
14529
|
}
|
|
14522
14530
|
}
|
|
14523
14531
|
updatePosition() {
|
|
14524
|
-
|
|
14532
|
+
var t, e;
|
|
14533
|
+
if (!((e = (t = this.view) == null ? void 0 : t.dom) != null && e.parentNode))
|
|
14534
|
+
return;
|
|
14535
|
+
const { selection: n } = this.editor.state, r = Fu(this.view, n.from, n.to);
|
|
14525
14536
|
Lo({
|
|
14526
|
-
getBoundingClientRect: () =>
|
|
14527
|
-
getClientRects: () => [
|
|
14537
|
+
getBoundingClientRect: () => r,
|
|
14538
|
+
getClientRects: () => [r]
|
|
14528
14539
|
}, this.element, {
|
|
14529
14540
|
placement: this.floatingUIOptions.placement,
|
|
14530
14541
|
strategy: this.floatingUIOptions.strategy,
|
|
14531
14542
|
middleware: this.middlewares
|
|
14532
|
-
}).then(({ x:
|
|
14533
|
-
var
|
|
14534
|
-
if ((
|
|
14543
|
+
}).then(({ x: s, y: i, strategy: l, middlewareData: a }) => {
|
|
14544
|
+
var c, u;
|
|
14545
|
+
if ((c = a.hide) != null && c.referenceHidden || (u = a.hide) != null && u.escaped) {
|
|
14535
14546
|
this.element.style.visibility = "hidden";
|
|
14536
14547
|
return;
|
|
14537
14548
|
}
|
|
14538
|
-
this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position =
|
|
14549
|
+
this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = l, this.element.style.left = `${s}px`, this.element.style.top = `${i}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
14539
14550
|
});
|
|
14540
14551
|
}
|
|
14541
14552
|
update(t, e) {
|
|
@@ -14975,8 +14986,8 @@ const Qx = ({
|
|
|
14975
14986
|
h,
|
|
14976
14987
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: n }) })
|
|
14977
14988
|
] });
|
|
14978
|
-
}, Ot = w.memo(Qx),
|
|
14979
|
-
lowlight:
|
|
14989
|
+
}, Ot = w.memo(Qx), e0 = Sf(Cf), Yu = Ef.configure({
|
|
14990
|
+
lowlight: e0
|
|
14980
14991
|
}), Xu = kf.extend({
|
|
14981
14992
|
renderHTML() {
|
|
14982
14993
|
return ["div", Xt(this.options.HTMLAttributes, { "data-type": this.name }), ["hr"]];
|
|
@@ -14989,10 +15000,10 @@ const Qx = ({
|
|
|
14989
15000
|
if (!(n instanceof Ne) && !(n instanceof Io)) return !1;
|
|
14990
15001
|
let o = !1;
|
|
14991
15002
|
return r.nodesBetween(n.from, n.to, (s) => s.isText ? (o = !0, !1) : !0), o;
|
|
14992
|
-
},
|
|
15003
|
+
}, t0 = (t) => t.state.selection instanceof Ro, Zu = (t) => [
|
|
14993
15004
|
Yu.name,
|
|
14994
15005
|
Xu.name
|
|
14995
|
-
].some((n) => t.isActive(n)),
|
|
15006
|
+
].some((n) => t.isActive(n)), n0 = (t) => {
|
|
14996
15007
|
const { state: e } = t, { selection: n } = e, r = [
|
|
14997
15008
|
"paragraph",
|
|
14998
15009
|
"code",
|
|
@@ -15005,7 +15016,7 @@ const Qx = ({
|
|
|
15005
15016
|
const o = n.node;
|
|
15006
15017
|
if (o)
|
|
15007
15018
|
return r.includes(o.type.name) && o.textContent;
|
|
15008
|
-
},
|
|
15019
|
+
}, r0 = (t) => {
|
|
15009
15020
|
const { state: e } = t, { selection: n } = e, r = [
|
|
15010
15021
|
"horizontalRule",
|
|
15011
15022
|
"imageUploader"
|
|
@@ -15014,20 +15025,20 @@ const Qx = ({
|
|
|
15014
15025
|
const o = n.node;
|
|
15015
15026
|
if (o)
|
|
15016
15027
|
return !r.includes(o.type.name);
|
|
15017
|
-
},
|
|
15028
|
+
}, o0 = (t) => {
|
|
15018
15029
|
const { state: e } = t, { selection: n } = e;
|
|
15019
15030
|
if (!(n instanceof he)) return;
|
|
15020
15031
|
const r = n.node;
|
|
15021
15032
|
if (!r) return;
|
|
15022
15033
|
let o = !1;
|
|
15023
15034
|
return r.marks.length ? !0 : (r.descendants((s) => s.marks?.length ? (o = !0, !1) : !0), o);
|
|
15024
|
-
},
|
|
15035
|
+
}, s0 = (t) => {
|
|
15025
15036
|
const { state: e } = t, { selection: n } = e;
|
|
15026
15037
|
if (!(n instanceof he)) return;
|
|
15027
15038
|
const r = n.node;
|
|
15028
15039
|
if (r)
|
|
15029
15040
|
return r.textContent.trim().length > 0;
|
|
15030
|
-
},
|
|
15041
|
+
}, i0 = (t) => {
|
|
15031
15042
|
const { selection: e, doc: n } = t;
|
|
15032
15043
|
let r;
|
|
15033
15044
|
if (e instanceof he)
|
|
@@ -15037,7 +15048,7 @@ const Qx = ({
|
|
|
15037
15048
|
r = o.nodeAfter || o.parent;
|
|
15038
15049
|
}
|
|
15039
15050
|
return r ? r.type.name === "imageUploader" && r.attrs?.id && r.attrs?.uploading : !1;
|
|
15040
|
-
},
|
|
15051
|
+
}, l0 = (t) => {
|
|
15041
15052
|
const { state: e } = t, { selection: n, doc: r } = e, o = n instanceof he ? n : he.create(r, n.from), s = o.node, i = o.from;
|
|
15042
15053
|
if (!s) return;
|
|
15043
15054
|
const l = s.toJSON();
|
|
@@ -15049,7 +15060,7 @@ const Qx = ({
|
|
|
15049
15060
|
const a = i + s.nodeSize, c = he.create(t.state.doc, a);
|
|
15050
15061
|
t.view.dispatch(t.state.tr.setSelection(c));
|
|
15051
15062
|
}, 0);
|
|
15052
|
-
},
|
|
15063
|
+
}, a0 = (t) => {
|
|
15053
15064
|
const { state: e } = t, { selection: n } = e;
|
|
15054
15065
|
if (!(n instanceof he)) return;
|
|
15055
15066
|
const r = n.node;
|
|
@@ -15058,7 +15069,7 @@ const Qx = ({
|
|
|
15058
15069
|
o && navigator.clipboard.writeText(o).catch((s) => {
|
|
15059
15070
|
console.error("Failed to copy to clipboard:", s);
|
|
15060
15071
|
});
|
|
15061
|
-
},
|
|
15072
|
+
}, c0 = (t) => {
|
|
15062
15073
|
const { state: e } = t, { selection: n } = e;
|
|
15063
15074
|
if (!(n instanceof he)) return;
|
|
15064
15075
|
const { from: r, to: o } = n, { node: s } = n, { attrs: i } = s;
|
|
@@ -15067,7 +15078,7 @@ const Qx = ({
|
|
|
15067
15078
|
return;
|
|
15068
15079
|
}
|
|
15069
15080
|
t.chain().focus().deleteRange({ from: r, to: o }).run(), t.view.focus();
|
|
15070
|
-
},
|
|
15081
|
+
}, u0 = (t) => {
|
|
15071
15082
|
const { state: e } = t, { selection: n } = e;
|
|
15072
15083
|
if (!(n instanceof he)) return;
|
|
15073
15084
|
const r = n.node, o = n.from;
|
|
@@ -15092,7 +15103,7 @@ const Qx = ({
|
|
|
15092
15103
|
t.commands.setTextSelection(o);
|
|
15093
15104
|
}
|
|
15094
15105
|
}, 0);
|
|
15095
|
-
},
|
|
15106
|
+
}, d0 = (t, e) => {
|
|
15096
15107
|
const { state: n } = t, { selection: r } = n, o = () => {
|
|
15097
15108
|
const i = {
|
|
15098
15109
|
paragraph: () => t.chain().focus().setNode("paragraph").run(),
|
|
@@ -15135,12 +15146,12 @@ const Qx = ({
|
|
|
15135
15146
|
}, 0);
|
|
15136
15147
|
} else
|
|
15137
15148
|
o();
|
|
15138
|
-
},
|
|
15149
|
+
}, f0 = (t, e) => {
|
|
15139
15150
|
t && e !== null && t.chain().focus().extendMarkRange("link").setLink({ href: e }).run();
|
|
15140
15151
|
}, Qu = (t) => {
|
|
15141
15152
|
if (!t) return;
|
|
15142
15153
|
t.getAttributes("link")?.href && t.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
15143
|
-
},
|
|
15154
|
+
}, p0 = async ({ file: t, url: e, onProgress: n, signal: r, headers: o }) => new Promise((s, i) => {
|
|
15144
15155
|
const l = new XMLHttpRequest();
|
|
15145
15156
|
r && r.addEventListener("abort", () => {
|
|
15146
15157
|
l.abort(), i(new Error("AbortError"));
|
|
@@ -15171,10 +15182,10 @@ const Qx = ({
|
|
|
15171
15182
|
a.append("file", t), l.open("POST", e), o && Object.entries(o).forEach(([c, u]) => {
|
|
15172
15183
|
l.setRequestHeader(c, u);
|
|
15173
15184
|
}), l.send(a);
|
|
15174
|
-
}),
|
|
15185
|
+
}), h0 = (t, e) => (Array.isArray(e) ? e : e.split(".").filter(Boolean)).reduce((r, o) => {
|
|
15175
15186
|
if (!(r == null || typeof r != "object"))
|
|
15176
15187
|
return r[o];
|
|
15177
|
-
}, t),
|
|
15188
|
+
}, t), m0 = () => `upload-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`, Zn = (t, e, n) => {
|
|
15178
15189
|
const { state: r, view: o } = t, { doc: s } = r;
|
|
15179
15190
|
let i = null;
|
|
15180
15191
|
if (typeof e.pos == "number")
|
|
@@ -15208,7 +15219,7 @@ const Qx = ({
|
|
|
15208
15219
|
zn(r, { description: o });
|
|
15209
15220
|
}
|
|
15210
15221
|
};
|
|
15211
|
-
function
|
|
15222
|
+
function g0(t, e, n, r) {
|
|
15212
15223
|
const o = n + e.nodeSize, s = e.textContent, i = [];
|
|
15213
15224
|
t.nodesBetween(n + 1, o - 1, (u, d) => {
|
|
15214
15225
|
if (u.isText && u.text)
|
|
@@ -15234,7 +15245,7 @@ function g$(t, e, n, r) {
|
|
|
15234
15245
|
const gs = (t) => {
|
|
15235
15246
|
const { doc: e } = t.state, n = [];
|
|
15236
15247
|
return e.forEach((r, o, s) => {
|
|
15237
|
-
n.push(
|
|
15248
|
+
n.push(g0(e, r, o, s));
|
|
15238
15249
|
}), { nodes: n };
|
|
15239
15250
|
};
|
|
15240
15251
|
function ed(t, e) {
|
|
@@ -15270,7 +15281,7 @@ const nd = (t, e) => {
|
|
|
15270
15281
|
if (!r) return !1;
|
|
15271
15282
|
const o = td(t, r.absFrom, e.replacement), s = o ? t.state.tr.replaceWith(r.absFrom, r.absTo, o) : t.state.tr.delete(r.absFrom, r.absTo);
|
|
15272
15283
|
return t.view.dispatch(s), !0;
|
|
15273
|
-
},
|
|
15284
|
+
}, b0 = (t, e) => {
|
|
15274
15285
|
if (e.length === 0) return !0;
|
|
15275
15286
|
if (e.length === 1) return nd(t, e[0]);
|
|
15276
15287
|
const n = gs(t), r = [];
|
|
@@ -15286,7 +15297,7 @@ const nd = (t, e) => {
|
|
|
15286
15297
|
o = i ? o.replaceWith(s.absFrom, s.absTo, i) : o.delete(s.absFrom, s.absTo);
|
|
15287
15298
|
}
|
|
15288
15299
|
return t.view.dispatch(o), !0;
|
|
15289
|
-
},
|
|
15300
|
+
}, y0 = ({ editor: t }) => {
|
|
15290
15301
|
const [e, n] = Z(!1), [r, o] = Z(""), [s, i] = Z(!1), l = O(() => t.getAttributes("link")?.href || "", [t]);
|
|
15291
15302
|
U(() => {
|
|
15292
15303
|
const p = () => {
|
|
@@ -15298,7 +15309,7 @@ const nd = (t, e) => {
|
|
|
15298
15309
|
};
|
|
15299
15310
|
}, [t, l]);
|
|
15300
15311
|
const a = O(() => {
|
|
15301
|
-
r && (
|
|
15312
|
+
r && (f0(t, r), i(!0), n(!1));
|
|
15302
15313
|
}, [t, r]), c = O(() => {
|
|
15303
15314
|
r && window.open(r, "_blank", "noopener,noreferrer,nofollow");
|
|
15304
15315
|
}, [r]), u = O(() => {
|
|
@@ -15388,7 +15399,7 @@ const nd = (t, e) => {
|
|
|
15388
15399
|
] }),
|
|
15389
15400
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: "Link" }) })
|
|
15390
15401
|
] });
|
|
15391
|
-
},
|
|
15402
|
+
}, v0 = w.memo(y0), rd = ({
|
|
15392
15403
|
color: t,
|
|
15393
15404
|
bgColor: e,
|
|
15394
15405
|
buttonType: n
|
|
@@ -15415,7 +15426,7 @@ const nd = (t, e) => {
|
|
|
15415
15426
|
}
|
|
15416
15427
|
)
|
|
15417
15428
|
}
|
|
15418
|
-
),
|
|
15429
|
+
), x0 = ({
|
|
15419
15430
|
editor: t,
|
|
15420
15431
|
buttonType: e,
|
|
15421
15432
|
hsl: n,
|
|
@@ -15444,7 +15455,7 @@ const nd = (t, e) => {
|
|
|
15444
15455
|
c,
|
|
15445
15456
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: s }) })
|
|
15446
15457
|
] });
|
|
15447
|
-
},
|
|
15458
|
+
}, $0 = w.memo(x0), Mo = [
|
|
15448
15459
|
{
|
|
15449
15460
|
key: "text",
|
|
15450
15461
|
buttonType: "text",
|
|
@@ -15606,7 +15617,7 @@ const nd = (t, e) => {
|
|
|
15606
15617
|
}
|
|
15607
15618
|
]
|
|
15608
15619
|
}
|
|
15609
|
-
],
|
|
15620
|
+
], w0 = ({ editor: t }) => {
|
|
15610
15621
|
const e = O(
|
|
15611
15622
|
() => t.getAttributes("textStyle")?.color || "",
|
|
15612
15623
|
[t]
|
|
@@ -15666,7 +15677,7 @@ const nd = (t, e) => {
|
|
|
15666
15677
|
/* @__PURE__ */ m.jsx(Fe.Content, { placement: "bottom", children: /* @__PURE__ */ m.jsx(Fe.Dialog, { className: "px-1.5 py-2", children: /* @__PURE__ */ m.jsx("div", { className: "flex flex-col gap-2", children: Mo.map((l) => /* @__PURE__ */ m.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
15667
15678
|
/* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold leading-normal capitalize text-foreground px-1", children: l.title }),
|
|
15668
15679
|
/* @__PURE__ */ m.jsx("div", { className: "grid grid-cols-5 grid-rows-2 gap-0.5", children: l.colors.map((a) => /* @__PURE__ */ m.jsx(
|
|
15669
|
-
|
|
15680
|
+
$0,
|
|
15670
15681
|
{
|
|
15671
15682
|
hsl: a.hsl,
|
|
15672
15683
|
editor: t,
|
|
@@ -15681,7 +15692,7 @@ const nd = (t, e) => {
|
|
|
15681
15692
|
] }),
|
|
15682
15693
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: "Color/Background" }) })
|
|
15683
15694
|
] });
|
|
15684
|
-
},
|
|
15695
|
+
}, E0 = w.memo(w0), S0 = ({ editor: t }) => {
|
|
15685
15696
|
const e = O(() => t.isActive("subscript") || t.isActive("superscript") || t.isActive({ textAlign: "left" }) || t.isActive({ textAlign: "center" }) || t.isActive({ textAlign: "right" }) || t.isActive({ textAlign: "justify" }), [t]), [n, r] = Z(e);
|
|
15686
15697
|
U(() => {
|
|
15687
15698
|
const i = () => r(e());
|
|
@@ -15783,7 +15794,7 @@ const nd = (t, e) => {
|
|
|
15783
15794
|
] }),
|
|
15784
15795
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: "More tools" }) })
|
|
15785
15796
|
] });
|
|
15786
|
-
},
|
|
15797
|
+
}, C0 = w.memo(S0), k0 = ({ editor: t }) => {
|
|
15787
15798
|
const [e, n] = Z(!1), [, r] = Z(0);
|
|
15788
15799
|
U(() => {
|
|
15789
15800
|
const i = () => r((l) => l + 1);
|
|
@@ -15916,7 +15927,7 @@ const nd = (t, e) => {
|
|
|
15916
15927
|
)
|
|
15917
15928
|
] }) }) })
|
|
15918
15929
|
] }) : null;
|
|
15919
|
-
}, sd = w.memo(
|
|
15930
|
+
}, sd = w.memo(k0), T0 = ({ editor: t, prepend: e, append: n }) => {
|
|
15920
15931
|
const [r, o] = Z(() => t.isActive("table")), s = J(
|
|
15921
15932
|
() => [
|
|
15922
15933
|
{ icon: "Bold", buttonKey: "bold", tooltipText: "Bold", command: () => t.chain().focus().toggleMark("bold").run() },
|
|
@@ -15956,8 +15967,8 @@ const nd = (t, e) => {
|
|
|
15956
15967
|
}
|
|
15957
15968
|
) }, l.buttonKey)),
|
|
15958
15969
|
/* @__PURE__ */ m.jsx(ke, { orientation: "vertical", className: "h-6" }),
|
|
15959
|
-
/* @__PURE__ */ m.jsx(
|
|
15960
|
-
/* @__PURE__ */ m.jsx(
|
|
15970
|
+
/* @__PURE__ */ m.jsx(v0, { editor: t }),
|
|
15971
|
+
/* @__PURE__ */ m.jsx(E0, { editor: t }),
|
|
15961
15972
|
/* @__PURE__ */ m.jsx(ke, { orientation: "vertical", className: "h-6" }),
|
|
15962
15973
|
r && /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
15963
15974
|
/* @__PURE__ */ m.jsx(sd, { editor: t }),
|
|
@@ -15967,10 +15978,10 @@ const nd = (t, e) => {
|
|
|
15967
15978
|
n,
|
|
15968
15979
|
/* @__PURE__ */ m.jsx(ke, { orientation: "vertical", className: "h-6" })
|
|
15969
15980
|
] }),
|
|
15970
|
-
/* @__PURE__ */ m.jsx(
|
|
15981
|
+
/* @__PURE__ */ m.jsx(C0, { editor: t })
|
|
15971
15982
|
] }) });
|
|
15972
|
-
},
|
|
15973
|
-
const r = R(!1), o = O(() => r.current ? !0 : t.isEditable && t.isActive("table") && (
|
|
15983
|
+
}, P0 = w.memo(T0), M0 = ({ editor: t, prepend: e, append: n }) => {
|
|
15984
|
+
const r = R(!1), o = O(() => r.current ? !0 : t.isEditable && t.isActive("table") && (t0(t) || !Ir(t)), [t]);
|
|
15974
15985
|
return /* @__PURE__ */ m.jsx(
|
|
15975
15986
|
Dr,
|
|
15976
15987
|
{
|
|
@@ -16006,7 +16017,7 @@ const nd = (t, e) => {
|
|
|
16006
16017
|
)
|
|
16007
16018
|
}
|
|
16008
16019
|
);
|
|
16009
|
-
},
|
|
16020
|
+
}, A0 = w.memo(M0), N0 = ({ editor: t, onCloseMenu: e }) => {
|
|
16010
16021
|
const n = (r) => {
|
|
16011
16022
|
const o = r?.split("_")?.[0], s = r?.split("_")?.[1];
|
|
16012
16023
|
if (!(!o || !s)) {
|
|
@@ -16046,7 +16057,7 @@ const nd = (t, e) => {
|
|
|
16046
16057
|
o !== Mo.length - 1 && /* @__PURE__ */ m.jsx(ke, {})
|
|
16047
16058
|
] }, r.key)
|
|
16048
16059
|
) });
|
|
16049
|
-
},
|
|
16060
|
+
}, D0 = () => /* @__PURE__ */ m.jsx(
|
|
16050
16061
|
"svg",
|
|
16051
16062
|
{
|
|
16052
16063
|
width: "24",
|
|
@@ -16065,8 +16076,8 @@ const nd = (t, e) => {
|
|
|
16065
16076
|
}
|
|
16066
16077
|
)
|
|
16067
16078
|
}
|
|
16068
|
-
),
|
|
16069
|
-
const [n, r] = Z(-1), [o, s] = Z(!1), i = J(() =>
|
|
16079
|
+
), I0 = ["imageUploader"], nl = od.flatMap((t) => t.commands).filter((t) => !I0.includes(t.key)), L0 = ({ editor: t, dragHandleSlot: e }) => {
|
|
16080
|
+
const [n, r] = Z(-1), [o, s] = Z(!1), i = J(() => i0(t.state) ? /* @__PURE__ */ new Set(["duplicate_node"]) : /* @__PURE__ */ new Set(), [t.state]), l = O(
|
|
16070
16081
|
({ pos: u }) => {
|
|
16071
16082
|
r(u);
|
|
16072
16083
|
},
|
|
@@ -16128,11 +16139,11 @@ const nd = (t, e) => {
|
|
|
16128
16139
|
disabledKeys: i,
|
|
16129
16140
|
className: "w-[225px]",
|
|
16130
16141
|
onAction: (u) => {
|
|
16131
|
-
u === "duplicate_node" ?
|
|
16142
|
+
u === "duplicate_node" ? l0(t) : u === "delete" ? c0(t) : u === "copy_to_clipboard" ? a0(t) : u === "reset_formatting" && u0(t);
|
|
16132
16143
|
},
|
|
16133
16144
|
children: [
|
|
16134
16145
|
/* @__PURE__ */ m.jsxs(de.Section, { children: [
|
|
16135
|
-
|
|
16146
|
+
n0(t) ? /* @__PURE__ */ m.jsxs(de.SubmenuTrigger, { children: [
|
|
16136
16147
|
/* @__PURE__ */ m.jsxs(
|
|
16137
16148
|
de.Item,
|
|
16138
16149
|
{
|
|
@@ -16147,7 +16158,7 @@ const nd = (t, e) => {
|
|
|
16147
16158
|
}
|
|
16148
16159
|
),
|
|
16149
16160
|
/* @__PURE__ */ m.jsx(de.Popover, { children: /* @__PURE__ */ m.jsx(
|
|
16150
|
-
|
|
16161
|
+
N0,
|
|
16151
16162
|
{
|
|
16152
16163
|
editor: t,
|
|
16153
16164
|
onCloseMenu: () => {
|
|
@@ -16155,7 +16166,7 @@ const nd = (t, e) => {
|
|
|
16155
16166
|
}
|
|
16156
16167
|
) })
|
|
16157
16168
|
] }) : null,
|
|
16158
|
-
|
|
16169
|
+
r0(t) ? /* @__PURE__ */ m.jsxs(de.SubmenuTrigger, { children: [
|
|
16159
16170
|
/* @__PURE__ */ m.jsxs(
|
|
16160
16171
|
de.Item,
|
|
16161
16172
|
{
|
|
@@ -16163,7 +16174,7 @@ const nd = (t, e) => {
|
|
|
16163
16174
|
textValue: "turn_into",
|
|
16164
16175
|
className: "text-muted hover:text-foreground outline-none",
|
|
16165
16176
|
children: [
|
|
16166
|
-
/* @__PURE__ */ m.jsx(
|
|
16177
|
+
/* @__PURE__ */ m.jsx(D0, {}),
|
|
16167
16178
|
/* @__PURE__ */ m.jsx(at, { children: "Transform into" }),
|
|
16168
16179
|
/* @__PURE__ */ m.jsx(de.SubmenuIndicator, {})
|
|
16169
16180
|
]
|
|
@@ -16183,7 +16194,7 @@ const nd = (t, e) => {
|
|
|
16183
16194
|
} catch {
|
|
16184
16195
|
return;
|
|
16185
16196
|
}
|
|
16186
|
-
|
|
16197
|
+
d0(t, d), setTimeout(() => s(!1), 100);
|
|
16187
16198
|
}
|
|
16188
16199
|
},
|
|
16189
16200
|
children: nl.map(
|
|
@@ -16204,7 +16215,7 @@ const nd = (t, e) => {
|
|
|
16204
16215
|
}
|
|
16205
16216
|
) })
|
|
16206
16217
|
] }) : null,
|
|
16207
|
-
|
|
16218
|
+
o0(t) ? /* @__PURE__ */ m.jsx(
|
|
16208
16219
|
de.Item,
|
|
16209
16220
|
{
|
|
16210
16221
|
id: "reset_formatting",
|
|
@@ -16238,7 +16249,7 @@ const nd = (t, e) => {
|
|
|
16238
16249
|
] })
|
|
16239
16250
|
}
|
|
16240
16251
|
),
|
|
16241
|
-
|
|
16252
|
+
s0(t) ? /* @__PURE__ */ m.jsx(
|
|
16242
16253
|
de.Item,
|
|
16243
16254
|
{
|
|
16244
16255
|
id: "copy_to_clipboard",
|
|
@@ -16281,27 +16292,27 @@ const nd = (t, e) => {
|
|
|
16281
16292
|
] })
|
|
16282
16293
|
}
|
|
16283
16294
|
);
|
|
16284
|
-
}, id = ee(null),
|
|
16295
|
+
}, id = ee(null), R0 = () => j(id);
|
|
16285
16296
|
function gr(t) {
|
|
16286
16297
|
return t === "left" || t === "right" || t === "center" ? t : null;
|
|
16287
16298
|
}
|
|
16288
|
-
function
|
|
16299
|
+
function K0(t) {
|
|
16289
16300
|
const e = (t.style.textAlign || "").trim().toLowerCase(), n = (t.getAttribute("align") || "").trim().toLowerCase();
|
|
16290
16301
|
return gr(e || n);
|
|
16291
16302
|
}
|
|
16292
|
-
function
|
|
16303
|
+
function O0(t) {
|
|
16293
16304
|
return gr(t?.align);
|
|
16294
16305
|
}
|
|
16295
16306
|
function ld() {
|
|
16296
16307
|
return {
|
|
16297
16308
|
default: null,
|
|
16298
|
-
parseHTML: (t) =>
|
|
16309
|
+
parseHTML: (t) => K0(t),
|
|
16299
16310
|
renderHTML: (t) => t.align ? {
|
|
16300
16311
|
style: `text-align: ${t.align}`
|
|
16301
16312
|
} : {}
|
|
16302
16313
|
};
|
|
16303
16314
|
}
|
|
16304
|
-
var
|
|
16315
|
+
var F0 = Pn.create({
|
|
16305
16316
|
name: "tableCell",
|
|
16306
16317
|
addOptions() {
|
|
16307
16318
|
return {
|
|
@@ -16343,7 +16354,7 @@ var F$ = Pn.create({
|
|
|
16343
16354
|
renderHTML({ HTMLAttributes: t }) {
|
|
16344
16355
|
return ["td", Xt(this.options.HTMLAttributes, t), 0];
|
|
16345
16356
|
}
|
|
16346
|
-
}),
|
|
16357
|
+
}), j0 = Pn.create({
|
|
16347
16358
|
name: "tableHeader",
|
|
16348
16359
|
addOptions() {
|
|
16349
16360
|
return {
|
|
@@ -16377,7 +16388,7 @@ var F$ = Pn.create({
|
|
|
16377
16388
|
renderHTML({ HTMLAttributes: t }) {
|
|
16378
16389
|
return ["th", Xt(this.options.HTMLAttributes, t), 0];
|
|
16379
16390
|
}
|
|
16380
|
-
}),
|
|
16391
|
+
}), _0 = Pn.create({
|
|
16381
16392
|
name: "tableRow",
|
|
16382
16393
|
addOptions() {
|
|
16383
16394
|
return {
|
|
@@ -16424,7 +16435,7 @@ function rl(t, e, n, r, o, s) {
|
|
|
16424
16435
|
const d = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
16425
16436
|
a && !d ? (n.style.width = `${l}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${l}px`);
|
|
16426
16437
|
}
|
|
16427
|
-
var
|
|
16438
|
+
var B0 = class {
|
|
16428
16439
|
constructor(t, e) {
|
|
16429
16440
|
this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), rl(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
16430
16441
|
}
|
|
@@ -16436,7 +16447,7 @@ var B$ = class {
|
|
|
16436
16447
|
return !!(n && !r && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
|
|
16437
16448
|
}
|
|
16438
16449
|
};
|
|
16439
|
-
function
|
|
16450
|
+
function H0(t, e, n, r) {
|
|
16440
16451
|
let o = 0, s = !0;
|
|
16441
16452
|
const i = [], l = t.firstChild;
|
|
16442
16453
|
if (!l)
|
|
@@ -16456,7 +16467,7 @@ function H$(t, e, n, r) {
|
|
|
16456
16467
|
function ol(t, e) {
|
|
16457
16468
|
return t.createAndFill();
|
|
16458
16469
|
}
|
|
16459
|
-
function
|
|
16470
|
+
function z0(t) {
|
|
16460
16471
|
if (t.cached.tableNodeTypes)
|
|
16461
16472
|
return t.cached.tableNodeTypes;
|
|
16462
16473
|
const e = {};
|
|
@@ -16465,8 +16476,8 @@ function z$(t) {
|
|
|
16465
16476
|
r.spec.tableRole && (e[r.spec.tableRole] = r);
|
|
16466
16477
|
}), t.cached.tableNodeTypes = e, e;
|
|
16467
16478
|
}
|
|
16468
|
-
function
|
|
16469
|
-
const s =
|
|
16479
|
+
function V0(t, e, n, r, o) {
|
|
16480
|
+
const s = z0(t), i = [], l = [];
|
|
16470
16481
|
for (let c = 0; c < n; c += 1) {
|
|
16471
16482
|
const u = ol(s.cell);
|
|
16472
16483
|
if (u && l.push(u), r) {
|
|
@@ -16479,12 +16490,12 @@ function V$(t, e, n, r, o) {
|
|
|
16479
16490
|
a.push(s.row.createChecked(null, r && c === 0 ? i : l));
|
|
16480
16491
|
return s.table.createChecked(null, a);
|
|
16481
16492
|
}
|
|
16482
|
-
function
|
|
16493
|
+
function U0(t) {
|
|
16483
16494
|
return t instanceof Ro;
|
|
16484
16495
|
}
|
|
16485
16496
|
var Wn = ({ editor: t }) => {
|
|
16486
16497
|
const { selection: e } = t.state;
|
|
16487
|
-
if (!
|
|
16498
|
+
if (!U0(e))
|
|
16488
16499
|
return !1;
|
|
16489
16500
|
let n = 0;
|
|
16490
16501
|
const r = Iu(e.ranges[0].$from, (s) => s.type.name === "table");
|
|
@@ -16493,13 +16504,13 @@ var Wn = ({ editor: t }) => {
|
|
|
16493
16504
|
return !1;
|
|
16494
16505
|
["tableCell", "tableHeader"].includes(s.type.name) && (n += 1);
|
|
16495
16506
|
}), n === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
16496
|
-
},
|
|
16497
|
-
function
|
|
16507
|
+
}, W0 = "";
|
|
16508
|
+
function G0(t) {
|
|
16498
16509
|
return (t || "").replace(/\s+/g, " ").trim();
|
|
16499
16510
|
}
|
|
16500
|
-
function
|
|
16511
|
+
function q0(t, e, n = {}) {
|
|
16501
16512
|
var r;
|
|
16502
|
-
const o = (r = n.cellLineSeparator) != null ? r :
|
|
16513
|
+
const o = (r = n.cellLineSeparator) != null ? r : W0;
|
|
16503
16514
|
if (!t || !t.content || t.content.length === 0)
|
|
16504
16515
|
return "";
|
|
16505
16516
|
const s = [];
|
|
@@ -16508,7 +16519,7 @@ function q$(t, e, n = {}) {
|
|
|
16508
16519
|
b.content && b.content.forEach((v) => {
|
|
16509
16520
|
let x = "";
|
|
16510
16521
|
v.content && Array.isArray(v.content) && v.content.length > 1 ? x = v.content.map((T) => e.renderChildren(T)).join(o) : x = v.content ? e.renderChildren(v.content) : "";
|
|
16511
|
-
const S =
|
|
16522
|
+
const S = G0(x), $ = v.type === "tableHeader", D = O0(v.attrs);
|
|
16512
16523
|
y.push({ text: S, isHeader: $, align: D });
|
|
16513
16524
|
}), s.push(y);
|
|
16514
16525
|
});
|
|
@@ -16542,7 +16553,7 @@ function q$(t, e, n = {}) {
|
|
|
16542
16553
|
`;
|
|
16543
16554
|
}), p;
|
|
16544
16555
|
}
|
|
16545
|
-
var
|
|
16556
|
+
var Y0 = q0, X0 = Pn.create({
|
|
16546
16557
|
name: "table",
|
|
16547
16558
|
// @ts-ignore
|
|
16548
16559
|
addOptions() {
|
|
@@ -16553,7 +16564,7 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16553
16564
|
handleWidth: 5,
|
|
16554
16565
|
cellMinWidth: 25,
|
|
16555
16566
|
// TODO: fix
|
|
16556
|
-
View:
|
|
16567
|
+
View: B0,
|
|
16557
16568
|
lastColumnResizable: !0,
|
|
16558
16569
|
allowTableNodeSelection: !1
|
|
16559
16570
|
};
|
|
@@ -16566,7 +16577,7 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16566
16577
|
return [{ tag: "table" }];
|
|
16567
16578
|
},
|
|
16568
16579
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
16569
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: o } =
|
|
16580
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: o } = H0(t, this.options.cellMinWidth), s = e.style;
|
|
16570
16581
|
function i() {
|
|
16571
16582
|
return s || (r ? `width: ${r}` : `min-width: ${o}`);
|
|
16572
16583
|
}
|
|
@@ -16601,11 +16612,11 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16601
16612
|
}), n.push(e.createNode("tableRow", {}, s));
|
|
16602
16613
|
}), e.createNode("table", void 0, n);
|
|
16603
16614
|
},
|
|
16604
|
-
renderMarkdown: (t, e) =>
|
|
16615
|
+
renderMarkdown: (t, e) => Y0(t, e),
|
|
16605
16616
|
addCommands() {
|
|
16606
16617
|
return {
|
|
16607
16618
|
insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: o, editor: s }) => {
|
|
16608
|
-
const i =
|
|
16619
|
+
const i = V0(s.schema, t, e, n);
|
|
16609
16620
|
if (o) {
|
|
16610
16621
|
const l = r.selection.from + 1;
|
|
16611
16622
|
r.replaceSelectionWith(i).scrollIntoView().setSelection(Ne.near(r.doc.resolve(l)));
|
|
@@ -16664,6 +16675,10 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16664
16675
|
})
|
|
16665
16676
|
];
|
|
16666
16677
|
},
|
|
16678
|
+
addNodeView() {
|
|
16679
|
+
const t = this.options.resizable && this.editor.isEditable, e = this.options.View;
|
|
16680
|
+
return t || !e ? null : ({ node: n, view: r }) => new e(n, this.options.cellMinWidth, r);
|
|
16681
|
+
},
|
|
16667
16682
|
extendNodeSchema(t) {
|
|
16668
16683
|
const e = {
|
|
16669
16684
|
name: t.name,
|
|
@@ -16674,13 +16689,13 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16674
16689
|
tableRole: hr(zt(t, "tableRole", e))
|
|
16675
16690
|
};
|
|
16676
16691
|
}
|
|
16677
|
-
}),
|
|
16692
|
+
}), J0 = xe.create({
|
|
16678
16693
|
name: "tableKit",
|
|
16679
16694
|
addExtensions() {
|
|
16680
16695
|
const t = [];
|
|
16681
|
-
return this.options.table !== !1 && t.push(
|
|
16696
|
+
return this.options.table !== !1 && t.push(X0.configure(this.options.table)), this.options.tableCell !== !1 && t.push(F0.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(j0.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(_0.configure(this.options.tableRow)), t;
|
|
16682
16697
|
}
|
|
16683
|
-
}),
|
|
16698
|
+
}), Z0 = xe.create({
|
|
16684
16699
|
name: "textAlign",
|
|
16685
16700
|
addOptions() {
|
|
16686
16701
|
return {
|
|
@@ -16721,8 +16736,8 @@ var Y$ = q$, X$ = Pn.create({
|
|
|
16721
16736
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
16722
16737
|
};
|
|
16723
16738
|
}
|
|
16724
|
-
}),
|
|
16725
|
-
const
|
|
16739
|
+
}), Q0 = Z0;
|
|
16740
|
+
const e$ = ge(({ items: t, command: e }, n) => {
|
|
16726
16741
|
const [r, o] = Z(0);
|
|
16727
16742
|
No(n, () => ({
|
|
16728
16743
|
onKeyDown({ event: c }) {
|
|
@@ -16778,7 +16793,7 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16778
16793
|
zIndex: "9999"
|
|
16779
16794
|
});
|
|
16780
16795
|
});
|
|
16781
|
-
},
|
|
16796
|
+
}, t$ = {
|
|
16782
16797
|
allowSpaces: !1,
|
|
16783
16798
|
items: ({ editor: t, query: e }) => t.storage.emoji.emojis.filter(({ name: n, tags: r }) => n.toLocaleLowerCase().trim().startsWith(e.toLocaleLowerCase().trim()) || // shortcodes.find(shortcode => shortcode.startsWith(query.toLowerCase())) ||
|
|
16784
16799
|
r.find((o) => o.startsWith(e.toLowerCase()))).slice(0, 50),
|
|
@@ -16786,7 +16801,7 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16786
16801
|
let t;
|
|
16787
16802
|
return {
|
|
16788
16803
|
onStart: (e) => {
|
|
16789
|
-
e.clientRect && (e.editor.commands.setMeta("lockDragHandle", !0), t = new dl(
|
|
16804
|
+
e.clientRect && (e.editor.commands.setMeta("lockDragHandle", !0), t = new dl(e$, {
|
|
16790
16805
|
props: e,
|
|
16791
16806
|
editor: e.editor
|
|
16792
16807
|
}), document.body.appendChild(t.element), sl(e.editor, t.element));
|
|
@@ -16795,18 +16810,18 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16795
16810
|
t && (t.updateProps(e), e.clientRect && sl(e.editor, t.element));
|
|
16796
16811
|
},
|
|
16797
16812
|
onKeyDown(e) {
|
|
16798
|
-
return t ? e.event.key === "Escape" ? (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1), !0) : t.ref
|
|
16813
|
+
return t ? e.event.key === "Escape" ? (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1), !0) : t.ref ? t.ref.onKeyDown(e) : ["ArrowUp", "ArrowDown", "Enter"].includes(e.event.key) : !1;
|
|
16799
16814
|
},
|
|
16800
16815
|
onExit() {
|
|
16801
16816
|
t && (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1));
|
|
16802
16817
|
}
|
|
16803
16818
|
};
|
|
16804
16819
|
}
|
|
16805
|
-
},
|
|
16820
|
+
}, n$ = Kf.configure({
|
|
16806
16821
|
emojis: Of,
|
|
16807
16822
|
enableEmoticons: !0,
|
|
16808
16823
|
forceFallbackImages: !1,
|
|
16809
|
-
suggestion:
|
|
16824
|
+
suggestion: t$
|
|
16810
16825
|
}).extend({
|
|
16811
16826
|
addProseMirrorPlugins() {
|
|
16812
16827
|
return [
|
|
@@ -16817,7 +16832,7 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16817
16832
|
})
|
|
16818
16833
|
];
|
|
16819
16834
|
}
|
|
16820
|
-
}),
|
|
16835
|
+
}), r$ = (t) => {
|
|
16821
16836
|
const e = R(0), n = R(null), r = R(null), [o, s] = Z(!1), { editor: i, node: l } = t, { uploading: a, src: c, failed: u, progress: d, selectMedia: p, id: f, errorMessage: h, name: b, size: y } = l.attrs, v = () => {
|
|
16822
16837
|
r.current?.click();
|
|
16823
16838
|
}, x = (P) => {
|
|
@@ -16955,7 +16970,7 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16955
16970
|
)
|
|
16956
16971
|
}
|
|
16957
16972
|
);
|
|
16958
|
-
},
|
|
16973
|
+
}, o$ = Pn.create({
|
|
16959
16974
|
name: "imageUploader",
|
|
16960
16975
|
group: "block",
|
|
16961
16976
|
defining: !0,
|
|
@@ -16994,12 +17009,12 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
16994
17009
|
];
|
|
16995
17010
|
},
|
|
16996
17011
|
addNodeView() {
|
|
16997
|
-
return vd(
|
|
17012
|
+
return vd(r$);
|
|
16998
17013
|
},
|
|
16999
17014
|
addCommands() {
|
|
17000
17015
|
return {
|
|
17001
17016
|
insertImageUploader: () => ({ commands: t }) => {
|
|
17002
|
-
const e =
|
|
17017
|
+
const e = m0();
|
|
17003
17018
|
return t.insertContent({
|
|
17004
17019
|
type: this.name,
|
|
17005
17020
|
attrs: {
|
|
@@ -17016,7 +17031,7 @@ const e0 = ge(({ items: t, command: e }, n) => {
|
|
|
17016
17031
|
};
|
|
17017
17032
|
}
|
|
17018
17033
|
});
|
|
17019
|
-
var
|
|
17034
|
+
var s$ = ({ key: t, editor: e, onPaste: n, onDrop: r, allowedMimeTypes: o }) => new _e({
|
|
17020
17035
|
key: t || new De("fileHandler"),
|
|
17021
17036
|
props: {
|
|
17022
17037
|
handleDrop(s, i) {
|
|
@@ -17039,7 +17054,7 @@ var s0 = ({ key: t, editor: e, onPaste: n, onDrop: r, allowedMimeTypes: o }) =>
|
|
|
17039
17054
|
return o && (a = a.filter((u) => o.includes(u.type))), !(a.length === 0 || (i.preventDefault(), i.stopPropagation(), n(e, a, c), c.length > 0));
|
|
17040
17055
|
}
|
|
17041
17056
|
}
|
|
17042
|
-
}),
|
|
17057
|
+
}), i$ = xe.create({
|
|
17043
17058
|
name: "fileHandler",
|
|
17044
17059
|
addOptions() {
|
|
17045
17060
|
return {
|
|
@@ -17050,7 +17065,7 @@ var s0 = ({ key: t, editor: e, onPaste: n, onDrop: r, allowedMimeTypes: o }) =>
|
|
|
17050
17065
|
},
|
|
17051
17066
|
addProseMirrorPlugins() {
|
|
17052
17067
|
return [
|
|
17053
|
-
|
|
17068
|
+
s$({
|
|
17054
17069
|
key: new De(this.name),
|
|
17055
17070
|
editor: this.editor,
|
|
17056
17071
|
allowedMimeTypes: this.options.allowedMimeTypes,
|
|
@@ -17059,8 +17074,8 @@ var s0 = ({ key: t, editor: e, onPaste: n, onDrop: r, allowedMimeTypes: o }) =>
|
|
|
17059
17074
|
})
|
|
17060
17075
|
];
|
|
17061
17076
|
}
|
|
17062
|
-
}),
|
|
17063
|
-
const
|
|
17077
|
+
}), l$ = i$;
|
|
17078
|
+
const a$ = xe.create({
|
|
17064
17079
|
name: "imageUploaderExtension",
|
|
17065
17080
|
addOptions() {
|
|
17066
17081
|
return {
|
|
@@ -17074,7 +17089,7 @@ const a0 = xe.create({
|
|
|
17074
17089
|
},
|
|
17075
17090
|
addExtensions() {
|
|
17076
17091
|
return [
|
|
17077
|
-
|
|
17092
|
+
l$.configure({
|
|
17078
17093
|
allowedMimeTypes: this.options.allowedMimeTypes,
|
|
17079
17094
|
// Comment this for now, because there are a lot of edge cases
|
|
17080
17095
|
// that I have not yet accounted for
|
|
@@ -17179,7 +17194,7 @@ const a0 = xe.create({
|
|
|
17179
17194
|
x.abort();
|
|
17180
17195
|
}
|
|
17181
17196
|
});
|
|
17182
|
-
const S = await
|
|
17197
|
+
const S = await p0({
|
|
17183
17198
|
file: n,
|
|
17184
17199
|
url: i,
|
|
17185
17200
|
onProgress: v,
|
|
@@ -17192,7 +17207,7 @@ const a0 = xe.create({
|
|
|
17192
17207
|
}
|
|
17193
17208
|
if (!l)
|
|
17194
17209
|
throw new Error("You need to specify a key or resolver for the upload response using *imgUploadResponseKey* in editorOptions.");
|
|
17195
|
-
const D = typeof l == "function" ? l(S) :
|
|
17210
|
+
const D = typeof l == "function" ? l(S) : h0(S, l);
|
|
17196
17211
|
if (!D) throw new Error("No URL returned from server");
|
|
17197
17212
|
if (typeof D != "string") throw new Error("The upload response resolver must return a string URL");
|
|
17198
17213
|
h(D);
|
|
@@ -17227,7 +17242,7 @@ const a0 = xe.create({
|
|
|
17227
17242
|
type: "imageUploader",
|
|
17228
17243
|
attrs: { id: e, ...r }
|
|
17229
17244
|
});
|
|
17230
|
-
},
|
|
17245
|
+
}, c$ = xe.create({
|
|
17231
17246
|
name: "slash-commands",
|
|
17232
17247
|
addOptions() {
|
|
17233
17248
|
return {
|
|
@@ -17248,7 +17263,7 @@ const a0 = xe.create({
|
|
|
17248
17263
|
})
|
|
17249
17264
|
];
|
|
17250
17265
|
}
|
|
17251
|
-
}),
|
|
17266
|
+
}), u$ = ge(({ items: t, command: e }, n) => {
|
|
17252
17267
|
const r = t.flatMap((u) => u.commands), [o, s] = Z(0);
|
|
17253
17268
|
No(n, () => ({
|
|
17254
17269
|
onKeyDown({ event: u }) {
|
|
@@ -17322,7 +17337,7 @@ const a0 = xe.create({
|
|
|
17322
17337
|
zIndex: "9999"
|
|
17323
17338
|
});
|
|
17324
17339
|
});
|
|
17325
|
-
},
|
|
17340
|
+
}, d$ = {
|
|
17326
17341
|
pluginKey: new De("slashCommand"),
|
|
17327
17342
|
items: ({ query: t }) => od.map((r) => ({
|
|
17328
17343
|
...r,
|
|
@@ -17335,7 +17350,7 @@ const a0 = xe.create({
|
|
|
17335
17350
|
let t;
|
|
17336
17351
|
return {
|
|
17337
17352
|
onStart: (e) => {
|
|
17338
|
-
e.clientRect && (e.editor.commands.setMeta("lockDragHandle", !0), t = new dl(
|
|
17353
|
+
e.clientRect && (e.editor.commands.setMeta("lockDragHandle", !0), t = new dl(u$, {
|
|
17339
17354
|
props: e,
|
|
17340
17355
|
editor: e.editor
|
|
17341
17356
|
}), t.element.style.position = "fixed", document.body.appendChild(t.element), ll(e.editor, t.element));
|
|
@@ -17344,14 +17359,14 @@ const a0 = xe.create({
|
|
|
17344
17359
|
t && (t.updateProps(e), e.clientRect && ll(e.editor, t.element));
|
|
17345
17360
|
},
|
|
17346
17361
|
onKeyDown(e) {
|
|
17347
|
-
return t ? e.event.key === "Escape" ? (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1), !0) : t.ref
|
|
17362
|
+
return t ? e.event.key === "Escape" ? (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1), !0) : t.ref ? t.ref.onKeyDown(e) : ["ArrowUp", "ArrowDown", "Enter"].includes(e.event.key) : !1;
|
|
17348
17363
|
},
|
|
17349
17364
|
onExit() {
|
|
17350
17365
|
t && (t.destroy(), t.element.remove(), t.editor.commands.setMeta("lockDragHandle", !1));
|
|
17351
17366
|
}
|
|
17352
17367
|
};
|
|
17353
17368
|
}
|
|
17354
|
-
},
|
|
17369
|
+
}, f$ = ({
|
|
17355
17370
|
imgUploadUrl: t,
|
|
17356
17371
|
imgUploadResponseKey: e,
|
|
17357
17372
|
imgUploadHeaders: n
|
|
@@ -17386,34 +17401,34 @@ const a0 = xe.create({
|
|
|
17386
17401
|
Af.configure({
|
|
17387
17402
|
multicolor: !0
|
|
17388
17403
|
}),
|
|
17389
|
-
|
|
17404
|
+
Q0.configure({
|
|
17390
17405
|
types: ["paragraph", "heading"]
|
|
17391
17406
|
}),
|
|
17392
17407
|
Df,
|
|
17393
17408
|
If,
|
|
17394
|
-
|
|
17395
|
-
|
|
17409
|
+
n$,
|
|
17410
|
+
J0.configure({
|
|
17396
17411
|
table: {
|
|
17397
17412
|
resizable: !0
|
|
17398
17413
|
}
|
|
17399
17414
|
}),
|
|
17400
|
-
|
|
17401
|
-
|
|
17415
|
+
o$,
|
|
17416
|
+
a$.configure({
|
|
17402
17417
|
imgUploadUrl: t,
|
|
17403
17418
|
imgUploadResponseKey: e,
|
|
17404
17419
|
imgUploadHeaders: n
|
|
17405
17420
|
}),
|
|
17406
|
-
|
|
17407
|
-
suggestion:
|
|
17421
|
+
c$.configure({
|
|
17422
|
+
suggestion: d$
|
|
17408
17423
|
})
|
|
17409
|
-
], xt = (t, e) => t == null ? null : typeof t != "function" ? t : e ? t({ editor: e }) : null,
|
|
17424
|
+
], xt = (t, e) => t == null ? null : typeof t != "function" ? t : e ? t({ editor: e }) : null, p$ = (t, e) => {
|
|
17410
17425
|
const n = new Set(t.map((r) => r.name));
|
|
17411
17426
|
return Array.from(new Set(
|
|
17412
17427
|
e.map((r) => r.name).filter((r) => n.has(r))
|
|
17413
17428
|
));
|
|
17414
|
-
},
|
|
17429
|
+
}, h$ = (t, e) => {
|
|
17415
17430
|
const n = R(null), r = J(
|
|
17416
|
-
() =>
|
|
17431
|
+
() => p$(t, e),
|
|
17417
17432
|
[t, e]
|
|
17418
17433
|
), o = r.join(",");
|
|
17419
17434
|
U(() => {
|
|
@@ -17427,7 +17442,7 @@ const a0 = xe.create({
|
|
|
17427
17442
|
const i = `Duplicate extension names found in extraExtensions: [${r.map((l) => `'${l}'`).join(", ")}]. extraExtensions is additive only; duplicate names can cause unstable behavior.`;
|
|
17428
17443
|
console.warn(`[tiptop-editor warn]: ${i}`);
|
|
17429
17444
|
}, [r, o]);
|
|
17430
|
-
}, ad = ee(null), cd = () => j(ad),
|
|
17445
|
+
}, ad = ee(null), cd = () => j(ad), m$ = ({ editor: t }) => {
|
|
17431
17446
|
const e = cd(), n = O(() => t.isEditable ? !1 : Ir(t) && Ju(t) && !Zu(t), [t]), r = O(() => {
|
|
17432
17447
|
if (!e) return;
|
|
17433
17448
|
const { from: o, to: s } = t.state.selection;
|
|
@@ -17453,7 +17468,7 @@ const a0 = xe.create({
|
|
|
17453
17468
|
),
|
|
17454
17469
|
/* @__PURE__ */ m.jsx(we.Content, { children: /* @__PURE__ */ m.jsx("p", { children: "Add comment" }) })
|
|
17455
17470
|
] }) }) }) : null;
|
|
17456
|
-
},
|
|
17471
|
+
}, g$ = ({ editor: t }) => {
|
|
17457
17472
|
const [e, n] = Z("");
|
|
17458
17473
|
U(() => {
|
|
17459
17474
|
const i = () => n(t.getAttributes("link").href ?? "");
|
|
@@ -17489,7 +17504,7 @@ const a0 = xe.create({
|
|
|
17489
17504
|
] })
|
|
17490
17505
|
}
|
|
17491
17506
|
);
|
|
17492
|
-
},
|
|
17507
|
+
}, b$ = hx.create({
|
|
17493
17508
|
name: "comment",
|
|
17494
17509
|
addAttributes() {
|
|
17495
17510
|
return {
|
|
@@ -17543,7 +17558,7 @@ const a0 = xe.create({
|
|
|
17543
17558
|
})
|
|
17544
17559
|
];
|
|
17545
17560
|
}
|
|
17546
|
-
}),
|
|
17561
|
+
}), y$ = [
|
|
17547
17562
|
"paragraph",
|
|
17548
17563
|
"heading",
|
|
17549
17564
|
"blockquote",
|
|
@@ -17551,12 +17566,12 @@ const a0 = xe.create({
|
|
|
17551
17566
|
"orderedList",
|
|
17552
17567
|
"taskList",
|
|
17553
17568
|
"codeBlock"
|
|
17554
|
-
],
|
|
17569
|
+
], v$ = xe.create({
|
|
17555
17570
|
name: "nodeComment",
|
|
17556
17571
|
addGlobalAttributes() {
|
|
17557
17572
|
return [
|
|
17558
17573
|
{
|
|
17559
|
-
types:
|
|
17574
|
+
types: y$,
|
|
17560
17575
|
attributes: {
|
|
17561
17576
|
commentId: {
|
|
17562
17577
|
default: null,
|
|
@@ -17597,7 +17612,7 @@ const a0 = xe.create({
|
|
|
17597
17612
|
})
|
|
17598
17613
|
];
|
|
17599
17614
|
}
|
|
17600
|
-
}), al = (t) => JSON.stringify(t, (e, n) => typeof n == "function" ? "[function]" : n),
|
|
17615
|
+
}), al = (t) => JSON.stringify(t, (e, n) => typeof n == "function" ? "[function]" : n), x$ = ge(
|
|
17601
17616
|
({ editorOptions: t = {}, slots: e = {}, className: n, ...r }, o) => {
|
|
17602
17617
|
const {
|
|
17603
17618
|
imgUploadUrl: s,
|
|
@@ -17610,17 +17625,17 @@ const a0 = xe.create({
|
|
|
17610
17625
|
editable: p,
|
|
17611
17626
|
...f
|
|
17612
17627
|
} = t, h = J(
|
|
17613
|
-
() =>
|
|
17628
|
+
() => f$({ imgUploadUrl: s, imgUploadResponseKey: i, imgUploadHeaders: l }),
|
|
17614
17629
|
[i, s, l]
|
|
17615
17630
|
), b = J(
|
|
17616
|
-
() => u ? [
|
|
17631
|
+
() => u ? [b$, v$] : [],
|
|
17617
17632
|
[u]
|
|
17618
17633
|
), y = J(() => [
|
|
17619
17634
|
...h,
|
|
17620
17635
|
...b,
|
|
17621
17636
|
...d
|
|
17622
17637
|
], [h, b, d]);
|
|
17623
|
-
|
|
17638
|
+
h$(h, d);
|
|
17624
17639
|
const v = J(() => al(f), [f]), x = J(() => al(
|
|
17625
17640
|
d.map((T) => ({
|
|
17626
17641
|
name: T.name,
|
|
@@ -17653,15 +17668,15 @@ const a0 = xe.create({
|
|
|
17653
17668
|
once: ((...T) => ($?.once(...T), $)),
|
|
17654
17669
|
getDocumentMap: () => $ ? gs($) : null,
|
|
17655
17670
|
applyTargetedUpdate: (T) => $ ? nd($, T) : !1,
|
|
17656
|
-
applyTargetedUpdates: (T) => $ ?
|
|
17671
|
+
applyTargetedUpdates: (T) => $ ? b0($, T) : !1
|
|
17657
17672
|
}), [$]);
|
|
17658
17673
|
const D = a ? bd : Gb, K = a ? {} : { className: "w-full overflow-visible" };
|
|
17659
17674
|
return /* @__PURE__ */ m.jsx(id.Provider, { value: $, children: /* @__PURE__ */ m.jsxs(D, { ...K, children: [
|
|
17660
17675
|
xt(e.editorTop, $),
|
|
17661
17676
|
$ && /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
|
|
17662
|
-
c ? /* @__PURE__ */ m.jsx(
|
|
17677
|
+
c ? /* @__PURE__ */ m.jsx(L0, { editor: $, dragHandleSlot: xt(e.dragHandleDropdown, $) }) : null,
|
|
17663
17678
|
/* @__PURE__ */ m.jsx(
|
|
17664
|
-
|
|
17679
|
+
P0,
|
|
17665
17680
|
{
|
|
17666
17681
|
editor: $,
|
|
17667
17682
|
prepend: xt(e.selectionMenuPrepend, $),
|
|
@@ -17669,15 +17684,15 @@ const a0 = xe.create({
|
|
|
17669
17684
|
}
|
|
17670
17685
|
),
|
|
17671
17686
|
/* @__PURE__ */ m.jsx(
|
|
17672
|
-
|
|
17687
|
+
A0,
|
|
17673
17688
|
{
|
|
17674
17689
|
editor: $,
|
|
17675
17690
|
prepend: xt(e.tableMenuPrepend, $),
|
|
17676
17691
|
append: xt(e.tableMenuAppend, $)
|
|
17677
17692
|
}
|
|
17678
17693
|
),
|
|
17679
|
-
/* @__PURE__ */ m.jsx(
|
|
17680
|
-
u && /* @__PURE__ */ m.jsx(
|
|
17694
|
+
/* @__PURE__ */ m.jsx(g$, { editor: $ }),
|
|
17695
|
+
u && /* @__PURE__ */ m.jsx(m$, { editor: $ })
|
|
17681
17696
|
] }),
|
|
17682
17697
|
/* @__PURE__ */ m.jsx(
|
|
17683
17698
|
wd,
|
|
@@ -17691,8 +17706,8 @@ const a0 = xe.create({
|
|
|
17691
17706
|
] }) });
|
|
17692
17707
|
}
|
|
17693
17708
|
);
|
|
17694
|
-
|
|
17695
|
-
const
|
|
17709
|
+
x$.displayName = "TiptapEditor";
|
|
17710
|
+
const q$ = ({ children: t, initialComments: e, onCommentsChange: n }) => {
|
|
17696
17711
|
const [r, o] = Z(e ?? []), [s, i] = Z(null), [l, a] = Z(null), c = R(n);
|
|
17697
17712
|
c.current = n;
|
|
17698
17713
|
const u = O(
|
|
@@ -17777,8 +17792,8 @@ const q0 = ({ children: t, initialComments: e, onCommentsChange: n }) => {
|
|
|
17777
17792
|
children: /* @__PURE__ */ m.jsx("div", { ref: y, style: { display: "contents" }, children: t })
|
|
17778
17793
|
}
|
|
17779
17794
|
);
|
|
17780
|
-
},
|
|
17781
|
-
const t =
|
|
17795
|
+
}, Y$ = () => {
|
|
17796
|
+
const t = R0(), e = cd(), n = O(
|
|
17782
17797
|
(s, i, l) => {
|
|
17783
17798
|
!t || !e || !i.trim() || (s.type === "inline" ? t.commands.setComment(s.id, { from: s.from, to: s.to }) : t.commands.setNodeComment(s.id, s.nodePos), e.addComment(s.id, s.type, i.trim(), l));
|
|
17784
17799
|
},
|
|
@@ -17801,16 +17816,16 @@ const q0 = ({ children: t, initialComments: e, onCommentsChange: n }) => {
|
|
|
17801
17816
|
return { submit: n, resolve: r, remove: o };
|
|
17802
17817
|
};
|
|
17803
17818
|
export {
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17819
|
+
b$ as CommentMark,
|
|
17820
|
+
m$ as CommentSelectionMenu,
|
|
17821
|
+
q$ as CommentsProvider,
|
|
17822
|
+
v$ as NodeCommentExtension,
|
|
17823
|
+
x$ as TiptopEditor,
|
|
17809
17824
|
id as TiptopEditorContext,
|
|
17810
17825
|
nd as applyTargetedUpdate,
|
|
17811
|
-
|
|
17826
|
+
b0 as applyTargetedUpdates,
|
|
17812
17827
|
gs as getDocumentMap,
|
|
17813
|
-
|
|
17828
|
+
Y$ as useCommentActions,
|
|
17814
17829
|
cd as useComments,
|
|
17815
|
-
|
|
17830
|
+
R0 as useTiptopEditor
|
|
17816
17831
|
};
|