@fileverse-dev/ddoc 2.0.3-patch-9 → 2.0.3-patch-10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.es.js +32 -20
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -98575,48 +98575,60 @@ const _y = ({
|
|
98575
98575
|
return {
|
98576
98576
|
"Mod-Alt-0": () => this.editor.commands.setDBlock(),
|
98577
98577
|
Enter: ({ editor: t }) => {
|
98578
|
-
var
|
98578
|
+
var g;
|
98579
98579
|
const {
|
98580
98580
|
selection: { $head: e, from: n, to: r },
|
98581
98581
|
doc: i
|
98582
|
-
} = t.state, a = e.node(e.depth - 1),
|
98582
|
+
} = t.state, a = e.node(e.depth - 1), o = e.node(e.depth), l = e.toString().split("/"), c = n + 4, u = l.some((v) => v.includes("table")), f = (a == null ? void 0 : a.type.name) === "listItem" || (a == null ? void 0 : a.type.name) === "taskItem", d = (a == null ? void 0 : a.type.name) === "taskItem";
|
98583
98583
|
if ((a == null ? void 0 : a.type.name) !== "dBlock") {
|
98584
|
-
|
98585
|
-
|
98584
|
+
if (n !== r && f)
|
98585
|
+
return t.chain().deleteSelection().focus().run();
|
98586
|
+
if (u)
|
98587
|
+
return !1;
|
98588
|
+
const k = o.textContent === "" && o.type.name === "paragraph" && f, w = e.node(e.depth - 2), b = e.index(e.depth - 2) === w.childCount - 1, M = ["bulletList", "orderedList", "taskList"].includes(
|
98589
|
+
e.node(e.depth - 2).type.name
|
98590
|
+
), S = b && M, L = !b && M, E = e.node(e.depth - 2).childCount > 1;
|
98591
|
+
return k && E ? S ? t.chain().deleteNode(d ? "taskItem" : "listItem").insertContentAt(n, {
|
98586
98592
|
type: "dBlock",
|
98587
98593
|
content: [
|
98588
98594
|
{
|
98589
98595
|
type: "paragraph"
|
98590
98596
|
}
|
98591
98597
|
]
|
98592
|
-
}).focus().run() :
|
98598
|
+
}).focus().run() : L ? t.chain().deleteCurrentNode().insertContentAt(n, {
|
98599
|
+
type: d ? "taskItem" : "listItem",
|
98600
|
+
content: [
|
98601
|
+
{
|
98602
|
+
type: "paragraph"
|
98603
|
+
}
|
98604
|
+
]
|
98605
|
+
}).focus(c).run() : t.chain().liftListItem(d ? "taskItem" : "listItem").focus().run() : !1;
|
98593
98606
|
}
|
98594
|
-
let
|
98595
|
-
i.descendants((
|
98596
|
-
if (
|
98597
|
-
if (
|
98598
|
-
const [
|
98599
|
-
return
|
98607
|
+
let h = -1, p = "";
|
98608
|
+
i.descendants((v, k) => {
|
98609
|
+
if (h !== -1) return !1;
|
98610
|
+
if (v.type.name === this.name) return;
|
98611
|
+
const [w, b] = [k, k + v.nodeSize];
|
98612
|
+
return w <= n && r <= b && (h = b, p = v.type.name), !1;
|
98600
98613
|
});
|
98601
|
-
const
|
98614
|
+
const m = (g = i.slice(n, h)) == null ? void 0 : g.toJSON().content;
|
98602
98615
|
try {
|
98603
|
-
|
98604
|
-
return ["columns", "heading"].includes(u) ? t.chain().insertContent({
|
98616
|
+
return p === "codeBlock" ? t.chain().newlineInCode().focus().run() : ["columns", "heading"].includes(p) ? t.chain().insertContent({
|
98605
98617
|
type: "dBlock",
|
98606
98618
|
content: [
|
98607
98619
|
{
|
98608
98620
|
type: "paragraph"
|
98609
98621
|
}
|
98610
98622
|
]
|
98611
|
-
}).focus(
|
98612
|
-
{ from: n, to:
|
98623
|
+
}).focus(c).run() : t.chain().insertContentAt(
|
98624
|
+
{ from: n, to: h },
|
98613
98625
|
{
|
98614
98626
|
type: this.name,
|
98615
|
-
content:
|
98627
|
+
content: m
|
98616
98628
|
}
|
98617
|
-
).focus(
|
98618
|
-
} catch (
|
98619
|
-
return console.error(`Error inserting content into dBlock node: ${
|
98629
|
+
).focus(c).run();
|
98630
|
+
} catch (v) {
|
98631
|
+
return console.error(`Error inserting content into dBlock node: ${v}`), !1;
|
98620
98632
|
}
|
98621
98633
|
},
|
98622
98634
|
Backspace: ({ editor: t }) => {
|