reactjs-tiptap-editor 1.0.17 → 1.0.19
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/lib/{ActionMenuButton-lsIBc9sU.js → ActionMenuButton-B1Nfn5Hm.js} +6 -6
- package/lib/ActionMenuButton-D3b_bcin.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +48 -86
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.js +33 -29
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +16 -11
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -3
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +108 -103
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -3
- package/lib/CodeBlock.cjs +38 -38
- package/lib/CodeBlock.js +1565 -1610
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +46 -63
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +24 -10
- package/lib/Drawer-B1-7Y4HB.js +1099 -0
- package/lib/Drawer-kEO7KzzC.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +69 -93
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +101 -112
- package/lib/ExportPdf.cjs +4 -4
- package/lib/ExportPdf.js +4 -13
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +9 -7
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +12 -34
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +12 -27
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +32 -45
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +39 -52
- package/lib/History.cjs +1 -1
- package/lib/History.js +320 -313
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -3
- package/lib/Iframe-Bk5OIlvy.cjs +1 -0
- package/lib/{Iframe-CTajPyzs.js → Iframe-XlAb03_r.js} +21 -30
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +5 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +89 -117
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +16 -20
- package/lib/Indent-XaZNTsOk.cjs +1 -0
- package/lib/{Indent-BGEHlRx_.js → Indent-ruPuj5xn.js} +3 -7
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +24 -19
- package/lib/Katex-BFIYLrwm.cjs +4 -0
- package/lib/{Katex-tMh4bfBb.js → Katex-DKspCn-p.js} +238 -253
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +5 -4
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +13 -21
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-CA5NhP-m.js → LinkEditBlock-BWm2Ypt2.js} +329 -379
- package/lib/LinkEditBlock-DhesHreq.cjs +5 -0
- package/lib/MarkdownPaste.cjs +58 -0
- package/lib/MarkdownPaste.js +1656 -0
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +22 -17
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +130 -155
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +12 -20
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -3
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +69 -134
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +15 -14
- package/lib/{SlashCommandNodeView-CZoM3ZlS.cjs → SlashCommandNodeView-CojfS61Q.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DLuqbX2o.js → SlashCommandNodeView-Hf2DX4km.js} +18 -20
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -3
- package/lib/{Table-BC4Lbqzn.js → Table-BTkFUATL.js} +95 -133
- package/lib/Table-C1_xLqV0.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -3
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +51 -60
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +47 -69
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -3
- package/lib/Twitter-Cj-0yyQQ.cjs +1 -0
- package/lib/{Twitter-D8Cbgl7g.js → Twitter-D5mUTILj.js} +567 -593
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +4 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -4
- package/lib/bubble.js +3891 -3001
- package/lib/clsx-BSBE1eoY.cjs +33 -0
- package/lib/clsx-OumA9x-8.js +1062 -0
- package/lib/components/ActionButton.d.ts +2 -2
- package/lib/components/ActionMenuButton.d.ts +1 -1
- package/lib/components/Bubble/formatBubble.d.ts +5 -5
- package/lib/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +1 -1
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +1 -1
- package/lib/components/ui/label.d.ts +1 -1
- package/lib/components/ui/popover.d.ts +1 -1
- package/lib/components/ui/select.d.ts +1 -1
- package/lib/components/ui/separator.d.ts +1 -1
- package/lib/components/ui/switch.d.ts +1 -1
- package/lib/components/ui/tabs.d.ts +1 -1
- package/lib/components/ui/toast.d.ts +1 -1
- package/lib/components/ui/toggle.d.ts +1 -1
- package/lib/components/ui/tooltip.d.ts +1 -1
- package/lib/{delete-node-IyVmiRbI.js → delete-node-eQHsyyhR.js} +3 -1
- package/lib/{dropdown-menu-q6RL_fkA.js → dropdown-menu-Bragdu5m.js} +8 -8
- package/lib/{dropdown-menu-C_F7LEy5.cjs → dropdown-menu-CUeq1boX.cjs} +1 -1
- package/lib/extensions/Blockquote/Blockquote.d.ts +1 -1
- package/lib/extensions/Bold/Bold.d.ts +1 -1
- package/lib/extensions/Code/Code.d.ts +1 -1
- package/lib/extensions/CodeView/CodeView.d.ts +2 -2
- package/lib/extensions/Heading/Heading.d.ts +1 -1
- package/lib/extensions/Highlight/Highlight.d.ts +1 -1
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +1 -1
- package/lib/extensions/Image/Image.d.ts +1 -0
- package/lib/extensions/ImportWord/ImportWord.d.ts +2 -2
- package/lib/extensions/Italic/Italic.d.ts +1 -1
- package/lib/extensions/Link/Link.d.ts +1 -1
- package/lib/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
- package/lib/extensions/MarkdownPaste/index.d.ts +1 -0
- package/lib/extensions/Mermaid/Mermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/MoreMark.d.ts +1 -1
- package/lib/extensions/Strike/Strike.d.ts +1 -1
- package/lib/extensions/Table/Table.d.ts +1 -1
- package/lib/extensions/TextAlign/TextAlign.d.ts +1 -1
- package/lib/extensions/TextUnderline/TextUnderline.d.ts +1 -1
- package/lib/index-B-7eHzaO.js +1362 -0
- package/lib/{index-BDYJ8Ph2.js → index-BKlbc8Qo.js} +1 -1
- package/lib/index-BLrMslr7.cjs +1 -0
- package/lib/index-BVRHx_ha.js +6473 -0
- package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
- package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
- package/lib/{index-RcSPeQHn.js → index-CDFAs4RT.js} +1508 -1464
- package/lib/index-CMLwKzI0.cjs +1 -0
- package/lib/index-COCTP78Y.cjs +12 -0
- package/lib/{index-DqruLhsu.js → index-CZ1_8JQQ.js} +23 -23
- package/lib/{index-neeeY2o7.cjs → index-CnePcUeF.cjs} +3 -3
- package/lib/index-D7wfvzJg.cjs +1 -0
- package/lib/index-DwSnESy-.cjs +24 -0
- package/lib/{index-Do_dsOGB.js → index-cPEuL4Zr.js} +175 -158
- package/lib/index.cjs +1 -1
- package/lib/index.js +33 -41
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/plugins/image-upload.d.ts +1 -1
- package/lib/popover-C2BbhsXH.js +24 -0
- package/lib/popover-DCJpsZx0.cjs +1 -0
- package/lib/{renderNodeView-BEkECnnY.js → renderNodeView-CmnUEfby.js} +2 -2
- package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-DQjWzXDA.cjs} +1 -1
- package/lib/{separator-BLp6xpSY.cjs → separator-BuG1zwKa.cjs} +1 -1
- package/lib/separator-lkMWuUvf.js +293 -0
- package/lib/store/editor.d.ts +1 -1
- package/lib/store/store.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -3
- package/lib/updatePosition-D6AScA-1.cjs +1 -0
- package/lib/updatePosition-DYuAiqx-.js +16 -0
- package/lib/utils/columns.d.ts +1 -1
- package/lib/utils/pdf.d.ts +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/package.json +262 -247
- package/lib/ActionMenuButton-B_E2mbAW.cjs +0 -1
- package/lib/Drawer-DQ4CxBwG.js +0 -1373
- package/lib/Drawer-FUeUKshi.cjs +0 -1
- package/lib/Iframe-EVWXCqe4.cjs +0 -1
- package/lib/Indent-q9cEWAa_.cjs +0 -1
- package/lib/Katex-ClqcEnN_.cjs +0 -4
- package/lib/LinkEditBlock-DZXk4ln_.cjs +0 -5
- package/lib/Table-BmDopO43.cjs +0 -9
- package/lib/Twitter-BbMD3Ybp.cjs +0 -1
- package/lib/clsx-CXbNJWDD.cjs +0 -54
- package/lib/clsx-DaPvp9ji.js +0 -7391
- package/lib/index-BCzvbrf5.cjs +0 -12
- package/lib/index-BnVcq33n.cjs +0 -1
- package/lib/index-CjhjjJsN.cjs +0 -1
- package/lib/index-Cs6cp0Y6.cjs +0 -1
- package/lib/index-Qcl3BG94.js +0 -1351
- package/lib/popover-CtinPbiy.js +0 -24
- package/lib/popover-DIMT3pae.cjs +0 -1
- package/lib/select-CYyIeImH.cjs +0 -1
- package/lib/select-CmV5uTXr.js +0 -117
- package/lib/separator-C7luvaG8.js +0 -327
- package/lib/textarea-CkVKMPqK.js +0 -20
- package/lib/textarea-Cn75Cm2n.cjs +0 -1
- package/lib/updatePosition-Cjuj2E26.cjs +0 -1
- package/lib/updatePosition-DRmKQBGm.js +0 -16
package/lib/History.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin as
|
|
3
|
-
import { DecorationSet as
|
|
4
|
-
import { k as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { u as
|
|
1
|
+
import { K as R, v as ne, F as L, u as G, T as H, s as U, S as T, L as W, O as re, E as C, Q as ie, R as oe, U as se, l as le } from "./index-BVRHx_ha.js";
|
|
2
|
+
import { Plugin as A, PluginKey as I } from "@tiptap/pm/state";
|
|
3
|
+
import { DecorationSet as S, Decoration as N } from "@tiptap/pm/view";
|
|
4
|
+
import { k as ae, D as de, a as ce } from "./index-CZ1_8JQQ.js";
|
|
5
|
+
import { jsx as O, Fragment as j } from "react/jsx-runtime";
|
|
6
|
+
import { u as X, e as Y, A as Z, i as ue } from "./index-CDFAs4RT.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "./theme.js";
|
|
9
|
-
function
|
|
10
|
-
return new
|
|
9
|
+
function pe(n = {}) {
|
|
10
|
+
return new R({
|
|
11
11
|
view(e) {
|
|
12
|
-
return new
|
|
12
|
+
return new he(e, n);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
class
|
|
16
|
+
class he {
|
|
17
17
|
constructor(e, t) {
|
|
18
|
-
var
|
|
19
|
-
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (
|
|
18
|
+
var i;
|
|
19
|
+
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (i = t.width) !== null && i !== void 0 ? i : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((r) => {
|
|
20
20
|
let o = (s) => {
|
|
21
21
|
this[r](s);
|
|
22
22
|
};
|
|
@@ -33,22 +33,22 @@ class pe {
|
|
|
33
33
|
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
34
34
|
}
|
|
35
35
|
updateOverlay() {
|
|
36
|
-
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent,
|
|
36
|
+
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, i, r = this.editorView.dom, o = r.getBoundingClientRect(), s = o.width / r.offsetWidth, l = o.height / r.offsetHeight;
|
|
37
37
|
if (t) {
|
|
38
38
|
let c = e.nodeBefore, p = e.nodeAfter;
|
|
39
39
|
if (c || p) {
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
42
|
-
let g =
|
|
43
|
-
c && p && (
|
|
40
|
+
let f = this.editorView.nodeDOM(this.cursorPos - (c ? c.nodeSize : 0));
|
|
41
|
+
if (f) {
|
|
42
|
+
let g = f.getBoundingClientRect(), b = c ? g.bottom : g.top;
|
|
43
|
+
c && p && (b = (b + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
44
44
|
let P = this.width / 2 * l;
|
|
45
|
-
|
|
45
|
+
i = { left: g.left, right: g.right, top: b - P, bottom: b + P };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
if (!
|
|
49
|
+
if (!i) {
|
|
50
50
|
let c = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * s;
|
|
51
|
-
|
|
51
|
+
i = { left: c.left - p, right: c.left + p, top: c.top, bottom: c.bottom };
|
|
52
52
|
}
|
|
53
53
|
let a = this.editorView.dom.offsetParent;
|
|
54
54
|
this.element || (this.element = a.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
@@ -56,10 +56,10 @@ class pe {
|
|
|
56
56
|
if (!a || a == document.body && getComputedStyle(a).position == "static")
|
|
57
57
|
d = -pageXOffset, u = -pageYOffset;
|
|
58
58
|
else {
|
|
59
|
-
let c = a.getBoundingClientRect(), p = c.width / a.offsetWidth,
|
|
60
|
-
d = c.left - a.scrollLeft * p, u = c.top - a.scrollTop *
|
|
59
|
+
let c = a.getBoundingClientRect(), p = c.width / a.offsetWidth, f = c.height / a.offsetHeight;
|
|
60
|
+
d = c.left - a.scrollLeft * p, u = c.top - a.scrollTop * f;
|
|
61
61
|
}
|
|
62
|
-
this.element.style.left = (
|
|
62
|
+
this.element.style.left = (i.left - d) / s + "px", this.element.style.top = (i.top - u) / l + "px", this.element.style.width = (i.right - i.left) / s + "px", this.element.style.height = (i.bottom - i.top) / l + "px";
|
|
63
63
|
}
|
|
64
64
|
scheduleRemoval(e) {
|
|
65
65
|
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
@@ -67,11 +67,11 @@ class pe {
|
|
|
67
67
|
dragover(e) {
|
|
68
68
|
if (!this.editorView.editable)
|
|
69
69
|
return;
|
|
70
|
-
let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }),
|
|
70
|
+
let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), i = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = i && i.type.spec.disableDropCursor, o = typeof r == "function" ? r(this.editorView, t, e) : r;
|
|
71
71
|
if (t && !o) {
|
|
72
72
|
let s = t.pos;
|
|
73
73
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
74
|
-
let l =
|
|
74
|
+
let l = ne(this.editorView.state.doc, s, this.editorView.dragging.slice);
|
|
75
75
|
l != null && (s = l);
|
|
76
76
|
}
|
|
77
77
|
this.setCursor(s), this.scheduleRemoval(5e3);
|
|
@@ -87,7 +87,7 @@ class pe {
|
|
|
87
87
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
class
|
|
90
|
+
class h extends T {
|
|
91
91
|
/**
|
|
92
92
|
Create a gap cursor.
|
|
93
93
|
*/
|
|
@@ -95,14 +95,14 @@ class f extends A {
|
|
|
95
95
|
super(e, e);
|
|
96
96
|
}
|
|
97
97
|
map(e, t) {
|
|
98
|
-
let
|
|
99
|
-
return
|
|
98
|
+
let i = e.resolve(t.map(this.head));
|
|
99
|
+
return h.valid(i) ? new h(i) : T.near(i);
|
|
100
100
|
}
|
|
101
101
|
content() {
|
|
102
102
|
return G.empty;
|
|
103
103
|
}
|
|
104
104
|
eq(e) {
|
|
105
|
-
return e instanceof
|
|
105
|
+
return e instanceof h && e.head == this.head;
|
|
106
106
|
}
|
|
107
107
|
toJSON() {
|
|
108
108
|
return { type: "gapcursor", pos: this.head };
|
|
@@ -113,7 +113,7 @@ class f extends A {
|
|
|
113
113
|
static fromJSON(e, t) {
|
|
114
114
|
if (typeof t.pos != "number")
|
|
115
115
|
throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
116
|
-
return new
|
|
116
|
+
return new h(e.resolve(t.pos));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
@internal
|
|
@@ -126,20 +126,20 @@ class f extends A {
|
|
|
126
126
|
*/
|
|
127
127
|
static valid(e) {
|
|
128
128
|
let t = e.parent;
|
|
129
|
-
if (t.
|
|
129
|
+
if (t.inlineContent || !fe(e) || !me(e))
|
|
130
130
|
return !1;
|
|
131
|
-
let
|
|
132
|
-
if (
|
|
133
|
-
return
|
|
131
|
+
let i = t.type.spec.allowGapCursor;
|
|
132
|
+
if (i != null)
|
|
133
|
+
return i;
|
|
134
134
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
135
135
|
return r && r.isTextblock;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
@internal
|
|
139
139
|
*/
|
|
140
|
-
static findGapCursorFrom(e, t,
|
|
140
|
+
static findGapCursorFrom(e, t, i = !1) {
|
|
141
141
|
e: for (; ; ) {
|
|
142
|
-
if (!
|
|
142
|
+
if (!i && h.valid(e))
|
|
143
143
|
return e;
|
|
144
144
|
let r = e.pos, o = null;
|
|
145
145
|
for (let s = e.depth; ; s--) {
|
|
@@ -151,30 +151,30 @@ class f extends A {
|
|
|
151
151
|
return null;
|
|
152
152
|
r += t;
|
|
153
153
|
let a = e.doc.resolve(r);
|
|
154
|
-
if (
|
|
154
|
+
if (h.valid(a))
|
|
155
155
|
return a;
|
|
156
156
|
}
|
|
157
157
|
for (; ; ) {
|
|
158
158
|
let s = t > 0 ? o.firstChild : o.lastChild;
|
|
159
159
|
if (!s) {
|
|
160
|
-
if (o.isAtom && !o.isText && !
|
|
161
|
-
e = e.doc.resolve(r + o.nodeSize * t),
|
|
160
|
+
if (o.isAtom && !o.isText && !U.isSelectable(o)) {
|
|
161
|
+
e = e.doc.resolve(r + o.nodeSize * t), i = !1;
|
|
162
162
|
continue e;
|
|
163
163
|
}
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
166
|
o = s, r += t;
|
|
167
167
|
let l = e.doc.resolve(r);
|
|
168
|
-
if (
|
|
168
|
+
if (h.valid(l))
|
|
169
169
|
return l;
|
|
170
170
|
}
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
h.prototype.visible = !1;
|
|
176
|
+
h.findFrom = h.findGapCursorFrom;
|
|
177
|
+
T.jsonID("gapcursor", h);
|
|
178
178
|
class F {
|
|
179
179
|
constructor(e) {
|
|
180
180
|
this.pos = e;
|
|
@@ -184,21 +184,21 @@ class F {
|
|
|
184
184
|
}
|
|
185
185
|
resolve(e) {
|
|
186
186
|
let t = e.resolve(this.pos);
|
|
187
|
-
return
|
|
187
|
+
return h.valid(t) ? new h(t) : T.near(t);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
function J(
|
|
191
|
-
return
|
|
190
|
+
function J(n) {
|
|
191
|
+
return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
|
|
192
192
|
}
|
|
193
|
-
function fe(
|
|
194
|
-
for (let e =
|
|
195
|
-
let t =
|
|
193
|
+
function fe(n) {
|
|
194
|
+
for (let e = n.depth; e >= 0; e--) {
|
|
195
|
+
let t = n.index(e), i = n.node(e);
|
|
196
196
|
if (t == 0) {
|
|
197
|
-
if (
|
|
197
|
+
if (i.type.spec.isolating)
|
|
198
198
|
return !0;
|
|
199
199
|
continue;
|
|
200
200
|
}
|
|
201
|
-
for (let r =
|
|
201
|
+
for (let r = i.child(t - 1); ; r = r.lastChild) {
|
|
202
202
|
if (r.childCount == 0 && !r.inlineContent || J(r.type))
|
|
203
203
|
return !0;
|
|
204
204
|
if (r.inlineContent)
|
|
@@ -207,15 +207,15 @@ function fe(i) {
|
|
|
207
207
|
}
|
|
208
208
|
return !0;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
for (let e =
|
|
212
|
-
let t =
|
|
213
|
-
if (t ==
|
|
214
|
-
if (
|
|
210
|
+
function me(n) {
|
|
211
|
+
for (let e = n.depth; e >= 0; e--) {
|
|
212
|
+
let t = n.indexAfter(e), i = n.node(e);
|
|
213
|
+
if (t == i.childCount) {
|
|
214
|
+
if (i.type.spec.isolating)
|
|
215
215
|
return !0;
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
for (let r =
|
|
218
|
+
for (let r = i.child(t); ; r = r.firstChild) {
|
|
219
219
|
if (r.childCount == 0 && !r.inlineContent || J(r.type))
|
|
220
220
|
return !0;
|
|
221
221
|
if (r.inlineContent)
|
|
@@ -224,64 +224,64 @@ function he(i) {
|
|
|
224
224
|
}
|
|
225
225
|
return !0;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return new
|
|
227
|
+
function ge() {
|
|
228
|
+
return new R({
|
|
229
229
|
props: {
|
|
230
|
-
decorations:
|
|
231
|
-
createSelectionBetween(
|
|
232
|
-
return e.pos == t.pos &&
|
|
230
|
+
decorations: Ce,
|
|
231
|
+
createSelectionBetween(n, e, t) {
|
|
232
|
+
return e.pos == t.pos && h.valid(t) ? new h(t) : null;
|
|
233
233
|
},
|
|
234
|
-
handleClick:
|
|
235
|
-
handleKeyDown:
|
|
236
|
-
handleDOMEvents: { beforeinput:
|
|
234
|
+
handleClick: we,
|
|
235
|
+
handleKeyDown: ve,
|
|
236
|
+
handleDOMEvents: { beforeinput: ye }
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
ArrowLeft:
|
|
242
|
-
ArrowRight:
|
|
243
|
-
ArrowUp:
|
|
244
|
-
ArrowDown:
|
|
240
|
+
const ve = ae({
|
|
241
|
+
ArrowLeft: M("horiz", -1),
|
|
242
|
+
ArrowRight: M("horiz", 1),
|
|
243
|
+
ArrowUp: M("vert", -1),
|
|
244
|
+
ArrowDown: M("vert", 1)
|
|
245
245
|
});
|
|
246
|
-
function
|
|
247
|
-
const t =
|
|
248
|
-
return function(
|
|
249
|
-
let s =
|
|
246
|
+
function M(n, e) {
|
|
247
|
+
const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
248
|
+
return function(i, r, o) {
|
|
249
|
+
let s = i.selection, l = e > 0 ? s.$to : s.$from, a = s.empty;
|
|
250
250
|
if (s instanceof H) {
|
|
251
251
|
if (!o.endOfTextblock(t) || l.depth == 0)
|
|
252
252
|
return !1;
|
|
253
|
-
a = !1, l =
|
|
253
|
+
a = !1, l = i.doc.resolve(e > 0 ? l.after() : l.before());
|
|
254
254
|
}
|
|
255
|
-
let d =
|
|
256
|
-
return d ? (r && r(
|
|
255
|
+
let d = h.findGapCursorFrom(l, e, a);
|
|
256
|
+
return d ? (r && r(i.tr.setSelection(new h(d))), !0) : !1;
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
if (!
|
|
259
|
+
function we(n, e, t) {
|
|
260
|
+
if (!n || !n.editable)
|
|
261
261
|
return !1;
|
|
262
|
-
let
|
|
263
|
-
if (!
|
|
262
|
+
let i = n.state.doc.resolve(e);
|
|
263
|
+
if (!h.valid(i))
|
|
264
264
|
return !1;
|
|
265
|
-
let r =
|
|
266
|
-
return r && r.inside > -1 &&
|
|
265
|
+
let r = n.posAtCoords({ left: t.clientX, top: t.clientY });
|
|
266
|
+
return r && r.inside > -1 && U.isSelectable(n.state.doc.nodeAt(r.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new h(i))), !0);
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
if (e.inputType != "insertCompositionText" || !(
|
|
268
|
+
function ye(n, e) {
|
|
269
|
+
if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof h))
|
|
270
270
|
return !1;
|
|
271
|
-
let { $from: t } =
|
|
272
|
-
if (!
|
|
271
|
+
let { $from: t } = n.state.selection, i = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
|
|
272
|
+
if (!i)
|
|
273
273
|
return !1;
|
|
274
|
-
let r =
|
|
275
|
-
for (let s =
|
|
276
|
-
r =
|
|
277
|
-
let o =
|
|
278
|
-
return o.setSelection(H.near(o.doc.resolve(t.pos + 1))),
|
|
274
|
+
let r = L.empty;
|
|
275
|
+
for (let s = i.length - 1; s >= 0; s--)
|
|
276
|
+
r = L.from(i[s].createAndFill(null, r));
|
|
277
|
+
let o = n.state.tr.replace(t.pos, t.pos, new G(r, 0, 0));
|
|
278
|
+
return o.setSelection(H.near(o.doc.resolve(t.pos + 1))), n.dispatch(o), !1;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(
|
|
280
|
+
function Ce(n) {
|
|
281
|
+
if (!(n.selection instanceof h))
|
|
282
282
|
return null;
|
|
283
283
|
let e = document.createElement("div");
|
|
284
|
-
return e.className = "ProseMirror-gapcursor",
|
|
284
|
+
return e.className = "ProseMirror-gapcursor", de.create(n.doc, [ce.widget(n.selection.head, e, { key: "gapcursor" })]);
|
|
285
285
|
}
|
|
286
286
|
var D = 200, m = function() {
|
|
287
287
|
};
|
|
@@ -292,7 +292,7 @@ m.prototype.prepend = function(e) {
|
|
|
292
292
|
return e.length ? m.from(e).append(this) : this;
|
|
293
293
|
};
|
|
294
294
|
m.prototype.appendInner = function(e) {
|
|
295
|
-
return new
|
|
295
|
+
return new Ee(this, e);
|
|
296
296
|
};
|
|
297
297
|
m.prototype.slice = function(e, t) {
|
|
298
298
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? m.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
@@ -301,24 +301,24 @@ m.prototype.get = function(e) {
|
|
|
301
301
|
if (!(e < 0 || e >= this.length))
|
|
302
302
|
return this.getInner(e);
|
|
303
303
|
};
|
|
304
|
-
m.prototype.forEach = function(e, t,
|
|
305
|
-
t === void 0 && (t = 0),
|
|
304
|
+
m.prototype.forEach = function(e, t, i) {
|
|
305
|
+
t === void 0 && (t = 0), i === void 0 && (i = this.length), t <= i ? this.forEachInner(e, t, i, 0) : this.forEachInvertedInner(e, t, i, 0);
|
|
306
306
|
};
|
|
307
|
-
m.prototype.map = function(e, t,
|
|
308
|
-
t === void 0 && (t = 0),
|
|
307
|
+
m.prototype.map = function(e, t, i) {
|
|
308
|
+
t === void 0 && (t = 0), i === void 0 && (i = this.length);
|
|
309
309
|
var r = [];
|
|
310
310
|
return this.forEach(function(o, s) {
|
|
311
311
|
return r.push(e(o, s));
|
|
312
|
-
}, t,
|
|
312
|
+
}, t, i), r;
|
|
313
313
|
};
|
|
314
314
|
m.from = function(e) {
|
|
315
|
-
return e instanceof m ? e : e && e.length ? new
|
|
315
|
+
return e instanceof m ? e : e && e.length ? new Q(e) : m.empty;
|
|
316
316
|
};
|
|
317
|
-
var
|
|
318
|
-
function e(
|
|
319
|
-
|
|
317
|
+
var Q = /* @__PURE__ */ (function(n) {
|
|
318
|
+
function e(i) {
|
|
319
|
+
n.call(this), this.values = i;
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e;
|
|
322
322
|
var t = { length: { configurable: !0 }, depth: { configurable: !0 } };
|
|
323
323
|
return e.prototype.flatten = function() {
|
|
324
324
|
return this.values;
|
|
@@ -346,41 +346,41 @@ var Z = /* @__PURE__ */ (function(i) {
|
|
|
346
346
|
return 0;
|
|
347
347
|
}, Object.defineProperties(e.prototype, t), e;
|
|
348
348
|
})(m);
|
|
349
|
-
m.empty = new
|
|
350
|
-
var
|
|
351
|
-
function e(t,
|
|
352
|
-
|
|
349
|
+
m.empty = new Q([]);
|
|
350
|
+
var Ee = /* @__PURE__ */ (function(n) {
|
|
351
|
+
function e(t, i) {
|
|
352
|
+
n.call(this), this.left = t, this.right = i, this.length = t.length + i.length, this.depth = Math.max(t.depth, i.depth) + 1;
|
|
353
353
|
}
|
|
354
|
-
return
|
|
354
|
+
return n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
|
|
355
355
|
return this.left.flatten().concat(this.right.flatten());
|
|
356
|
-
}, e.prototype.getInner = function(
|
|
357
|
-
return
|
|
358
|
-
}, e.prototype.forEachInner = function(
|
|
356
|
+
}, e.prototype.getInner = function(i) {
|
|
357
|
+
return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
|
|
358
|
+
}, e.prototype.forEachInner = function(i, r, o, s) {
|
|
359
359
|
var l = this.left.length;
|
|
360
|
-
if (r < l && this.left.forEachInner(
|
|
360
|
+
if (r < l && this.left.forEachInner(i, r, Math.min(o, l), s) === !1 || o > l && this.right.forEachInner(i, Math.max(r - l, 0), Math.min(this.length, o) - l, s + l) === !1)
|
|
361
361
|
return !1;
|
|
362
|
-
}, e.prototype.forEachInvertedInner = function(
|
|
362
|
+
}, e.prototype.forEachInvertedInner = function(i, r, o, s) {
|
|
363
363
|
var l = this.left.length;
|
|
364
|
-
if (r > l && this.right.forEachInvertedInner(
|
|
364
|
+
if (r > l && this.right.forEachInvertedInner(i, r - l, Math.max(o, l) - l, s + l) === !1 || o < l && this.left.forEachInvertedInner(i, Math.min(r, l), o, s) === !1)
|
|
365
365
|
return !1;
|
|
366
|
-
}, e.prototype.sliceInner = function(
|
|
367
|
-
if (
|
|
366
|
+
}, e.prototype.sliceInner = function(i, r) {
|
|
367
|
+
if (i == 0 && r == this.length)
|
|
368
368
|
return this;
|
|
369
369
|
var o = this.left.length;
|
|
370
|
-
return r <= o ? this.left.slice(
|
|
371
|
-
}, e.prototype.leafAppend = function(
|
|
372
|
-
var r = this.right.leafAppend(
|
|
370
|
+
return r <= o ? this.left.slice(i, r) : i >= o ? this.right.slice(i - o, r - o) : this.left.slice(i, o).append(this.right.slice(0, r - o));
|
|
371
|
+
}, e.prototype.leafAppend = function(i) {
|
|
372
|
+
var r = this.right.leafAppend(i);
|
|
373
373
|
if (r)
|
|
374
374
|
return new e(this.left, r);
|
|
375
|
-
}, e.prototype.leafPrepend = function(
|
|
376
|
-
var r = this.left.leafPrepend(
|
|
375
|
+
}, e.prototype.leafPrepend = function(i) {
|
|
376
|
+
var r = this.left.leafPrepend(i);
|
|
377
377
|
if (r)
|
|
378
378
|
return new e(r, this.right);
|
|
379
|
-
}, e.prototype.appendInner = function(
|
|
380
|
-
return this.left.depth >= Math.max(this.right.depth,
|
|
379
|
+
}, e.prototype.appendInner = function(i) {
|
|
380
|
+
return this.left.depth >= Math.max(this.right.depth, i.depth) + 1 ? new e(this.left, new e(this.right, i)) : new e(this, i);
|
|
381
381
|
}, e;
|
|
382
382
|
})(m);
|
|
383
|
-
const
|
|
383
|
+
const be = 500;
|
|
384
384
|
class v {
|
|
385
385
|
constructor(e, t) {
|
|
386
386
|
this.items = e, this.eventCount = t;
|
|
@@ -390,46 +390,46 @@ class v {
|
|
|
390
390
|
popEvent(e, t) {
|
|
391
391
|
if (this.eventCount == 0)
|
|
392
392
|
return null;
|
|
393
|
-
let
|
|
394
|
-
for (; ;
|
|
395
|
-
if (this.items.get(
|
|
396
|
-
--
|
|
393
|
+
let i = this.items.length;
|
|
394
|
+
for (; ; i--)
|
|
395
|
+
if (this.items.get(i - 1).selection) {
|
|
396
|
+
--i;
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
let r, o;
|
|
400
|
-
t && (r = this.remapping(
|
|
400
|
+
t && (r = this.remapping(i, this.items.length), o = r.maps.length);
|
|
401
401
|
let s = e.tr, l, a, d = [], u = [];
|
|
402
402
|
return this.items.forEach((c, p) => {
|
|
403
403
|
if (!c.step) {
|
|
404
|
-
r || (r = this.remapping(
|
|
404
|
+
r || (r = this.remapping(i, p + 1), o = r.maps.length), o--, u.push(c);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
407
|
if (r) {
|
|
408
408
|
u.push(new w(c.map));
|
|
409
|
-
let
|
|
410
|
-
|
|
409
|
+
let f = c.step.map(r.slice(o)), g;
|
|
410
|
+
f && s.maybeStep(f).doc && (g = s.mapping.maps[s.mapping.maps.length - 1], d.push(new w(g, void 0, void 0, d.length + u.length))), o--, g && r.appendMap(g, o);
|
|
411
411
|
} else
|
|
412
412
|
s.maybeStep(c.step);
|
|
413
413
|
if (c.selection)
|
|
414
|
-
return l = r ? c.selection.map(r.slice(o)) : c.selection, a = new v(this.items.slice(0,
|
|
414
|
+
return l = r ? c.selection.map(r.slice(o)) : c.selection, a = new v(this.items.slice(0, i).append(u.reverse().concat(d)), this.eventCount - 1), !1;
|
|
415
415
|
}, this.items.length, 0), { remaining: a, transform: s, selection: l };
|
|
416
416
|
}
|
|
417
417
|
// Create a new branch with the given transform added.
|
|
418
|
-
addTransform(e, t,
|
|
418
|
+
addTransform(e, t, i, r) {
|
|
419
419
|
let o = [], s = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
|
|
420
420
|
for (let u = 0; u < e.steps.length; u++) {
|
|
421
|
-
let c = e.steps[u].invert(e.docs[u]), p = new w(e.mapping.maps[u], c, t),
|
|
422
|
-
(
|
|
421
|
+
let c = e.steps[u].invert(e.docs[u]), p = new w(e.mapping.maps[u], c, t), f;
|
|
422
|
+
(f = a && a.merge(p)) && (p = f, u ? o.pop() : l = l.slice(0, l.length - 1)), o.push(p), t && (s++, t = void 0), r || (a = p);
|
|
423
423
|
}
|
|
424
|
-
let d = s -
|
|
425
|
-
return d >
|
|
424
|
+
let d = s - i.depth;
|
|
425
|
+
return d > Ae && (l = Pe(l, d), s -= d), new v(l.append(o), s);
|
|
426
426
|
}
|
|
427
427
|
remapping(e, t) {
|
|
428
|
-
let
|
|
428
|
+
let i = new re();
|
|
429
429
|
return this.items.forEach((r, o) => {
|
|
430
|
-
let s = r.mirrorOffset != null && o - r.mirrorOffset >= e ?
|
|
431
|
-
|
|
432
|
-
}, e, t),
|
|
430
|
+
let s = r.mirrorOffset != null && o - r.mirrorOffset >= e ? i.maps.length - r.mirrorOffset : void 0;
|
|
431
|
+
i.appendMap(r.map, s);
|
|
432
|
+
}, e, t), i;
|
|
433
433
|
}
|
|
434
434
|
addMaps(e) {
|
|
435
435
|
return this.eventCount == 0 ? this : new v(this.items.append(e.map((t) => new w(t))), this.eventCount);
|
|
@@ -441,28 +441,28 @@ class v {
|
|
|
441
441
|
rebased(e, t) {
|
|
442
442
|
if (!this.eventCount)
|
|
443
443
|
return this;
|
|
444
|
-
let
|
|
444
|
+
let i = [], r = Math.max(0, this.items.length - t), o = e.mapping, s = e.steps.length, l = this.eventCount;
|
|
445
445
|
this.items.forEach((p) => {
|
|
446
446
|
p.selection && l--;
|
|
447
447
|
}, r);
|
|
448
448
|
let a = t;
|
|
449
449
|
this.items.forEach((p) => {
|
|
450
|
-
let
|
|
451
|
-
if (
|
|
450
|
+
let f = o.getMirror(--a);
|
|
451
|
+
if (f == null)
|
|
452
452
|
return;
|
|
453
|
-
s = Math.min(s,
|
|
454
|
-
let g = o.maps[
|
|
453
|
+
s = Math.min(s, f);
|
|
454
|
+
let g = o.maps[f];
|
|
455
455
|
if (p.step) {
|
|
456
|
-
let
|
|
457
|
-
P && l++,
|
|
456
|
+
let b = e.steps[f].invert(e.docs[f]), P = p.selection && p.selection.map(o.slice(a + 1, f));
|
|
457
|
+
P && l++, i.push(new w(g, b, P));
|
|
458
458
|
} else
|
|
459
|
-
|
|
459
|
+
i.push(new w(g));
|
|
460
460
|
}, r);
|
|
461
461
|
let d = [];
|
|
462
462
|
for (let p = t; p < s; p++)
|
|
463
463
|
d.push(new w(o.maps[p]));
|
|
464
|
-
let u = this.items.slice(0, r).append(d).append(
|
|
465
|
-
return c.emptyItemCount() >
|
|
464
|
+
let u = this.items.slice(0, r).append(d).append(i), c = new v(u, l);
|
|
465
|
+
return c.emptyItemCount() > be && (c = c.compress(this.items.length - i.length)), c;
|
|
466
466
|
}
|
|
467
467
|
emptyItemCount() {
|
|
468
468
|
let e = 0;
|
|
@@ -477,33 +477,33 @@ class v {
|
|
|
477
477
|
// because `rebased` relies on a clean, untouched set of items in
|
|
478
478
|
// order to associate old items with rebased steps.
|
|
479
479
|
compress(e = this.items.length) {
|
|
480
|
-
let t = this.remapping(0, e),
|
|
480
|
+
let t = this.remapping(0, e), i = t.maps.length, r = [], o = 0;
|
|
481
481
|
return this.items.forEach((s, l) => {
|
|
482
482
|
if (l >= e)
|
|
483
483
|
r.push(s), s.selection && o++;
|
|
484
484
|
else if (s.step) {
|
|
485
|
-
let a = s.step.map(t.slice(
|
|
486
|
-
if (
|
|
487
|
-
let u = s.selection && s.selection.map(t.slice(
|
|
485
|
+
let a = s.step.map(t.slice(i)), d = a && a.getMap();
|
|
486
|
+
if (i--, d && t.appendMap(d, i), a) {
|
|
487
|
+
let u = s.selection && s.selection.map(t.slice(i));
|
|
488
488
|
u && o++;
|
|
489
|
-
let c = new w(d.invert(), a, u), p,
|
|
490
|
-
(p = r.length && r[
|
|
489
|
+
let c = new w(d.invert(), a, u), p, f = r.length - 1;
|
|
490
|
+
(p = r.length && r[f].merge(c)) ? r[f] = p : r.push(c);
|
|
491
491
|
}
|
|
492
|
-
} else s.map &&
|
|
492
|
+
} else s.map && i--;
|
|
493
493
|
}, this.items.length, 0), new v(m.from(r.reverse()), o);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
v.empty = new v(m.empty, 0);
|
|
497
|
-
function
|
|
497
|
+
function Pe(n, e) {
|
|
498
498
|
let t;
|
|
499
|
-
return
|
|
500
|
-
if (
|
|
499
|
+
return n.forEach((i, r) => {
|
|
500
|
+
if (i.selection && e-- == 0)
|
|
501
501
|
return t = r, !1;
|
|
502
|
-
}),
|
|
502
|
+
}), n.slice(t);
|
|
503
503
|
}
|
|
504
504
|
class w {
|
|
505
|
-
constructor(e, t,
|
|
506
|
-
this.map = e, this.step = t, this.selection =
|
|
505
|
+
constructor(e, t, i, r) {
|
|
506
|
+
this.map = e, this.step = t, this.selection = i, this.mirrorOffset = r;
|
|
507
507
|
}
|
|
508
508
|
merge(e) {
|
|
509
509
|
if (this.step && e.step && !e.selection) {
|
|
@@ -514,63 +514,63 @@ class w {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
class y {
|
|
517
|
-
constructor(e, t,
|
|
518
|
-
this.done = e, this.undone = t, this.prevRanges =
|
|
517
|
+
constructor(e, t, i, r, o) {
|
|
518
|
+
this.done = e, this.undone = t, this.prevRanges = i, this.prevTime = r, this.prevComposition = o;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
const
|
|
522
|
-
function Ie(
|
|
521
|
+
const Ae = 20;
|
|
522
|
+
function Ie(n, e, t, i) {
|
|
523
523
|
let r = t.getMeta(E), o;
|
|
524
524
|
if (r)
|
|
525
525
|
return r.historyState;
|
|
526
|
-
t.getMeta(
|
|
526
|
+
t.getMeta(Te) && (n = new y(n.done, n.undone, null, 0, -1));
|
|
527
527
|
let s = t.getMeta("appendedTransaction");
|
|
528
528
|
if (t.steps.length == 0)
|
|
529
|
-
return
|
|
529
|
+
return n;
|
|
530
530
|
if (s && s.getMeta(E))
|
|
531
|
-
return s.getMeta(E).redo ? new y(
|
|
531
|
+
return s.getMeta(E).redo ? new y(n.done.addTransform(t, void 0, i, x(e)), n.undone, V(t.mapping.maps), n.prevTime, n.prevComposition) : new y(n.done, n.undone.addTransform(t, void 0, i, x(e)), null, n.prevTime, n.prevComposition);
|
|
532
532
|
if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
|
|
533
|
-
let l = t.getMeta("composition"), a =
|
|
534
|
-
return new y(
|
|
535
|
-
} else return (o = t.getMeta("rebased")) ? new y(
|
|
533
|
+
let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - i.newGroupDelay || !Me(t, n.prevRanges)), d = s ? k(n.prevRanges, t.mapping) : V(t.mapping.maps);
|
|
534
|
+
return new y(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, i, x(e)), v.empty, d, t.time, l ?? n.prevComposition);
|
|
535
|
+
} else return (o = t.getMeta("rebased")) ? new y(n.done.rebased(t, o), n.undone.rebased(t, o), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new y(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function Me(n, e) {
|
|
538
538
|
if (!e)
|
|
539
539
|
return !1;
|
|
540
|
-
if (!
|
|
540
|
+
if (!n.docChanged)
|
|
541
541
|
return !0;
|
|
542
542
|
let t = !1;
|
|
543
|
-
return
|
|
543
|
+
return n.mapping.maps[0].forEach((i, r) => {
|
|
544
544
|
for (let o = 0; o < e.length; o += 2)
|
|
545
|
-
|
|
545
|
+
i <= e[o + 1] && r >= e[o] && (t = !0);
|
|
546
546
|
}), t;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function V(n) {
|
|
549
549
|
let e = [];
|
|
550
|
-
for (let t =
|
|
551
|
-
|
|
550
|
+
for (let t = n.length - 1; t >= 0 && e.length == 0; t--)
|
|
551
|
+
n[t].forEach((i, r, o, s) => e.push(o, s));
|
|
552
552
|
return e;
|
|
553
553
|
}
|
|
554
|
-
function k(
|
|
555
|
-
if (!
|
|
554
|
+
function k(n, e) {
|
|
555
|
+
if (!n)
|
|
556
556
|
return null;
|
|
557
557
|
let t = [];
|
|
558
|
-
for (let
|
|
559
|
-
let r = e.map(i
|
|
558
|
+
for (let i = 0; i < n.length; i += 2) {
|
|
559
|
+
let r = e.map(n[i], 1), o = e.map(n[i + 1], -1);
|
|
560
560
|
r <= o && t.push(r, o);
|
|
561
561
|
}
|
|
562
562
|
return t;
|
|
563
563
|
}
|
|
564
|
-
function xe(
|
|
565
|
-
let
|
|
564
|
+
function xe(n, e, t) {
|
|
565
|
+
let i = x(e), r = E.get(e).spec.config, o = (t ? n.undone : n.done).popEvent(e, i);
|
|
566
566
|
if (!o)
|
|
567
567
|
return null;
|
|
568
|
-
let s = o.selection.resolve(o.transform.doc), l = (t ?
|
|
568
|
+
let s = o.selection.resolve(o.transform.doc), l = (t ? n.done : n.undone).addTransform(o.transform, e.selection.getBookmark(), r, i), a = new y(t ? l : o.remaining, t ? o.remaining : l, null, 0, -1);
|
|
569
569
|
return o.transform.setSelection(s).setMeta(E, { redo: t, historyState: a });
|
|
570
570
|
}
|
|
571
571
|
let z = !1, B = null;
|
|
572
|
-
function
|
|
573
|
-
let e =
|
|
572
|
+
function x(n) {
|
|
573
|
+
let e = n.plugins;
|
|
574
574
|
if (B != e) {
|
|
575
575
|
z = !1, B = e;
|
|
576
576
|
for (let t = 0; t < e.length; t++)
|
|
@@ -581,53 +581,53 @@ function S(i) {
|
|
|
581
581
|
}
|
|
582
582
|
return z;
|
|
583
583
|
}
|
|
584
|
-
const E = new W("history"),
|
|
585
|
-
function
|
|
586
|
-
return
|
|
587
|
-
depth:
|
|
588
|
-
newGroupDelay:
|
|
589
|
-
}, new
|
|
584
|
+
const E = new W("history"), Te = new W("closeHistory");
|
|
585
|
+
function Se(n = {}) {
|
|
586
|
+
return n = {
|
|
587
|
+
depth: n.depth || 100,
|
|
588
|
+
newGroupDelay: n.newGroupDelay || 500
|
|
589
|
+
}, new R({
|
|
590
590
|
key: E,
|
|
591
591
|
state: {
|
|
592
592
|
init() {
|
|
593
593
|
return new y(v.empty, v.empty, null, 0, -1);
|
|
594
594
|
},
|
|
595
|
-
apply(e, t,
|
|
596
|
-
return Ie(t,
|
|
595
|
+
apply(e, t, i) {
|
|
596
|
+
return Ie(t, i, e, n);
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
|
-
config:
|
|
599
|
+
config: n,
|
|
600
600
|
props: {
|
|
601
601
|
handleDOMEvents: {
|
|
602
602
|
beforeinput(e, t) {
|
|
603
|
-
let
|
|
603
|
+
let i = t.inputType, r = i == "historyUndo" ? q : i == "historyRedo" ? ee : null;
|
|
604
604
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return (t,
|
|
610
|
+
function $(n, e) {
|
|
611
|
+
return (t, i) => {
|
|
612
612
|
let r = E.getState(t);
|
|
613
|
-
if (!r || (
|
|
613
|
+
if (!r || (n ? r.undone : r.done).eventCount == 0)
|
|
614
614
|
return !1;
|
|
615
|
-
if (
|
|
616
|
-
let o = xe(r, t,
|
|
617
|
-
o &&
|
|
615
|
+
if (i) {
|
|
616
|
+
let o = xe(r, t, n);
|
|
617
|
+
o && i(e ? o.scrollIntoView() : o);
|
|
618
618
|
}
|
|
619
619
|
return !0;
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
const q =
|
|
622
|
+
const q = $(!1, !0), ee = $(!0, !0);
|
|
623
623
|
C.create({
|
|
624
624
|
name: "characterCount",
|
|
625
625
|
addOptions() {
|
|
626
626
|
return {
|
|
627
627
|
limit: null,
|
|
628
628
|
mode: "textSize",
|
|
629
|
-
textCounter: (
|
|
630
|
-
wordCounter: (
|
|
629
|
+
textCounter: (n) => n.length,
|
|
630
|
+
wordCounter: (n) => n.split(" ").filter((e) => e !== "").length
|
|
631
631
|
};
|
|
632
632
|
},
|
|
633
633
|
addStorage() {
|
|
@@ -637,53 +637,53 @@ C.create({
|
|
|
637
637
|
};
|
|
638
638
|
},
|
|
639
639
|
onBeforeCreate() {
|
|
640
|
-
this.storage.characters = (
|
|
641
|
-
const e = (
|
|
642
|
-
if (((
|
|
643
|
-
const
|
|
644
|
-
return this.options.textCounter(
|
|
640
|
+
this.storage.characters = (n) => {
|
|
641
|
+
const e = (n == null ? void 0 : n.node) || this.editor.state.doc;
|
|
642
|
+
if (((n == null ? void 0 : n.mode) || this.options.mode) === "textSize") {
|
|
643
|
+
const i = e.textBetween(0, e.content.size, void 0, " ");
|
|
644
|
+
return this.options.textCounter(i);
|
|
645
645
|
}
|
|
646
646
|
return e.nodeSize;
|
|
647
|
-
}, this.storage.words = (
|
|
648
|
-
const e = (
|
|
647
|
+
}, this.storage.words = (n) => {
|
|
648
|
+
const e = (n == null ? void 0 : n.node) || this.editor.state.doc, t = e.textBetween(0, e.content.size, " ", " ");
|
|
649
649
|
return this.options.wordCounter(t);
|
|
650
650
|
};
|
|
651
651
|
},
|
|
652
652
|
addProseMirrorPlugins() {
|
|
653
|
-
let
|
|
653
|
+
let n = !1;
|
|
654
654
|
return [
|
|
655
|
-
new
|
|
656
|
-
key: new
|
|
657
|
-
appendTransaction: (e, t,
|
|
658
|
-
if (
|
|
655
|
+
new A({
|
|
656
|
+
key: new I("characterCount"),
|
|
657
|
+
appendTransaction: (e, t, i) => {
|
|
658
|
+
if (n)
|
|
659
659
|
return;
|
|
660
660
|
const r = this.options.limit;
|
|
661
661
|
if (r == null || r === 0) {
|
|
662
|
-
|
|
662
|
+
n = !0;
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
-
const o = this.storage.characters({ node:
|
|
665
|
+
const o = this.storage.characters({ node: i.doc });
|
|
666
666
|
if (o > r) {
|
|
667
667
|
const s = o - r, l = 0, a = s;
|
|
668
668
|
console.warn(
|
|
669
669
|
`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`
|
|
670
670
|
);
|
|
671
|
-
const d =
|
|
672
|
-
return
|
|
671
|
+
const d = i.tr.deleteRange(l, a);
|
|
672
|
+
return n = !0, d;
|
|
673
673
|
}
|
|
674
|
-
|
|
674
|
+
n = !0;
|
|
675
675
|
},
|
|
676
676
|
filterTransaction: (e, t) => {
|
|
677
|
-
const
|
|
678
|
-
if (!e.docChanged ||
|
|
677
|
+
const i = this.options.limit;
|
|
678
|
+
if (!e.docChanged || i === 0 || i === null || i === void 0)
|
|
679
679
|
return !0;
|
|
680
680
|
const r = this.storage.characters({ node: t.doc }), o = this.storage.characters({ node: e.doc });
|
|
681
|
-
if (o <=
|
|
681
|
+
if (o <= i || r > i && o > i && o <= r)
|
|
682
682
|
return !0;
|
|
683
|
-
if (r >
|
|
683
|
+
if (r > i && o > i && o > r || !e.getMeta("paste"))
|
|
684
684
|
return !1;
|
|
685
|
-
const l = e.selection.$head.pos, a = o -
|
|
686
|
-
return e.deleteRange(d, u), !(this.storage.characters({ node: e.doc }) >
|
|
685
|
+
const l = e.selection.$head.pos, a = o - i, d = l - a, u = l;
|
|
686
|
+
return e.deleteRange(d, u), !(this.storage.characters({ node: e.doc }) > i);
|
|
687
687
|
}
|
|
688
688
|
})
|
|
689
689
|
];
|
|
@@ -699,7 +699,7 @@ C.create({
|
|
|
699
699
|
};
|
|
700
700
|
},
|
|
701
701
|
addProseMirrorPlugins() {
|
|
702
|
-
return [
|
|
702
|
+
return [pe(this.options)];
|
|
703
703
|
}
|
|
704
704
|
});
|
|
705
705
|
C.create({
|
|
@@ -712,15 +712,15 @@ C.create({
|
|
|
712
712
|
},
|
|
713
713
|
addProseMirrorPlugins() {
|
|
714
714
|
return [
|
|
715
|
-
new
|
|
716
|
-
key: new
|
|
715
|
+
new A({
|
|
716
|
+
key: new I("focus"),
|
|
717
717
|
props: {
|
|
718
|
-
decorations: ({ doc:
|
|
719
|
-
const { isEditable: t, isFocused:
|
|
720
|
-
if (!t || !
|
|
721
|
-
return
|
|
718
|
+
decorations: ({ doc: n, selection: e }) => {
|
|
719
|
+
const { isEditable: t, isFocused: i } = this.editor, { anchor: r } = e, o = [];
|
|
720
|
+
if (!t || !i)
|
|
721
|
+
return S.create(n, []);
|
|
722
722
|
let s = 0;
|
|
723
|
-
this.options.mode === "deepest" &&
|
|
723
|
+
this.options.mode === "deepest" && n.descendants((a, d) => {
|
|
724
724
|
if (a.isText)
|
|
725
725
|
return;
|
|
726
726
|
if (!(r >= d && r <= d + a.nodeSize - 1))
|
|
@@ -728,17 +728,17 @@ C.create({
|
|
|
728
728
|
s += 1;
|
|
729
729
|
});
|
|
730
730
|
let l = 0;
|
|
731
|
-
return
|
|
731
|
+
return n.descendants((a, d) => {
|
|
732
732
|
if (a.isText || !(r >= d && r <= d + a.nodeSize - 1))
|
|
733
733
|
return !1;
|
|
734
734
|
if (l += 1, this.options.mode === "deepest" && s - l > 0 || this.options.mode === "shallowest" && l > 1)
|
|
735
735
|
return this.options.mode === "deepest";
|
|
736
736
|
o.push(
|
|
737
|
-
|
|
737
|
+
N.node(d, d + a.nodeSize, {
|
|
738
738
|
class: this.options.className
|
|
739
739
|
})
|
|
740
740
|
);
|
|
741
|
-
}),
|
|
741
|
+
}), S.create(n, o);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
})
|
|
@@ -748,26 +748,31 @@ C.create({
|
|
|
748
748
|
C.create({
|
|
749
749
|
name: "gapCursor",
|
|
750
750
|
addProseMirrorPlugins() {
|
|
751
|
-
return [
|
|
751
|
+
return [ge()];
|
|
752
752
|
},
|
|
753
|
-
extendNodeSchema(
|
|
753
|
+
extendNodeSchema(n) {
|
|
754
754
|
var e;
|
|
755
755
|
const t = {
|
|
756
|
-
name:
|
|
757
|
-
options:
|
|
758
|
-
storage:
|
|
756
|
+
name: n.name,
|
|
757
|
+
options: n.options,
|
|
758
|
+
storage: n.storage
|
|
759
759
|
};
|
|
760
760
|
return {
|
|
761
|
-
allowGapCursor: (e =
|
|
761
|
+
allowGapCursor: (e = ie(oe(n, "allowGapCursor", t))) != null ? e : null
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
764
|
});
|
|
765
|
+
var K = "placeholder";
|
|
766
|
+
function Oe(n) {
|
|
767
|
+
return n.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
768
|
+
}
|
|
765
769
|
C.create({
|
|
766
770
|
name: "placeholder",
|
|
767
771
|
addOptions() {
|
|
768
772
|
return {
|
|
769
773
|
emptyEditorClass: "is-editor-empty",
|
|
770
774
|
emptyNodeClass: "is-empty",
|
|
775
|
+
dataAttribute: K,
|
|
771
776
|
placeholder: "Write something …",
|
|
772
777
|
showOnlyWhenEditable: !0,
|
|
773
778
|
showOnlyCurrent: !0,
|
|
@@ -775,33 +780,36 @@ C.create({
|
|
|
775
780
|
};
|
|
776
781
|
},
|
|
777
782
|
addProseMirrorPlugins() {
|
|
783
|
+
const n = this.options.dataAttribute ? `data-${Oe(this.options.dataAttribute)}` : `data-${K}`;
|
|
778
784
|
return [
|
|
779
|
-
new
|
|
780
|
-
key: new
|
|
785
|
+
new A({
|
|
786
|
+
key: new I("placeholder"),
|
|
781
787
|
props: {
|
|
782
|
-
decorations: ({ doc:
|
|
783
|
-
const
|
|
784
|
-
if (!
|
|
788
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
789
|
+
const i = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
|
|
790
|
+
if (!i)
|
|
785
791
|
return null;
|
|
786
|
-
const
|
|
787
|
-
return
|
|
788
|
-
const
|
|
789
|
-
if (
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
const c =
|
|
793
|
-
|
|
794
|
-
|
|
792
|
+
const s = this.editor.isEmpty;
|
|
793
|
+
return e.descendants((l, a) => {
|
|
794
|
+
const d = r >= a && r <= a + l.nodeSize, u = !l.isLeaf && se(l);
|
|
795
|
+
if (!l.type.isTextblock)
|
|
796
|
+
return this.options.includeChildren;
|
|
797
|
+
if ((d || !this.options.showOnlyCurrent) && u) {
|
|
798
|
+
const c = [this.options.emptyNodeClass];
|
|
799
|
+
s && c.push(this.options.emptyEditorClass);
|
|
800
|
+
const p = N.node(a, a + l.nodeSize, {
|
|
801
|
+
class: c.join(" "),
|
|
802
|
+
[n]: typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
795
803
|
editor: this.editor,
|
|
796
|
-
node:
|
|
797
|
-
pos:
|
|
798
|
-
hasAnchor:
|
|
804
|
+
node: l,
|
|
805
|
+
pos: a,
|
|
806
|
+
hasAnchor: d
|
|
799
807
|
}) : this.options.placeholder
|
|
800
808
|
});
|
|
801
|
-
|
|
809
|
+
o.push(p);
|
|
802
810
|
}
|
|
803
811
|
return this.options.includeChildren;
|
|
804
|
-
}),
|
|
812
|
+
}), S.create(e, o);
|
|
805
813
|
}
|
|
806
814
|
}
|
|
807
815
|
})
|
|
@@ -816,14 +824,14 @@ C.create({
|
|
|
816
824
|
};
|
|
817
825
|
},
|
|
818
826
|
addProseMirrorPlugins() {
|
|
819
|
-
const { editor:
|
|
827
|
+
const { editor: n, options: e } = this;
|
|
820
828
|
return [
|
|
821
|
-
new
|
|
822
|
-
key: new
|
|
829
|
+
new A({
|
|
830
|
+
key: new I("selection"),
|
|
823
831
|
props: {
|
|
824
832
|
decorations(t) {
|
|
825
|
-
return t.selection.empty ||
|
|
826
|
-
|
|
833
|
+
return t.selection.empty || n.isFocused || !n.isEditable || le(t.selection) || n.view.dragging ? null : S.create(t.doc, [
|
|
834
|
+
N.inline(t.selection.from, t.selection.to, {
|
|
827
835
|
class: e.className
|
|
828
836
|
})
|
|
829
837
|
]);
|
|
@@ -833,8 +841,8 @@ C.create({
|
|
|
833
841
|
];
|
|
834
842
|
}
|
|
835
843
|
});
|
|
836
|
-
function
|
|
837
|
-
return e && Array.isArray(
|
|
844
|
+
function _({ types: n, node: e }) {
|
|
845
|
+
return e && Array.isArray(n) && n.includes(e.type) || (e == null ? void 0 : e.type) === n;
|
|
838
846
|
}
|
|
839
847
|
C.create({
|
|
840
848
|
name: "trailingNode",
|
|
@@ -845,10 +853,10 @@ C.create({
|
|
|
845
853
|
};
|
|
846
854
|
},
|
|
847
855
|
addProseMirrorPlugins() {
|
|
848
|
-
var
|
|
849
|
-
const e = new
|
|
856
|
+
var n;
|
|
857
|
+
const e = new I(this.name), t = this.options.node || ((n = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : n.name) || "paragraph", i = Object.entries(this.editor.schema.nodes).map(([, r]) => r).filter((r) => (this.options.notAfter || []).concat(t).includes(r.name));
|
|
850
858
|
return [
|
|
851
|
-
new
|
|
859
|
+
new A({
|
|
852
860
|
key: e,
|
|
853
861
|
appendTransaction: (r, o, s) => {
|
|
854
862
|
const { doc: l, tr: a, schema: d } = s, u = e.getState(s), c = l.content.size, p = d.nodes[t];
|
|
@@ -858,20 +866,20 @@ C.create({
|
|
|
858
866
|
state: {
|
|
859
867
|
init: (r, o) => {
|
|
860
868
|
const s = o.tr.doc.lastChild;
|
|
861
|
-
return !
|
|
869
|
+
return !_({ node: s, types: i });
|
|
862
870
|
},
|
|
863
871
|
apply: (r, o) => {
|
|
864
872
|
if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
|
|
865
873
|
return o;
|
|
866
874
|
const s = r.doc.lastChild;
|
|
867
|
-
return !
|
|
875
|
+
return !_({ node: s, types: i });
|
|
868
876
|
}
|
|
869
877
|
}
|
|
870
878
|
})
|
|
871
879
|
];
|
|
872
880
|
}
|
|
873
881
|
});
|
|
874
|
-
var
|
|
882
|
+
var De = C.create({
|
|
875
883
|
name: "undoRedo",
|
|
876
884
|
addOptions() {
|
|
877
885
|
return {
|
|
@@ -881,12 +889,12 @@ var Oe = C.create({
|
|
|
881
889
|
},
|
|
882
890
|
addCommands() {
|
|
883
891
|
return {
|
|
884
|
-
undo: () => ({ state:
|
|
885
|
-
redo: () => ({ state:
|
|
892
|
+
undo: () => ({ state: n, dispatch: e }) => q(n, e),
|
|
893
|
+
redo: () => ({ state: n, dispatch: e }) => ee(n, e)
|
|
886
894
|
};
|
|
887
895
|
},
|
|
888
896
|
addProseMirrorPlugins() {
|
|
889
|
-
return [
|
|
897
|
+
return [Se(this.options)];
|
|
890
898
|
},
|
|
891
899
|
addKeyboardShortcuts() {
|
|
892
900
|
return {
|
|
@@ -899,64 +907,63 @@ var Oe = C.create({
|
|
|
899
907
|
};
|
|
900
908
|
}
|
|
901
909
|
});
|
|
902
|
-
function
|
|
910
|
+
function Ke() {
|
|
903
911
|
var u;
|
|
904
|
-
const
|
|
912
|
+
const n = X(te.name), {
|
|
905
913
|
icon: e = void 0,
|
|
906
914
|
tooltip: t = void 0,
|
|
907
|
-
shortcutKeys:
|
|
915
|
+
shortcutKeys: i = void 0,
|
|
908
916
|
tooltipOptions: r = {},
|
|
909
917
|
action: o = void 0,
|
|
910
918
|
isActive: s = void 0
|
|
911
|
-
} = ((u =
|
|
919
|
+
} = ((u = n == null ? void 0 : n.componentProps) == null ? void 0 : u.undo) ?? {}, { disabled: l } = Y(s), a = ue[e], d = () => {
|
|
912
920
|
l || o && o();
|
|
913
921
|
};
|
|
914
|
-
return !
|
|
915
|
-
|
|
922
|
+
return !n || !a ? /* @__PURE__ */ O(j, {}) : /* @__PURE__ */ O(
|
|
923
|
+
Z,
|
|
916
924
|
{
|
|
917
925
|
action: d,
|
|
918
926
|
disabled: l,
|
|
919
927
|
icon: e,
|
|
920
|
-
shortcutKeys:
|
|
928
|
+
shortcutKeys: i,
|
|
921
929
|
tooltip: t,
|
|
922
930
|
tooltipOptions: r
|
|
923
931
|
}
|
|
924
932
|
);
|
|
925
933
|
}
|
|
926
|
-
function
|
|
934
|
+
function _e() {
|
|
927
935
|
var d;
|
|
928
|
-
const
|
|
936
|
+
const n = X(te.name), {
|
|
929
937
|
icon: e = void 0,
|
|
930
938
|
tooltip: t = void 0,
|
|
931
|
-
shortcutKeys:
|
|
939
|
+
shortcutKeys: i = void 0,
|
|
932
940
|
tooltipOptions: r = {},
|
|
933
941
|
action: o = void 0,
|
|
934
942
|
isActive: s = void 0
|
|
935
|
-
} = ((d =
|
|
943
|
+
} = ((d = n == null ? void 0 : n.componentProps) == null ? void 0 : d.redo) ?? {}, { disabled: l } = Y(s), a = () => {
|
|
936
944
|
l || o && o();
|
|
937
945
|
};
|
|
938
|
-
return
|
|
939
|
-
|
|
946
|
+
return n ? /* @__PURE__ */ O(
|
|
947
|
+
Z,
|
|
940
948
|
{
|
|
941
949
|
action: a,
|
|
942
950
|
disabled: l,
|
|
943
951
|
icon: e,
|
|
944
|
-
shortcutKeys:
|
|
952
|
+
shortcutKeys: i,
|
|
945
953
|
tooltip: t,
|
|
946
954
|
tooltipOptions: r
|
|
947
955
|
}
|
|
948
|
-
) : /* @__PURE__ */
|
|
956
|
+
) : /* @__PURE__ */ O(j, {});
|
|
949
957
|
}
|
|
950
|
-
const
|
|
951
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
958
|
+
const te = /* @__PURE__ */ De.extend({
|
|
952
959
|
//@ts-expect-error
|
|
953
960
|
addOptions() {
|
|
954
|
-
var
|
|
961
|
+
var n;
|
|
955
962
|
return {
|
|
956
|
-
...(
|
|
963
|
+
...(n = this.parent) == null ? void 0 : n.call(this),
|
|
957
964
|
depth: 100,
|
|
958
965
|
newGroupDelay: 500,
|
|
959
|
-
button: ({ editor: e, t, extension:
|
|
966
|
+
button: ({ editor: e, t, extension: i }) => {
|
|
960
967
|
var r, o;
|
|
961
968
|
return {
|
|
962
969
|
componentProps: {
|
|
@@ -964,7 +971,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
964
971
|
action: () => {
|
|
965
972
|
e.chain().focus().undo().run();
|
|
966
973
|
},
|
|
967
|
-
shortcutKeys: ((r =
|
|
974
|
+
shortcutKeys: ((r = i.options.shortcutKeys) == null ? void 0 : r[0]) ?? ["mod", "Z"],
|
|
968
975
|
isActive: () => e.can().undo(),
|
|
969
976
|
icon: "Undo2",
|
|
970
977
|
tooltip: t("editor.undo.tooltip")
|
|
@@ -973,7 +980,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
973
980
|
action: () => {
|
|
974
981
|
e.chain().focus().redo().run();
|
|
975
982
|
},
|
|
976
|
-
shortcutKeys: ((o =
|
|
983
|
+
shortcutKeys: ((o = i.options.shortcutKeys) == null ? void 0 : o[1]) ?? ["shift", "mod", "Z"],
|
|
977
984
|
isActive: () => e.can().redo(),
|
|
978
985
|
icon: "Redo2",
|
|
979
986
|
tooltip: t("editor.redo.tooltip")
|
|
@@ -985,7 +992,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
985
992
|
}
|
|
986
993
|
});
|
|
987
994
|
export {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
995
|
+
te as History,
|
|
996
|
+
_e as RichTextRedo,
|
|
997
|
+
Ke as RichTextUndo
|
|
991
998
|
};
|