reactjs-tiptap-editor 1.0.16 → 1.0.18
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-a8LhmHXe.js → ActionMenuButton-BOjCHFTA.js} +12 -16
- package/lib/ActionMenuButton-Df077oOH.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +47 -89
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +11 -14
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +13 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +15 -18
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +113 -113
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +12 -14
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +8 -11
- package/lib/CodeBlock.cjs +37 -37
- package/lib/CodeBlock.js +1566 -1613
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +9 -11
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +62 -82
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +27 -15
- package/lib/Drawer-DwrlY_lY.cjs +1 -0
- package/lib/Drawer-DxOoRiGQ.js +1099 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +71 -97
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +265 -5
- package/lib/ExportPdf.cjs +4 -4
- package/lib/ExportPdf.js +20 -31
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +11 -11
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +16 -39
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +25 -41
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +51 -65
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +60 -76
- package/lib/History.cjs +1 -1
- package/lib/History.js +322 -320
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +8 -11
- package/lib/{Iframe-CmjbQQcz.js → Iframe-AhNV5WH5.js} +52 -65
- package/lib/Iframe-C6pBw-AF.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +5 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +148 -181
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +19 -26
- package/lib/{Indent-BoG-vpIE.js → Indent-DZ5PcJA4.js} +24 -30
- package/lib/Indent-Do-X0AsY.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +11 -14
- package/lib/Katex-CIC9ygbL.cjs +4 -0
- package/lib/{Katex-ByL9snce.js → Katex-bIgoenn_.js} +243 -262
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +5 -4
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +23 -34
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-B0ZaACZO.cjs +5 -0
- package/lib/{LinkEditBlock-Ckih17pU.js → LinkEditBlock-D_cF9fnc.js} +324 -381
- 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 +125 -154
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +28 -40
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +13 -16
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +114 -186
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +15 -14
- package/lib/SlashCommandNodeView-Ba03hlVZ.cjs +1 -0
- package/lib/{SlashCommandNodeView-B2g1MbgN.js → SlashCommandNodeView-cg0x3NRF.js} +72 -79
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +12 -15
- package/lib/{Table-BEwrZVup.js → Table-KqLiT5wG.js} +85 -125
- package/lib/Table-ddU2LSc6.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 +18 -21
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +65 -78
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +51 -77
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +7 -10
- package/lib/Twitter-BIiR78Jh.cjs +1 -0
- package/lib/{Twitter-4U_ZBhpv.js → Twitter-C1Lzqc7u.js} +567 -599
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +4 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -270
- package/lib/bubble.cjs +6 -4
- package/lib/bubble.js +3719 -3039
- package/lib/clsx-BWE7vnna.cjs +33 -0
- package/lib/clsx-eGVyq7ot.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/ReactBus.d.ts +11 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
- 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-CW3Kthwy.js → dropdown-menu-CexIkt_V.js} +8 -8
- package/lib/{dropdown-menu-eUeBXQeA.cjs → dropdown-menu-oSKIntXM.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/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-BUTn2LY6.cjs +1 -0
- package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
- package/lib/{index-CpTykZBR.js → index-BnW6t8z6.js} +23 -23
- package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
- package/lib/index-BtxvYLJ1.cjs +12 -0
- package/lib/{index-DR5tIdL7.js → index-C6xmkxrQ.js} +232 -217
- package/lib/index-CJ9pyCM4.cjs +1 -0
- package/lib/{index-neeeY2o7.cjs → index-D0lc95kr.cjs} +3 -3
- package/lib/index-DHUN85fV.js +4855 -0
- package/lib/index-DUpSE1Gb.cjs +1 -0
- package/lib/index-D_8P0LE5.js +1362 -0
- package/lib/{index-4bHF5ovf.js → index-RIXs7STX.js} +1 -1
- package/lib/index-mfGK4pFo.js +6469 -0
- package/lib/index-zig3Dj7A.cjs +22 -0
- package/lib/index.cjs +3 -3
- package/lib/index.js +60 -72
- 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-BYSZ3zBi.js +24 -0
- package/lib/popover-BcHDZqBt.cjs +1 -0
- package/lib/{renderNodeView-CSazLrKF.js → renderNodeView-BrM5kUj_.js} +2 -2
- package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-D1zydtli.cjs} +1 -1
- package/lib/{select-F0ZZ3VZB.js → select-C5SHDLFj.js} +8 -5
- package/lib/{select-Doa_-jkZ.cjs → select-DHjzKkcu.cjs} +1 -1
- package/lib/separator-BmixLrnJ.cjs +1 -0
- package/lib/separator-CFKVxAea.js +293 -0
- package/lib/store/editor.d.ts +1 -1
- package/lib/store/store.d.ts +2 -22
- package/lib/style.css +1 -1
- package/lib/{textarea-BAolHF_W.cjs → textarea-CasDcv3u.cjs} +1 -1
- package/lib/{textarea-tOsPnxHf.js → textarea-DNLrJoRl.js} +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -3
- package/lib/updatePosition-CBRjbQMH.js +16 -0
- package/lib/updatePosition-CfmY5Trk.cjs +1 -0
- package/lib/utils/checkIsVideoUrl.d.ts +1 -0
- package/lib/utils/columns.d.ts +1 -1
- package/lib/utils/customEvents/events.constant.d.ts +1 -0
- package/lib/utils/mitt.d.ts +6 -3
- package/lib/utils/pdf.d.ts +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/package.json +262 -247
- package/lib/ActionMenuButton-BYu0NyVo.cjs +0 -1
- package/lib/Drawer-CbOJ1Igo.js +0 -1379
- package/lib/Drawer-DNaDMoAk.cjs +0 -1
- package/lib/Excalidraw-DnHTVOj8.js +0 -355
- package/lib/Excalidraw-DxfO1lQ_.cjs +0 -1
- package/lib/Icon-C0TJMAOm.js +0 -12
- package/lib/Icon-DzK0_ztP.cjs +0 -1
- package/lib/Iframe-BSNCsofW.cjs +0 -1
- package/lib/Image-BZEFuS0P.js +0 -925
- package/lib/Image-iKsGKjvg.cjs +0 -1
- package/lib/Indent-Bou16OcB.cjs +0 -1
- package/lib/Katex-BqDocr3a.cjs +0 -4
- package/lib/LinkEditBlock-B0I0EUrt.cjs +0 -5
- package/lib/SlashCommandNodeView-BEJhEzba.cjs +0 -1
- package/lib/Table-BclWwp6P.cjs +0 -9
- package/lib/Twitter-Dtq6PEMC.cjs +0 -1
- package/lib/button-Bwn6gUuS.js +0 -43
- package/lib/button-CqJztfH2.cjs +0 -1
- package/lib/checkbox-BAzbZY2Y.cjs +0 -1
- package/lib/checkbox-B_rpz5Xq.js +0 -27
- package/lib/clsx-CXbNJWDD.cjs +0 -54
- package/lib/clsx-DSzxBzvL.js +0 -7391
- package/lib/dialog-CJvpoeMm.js +0 -101
- package/lib/dialog-CWYTvz5J.cjs +0 -1
- package/lib/events.constant-Dq21NPdV.cjs +0 -1
- package/lib/events.constant-do95b767.js +0 -21
- package/lib/extensions/Image/store.d.ts +0 -4
- package/lib/extensions/Video/store.d.ts +0 -4
- package/lib/file-BLas99n7.js +0 -43
- package/lib/file-i7e4nQY2.cjs +0 -1
- package/lib/index-BCzvbrf5.cjs +0 -12
- package/lib/index-CL7JP-Xz.js +0 -426
- package/lib/index-CjhjjJsN.cjs +0 -1
- package/lib/index-Cn-t3Zxw.cjs +0 -1
- package/lib/index-Cs6cp0Y6.cjs +0 -1
- package/lib/index-D8li6EQ4.js +0 -1351
- package/lib/index-DoiuU6VA.js +0 -2315
- package/lib/index-VhKd73hZ.cjs +0 -1
- package/lib/input-B1egKb-t.js +0 -21
- package/lib/input-ZGRt7lWR.cjs +0 -1
- package/lib/isNumber-BTYSVlKo.cjs +0 -1
- package/lib/isNumber-ClwLypY2.js +0 -15
- package/lib/label-Cjrzc5H2.js +0 -19
- package/lib/label-tzSPdqui.cjs +0 -1
- package/lib/popover-C6Cya3Cz.cjs +0 -1
- package/lib/popover-CeY3RbI5.js +0 -24
- package/lib/separator-CUh5Y7Rh.cjs +0 -1
- package/lib/separator-Cjn4YH8a.js +0 -329
- package/lib/store/fast-context.d.ts +0 -7
- package/lib/store-BsJz5QRC.js +0 -10
- package/lib/store-DjkMIIEN.cjs +0 -1
- package/lib/tabs-BP8ypR_m.cjs +0 -1
- package/lib/tabs-CBDjOLl_.js +0 -46
- package/lib/throttle-D040PfWL.js +0 -249
- package/lib/throttle-gTTvqDTW.cjs +0 -1
- package/lib/toggle-C_SSvDRy.cjs +0 -1
- package/lib/toggle-DEerYRil.js +0 -99
- package/lib/tooltip-BJIvosho.js +0 -24
- package/lib/tooltip-FS1rsvd3.cjs +0 -1
- package/lib/updatePosition-CDK7OR0i.js +0 -16
- package/lib/updatePosition-Cjuj2E26.cjs +0 -1
- package/lib/useButtonProps-CtZCbMQu.js +0 -136
- package/lib/useButtonProps-Cz4W5dC8.cjs +0 -1
- package/lib/utils/_event.d.ts +0 -13
- package/lib/utils/customEvents/customEvents.d.ts +0 -3
package/lib/History.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin as
|
|
3
|
-
import { DecorationSet as
|
|
4
|
-
import { k as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { A 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-mfGK4pFo.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-BnW6t8z6.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-DHUN85fV.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import "./index-DoiuU6VA.js";
|
|
9
8
|
import "./theme.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function ue(i = {}) {
|
|
13
|
-
return new N({
|
|
9
|
+
function pe(n = {}) {
|
|
10
|
+
return new R({
|
|
14
11
|
view(e) {
|
|
15
|
-
return new
|
|
12
|
+
return new he(e, n);
|
|
16
13
|
}
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
|
-
class
|
|
16
|
+
class he {
|
|
20
17
|
constructor(e, t) {
|
|
21
|
-
var
|
|
22
|
-
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) => {
|
|
23
20
|
let o = (s) => {
|
|
24
21
|
this[r](s);
|
|
25
22
|
};
|
|
@@ -36,22 +33,22 @@ class pe {
|
|
|
36
33
|
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
37
34
|
}
|
|
38
35
|
updateOverlay() {
|
|
39
|
-
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;
|
|
40
37
|
if (t) {
|
|
41
38
|
let c = e.nodeBefore, p = e.nodeAfter;
|
|
42
39
|
if (c || p) {
|
|
43
|
-
let
|
|
44
|
-
if (
|
|
45
|
-
let g =
|
|
46
|
-
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);
|
|
47
44
|
let P = this.width / 2 * l;
|
|
48
|
-
|
|
45
|
+
i = { left: g.left, right: g.right, top: b - P, bottom: b + P };
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
|
-
if (!
|
|
49
|
+
if (!i) {
|
|
53
50
|
let c = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * s;
|
|
54
|
-
|
|
51
|
+
i = { left: c.left - p, right: c.left + p, top: c.top, bottom: c.bottom };
|
|
55
52
|
}
|
|
56
53
|
let a = this.editorView.dom.offsetParent;
|
|
57
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);
|
|
@@ -59,10 +56,10 @@ class pe {
|
|
|
59
56
|
if (!a || a == document.body && getComputedStyle(a).position == "static")
|
|
60
57
|
d = -pageXOffset, u = -pageYOffset;
|
|
61
58
|
else {
|
|
62
|
-
let c = a.getBoundingClientRect(), p = c.width / a.offsetWidth,
|
|
63
|
-
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;
|
|
64
61
|
}
|
|
65
|
-
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";
|
|
66
63
|
}
|
|
67
64
|
scheduleRemoval(e) {
|
|
68
65
|
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
@@ -70,11 +67,11 @@ class pe {
|
|
|
70
67
|
dragover(e) {
|
|
71
68
|
if (!this.editorView.editable)
|
|
72
69
|
return;
|
|
73
|
-
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;
|
|
74
71
|
if (t && !o) {
|
|
75
72
|
let s = t.pos;
|
|
76
73
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
77
|
-
let l =
|
|
74
|
+
let l = ne(this.editorView.state.doc, s, this.editorView.dragging.slice);
|
|
78
75
|
l != null && (s = l);
|
|
79
76
|
}
|
|
80
77
|
this.setCursor(s), this.scheduleRemoval(5e3);
|
|
@@ -90,7 +87,7 @@ class pe {
|
|
|
90
87
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
class
|
|
90
|
+
class h extends T {
|
|
94
91
|
/**
|
|
95
92
|
Create a gap cursor.
|
|
96
93
|
*/
|
|
@@ -98,14 +95,14 @@ class f extends A {
|
|
|
98
95
|
super(e, e);
|
|
99
96
|
}
|
|
100
97
|
map(e, t) {
|
|
101
|
-
let
|
|
102
|
-
return
|
|
98
|
+
let i = e.resolve(t.map(this.head));
|
|
99
|
+
return h.valid(i) ? new h(i) : T.near(i);
|
|
103
100
|
}
|
|
104
101
|
content() {
|
|
105
|
-
return
|
|
102
|
+
return G.empty;
|
|
106
103
|
}
|
|
107
104
|
eq(e) {
|
|
108
|
-
return e instanceof
|
|
105
|
+
return e instanceof h && e.head == this.head;
|
|
109
106
|
}
|
|
110
107
|
toJSON() {
|
|
111
108
|
return { type: "gapcursor", pos: this.head };
|
|
@@ -116,7 +113,7 @@ class f extends A {
|
|
|
116
113
|
static fromJSON(e, t) {
|
|
117
114
|
if (typeof t.pos != "number")
|
|
118
115
|
throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
119
|
-
return new
|
|
116
|
+
return new h(e.resolve(t.pos));
|
|
120
117
|
}
|
|
121
118
|
/**
|
|
122
119
|
@internal
|
|
@@ -129,20 +126,20 @@ class f extends A {
|
|
|
129
126
|
*/
|
|
130
127
|
static valid(e) {
|
|
131
128
|
let t = e.parent;
|
|
132
|
-
if (t.
|
|
129
|
+
if (t.inlineContent || !fe(e) || !me(e))
|
|
133
130
|
return !1;
|
|
134
|
-
let
|
|
135
|
-
if (
|
|
136
|
-
return
|
|
131
|
+
let i = t.type.spec.allowGapCursor;
|
|
132
|
+
if (i != null)
|
|
133
|
+
return i;
|
|
137
134
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
138
135
|
return r && r.isTextblock;
|
|
139
136
|
}
|
|
140
137
|
/**
|
|
141
138
|
@internal
|
|
142
139
|
*/
|
|
143
|
-
static findGapCursorFrom(e, t,
|
|
140
|
+
static findGapCursorFrom(e, t, i = !1) {
|
|
144
141
|
e: for (; ; ) {
|
|
145
|
-
if (!
|
|
142
|
+
if (!i && h.valid(e))
|
|
146
143
|
return e;
|
|
147
144
|
let r = e.pos, o = null;
|
|
148
145
|
for (let s = e.depth; ; s--) {
|
|
@@ -154,30 +151,30 @@ class f extends A {
|
|
|
154
151
|
return null;
|
|
155
152
|
r += t;
|
|
156
153
|
let a = e.doc.resolve(r);
|
|
157
|
-
if (
|
|
154
|
+
if (h.valid(a))
|
|
158
155
|
return a;
|
|
159
156
|
}
|
|
160
157
|
for (; ; ) {
|
|
161
158
|
let s = t > 0 ? o.firstChild : o.lastChild;
|
|
162
159
|
if (!s) {
|
|
163
|
-
if (o.isAtom && !o.isText && !
|
|
164
|
-
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;
|
|
165
162
|
continue e;
|
|
166
163
|
}
|
|
167
164
|
break;
|
|
168
165
|
}
|
|
169
166
|
o = s, r += t;
|
|
170
167
|
let l = e.doc.resolve(r);
|
|
171
|
-
if (
|
|
168
|
+
if (h.valid(l))
|
|
172
169
|
return l;
|
|
173
170
|
}
|
|
174
171
|
return null;
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
h.prototype.visible = !1;
|
|
176
|
+
h.findFrom = h.findGapCursorFrom;
|
|
177
|
+
T.jsonID("gapcursor", h);
|
|
181
178
|
class F {
|
|
182
179
|
constructor(e) {
|
|
183
180
|
this.pos = e;
|
|
@@ -187,22 +184,22 @@ class F {
|
|
|
187
184
|
}
|
|
188
185
|
resolve(e) {
|
|
189
186
|
let t = e.resolve(this.pos);
|
|
190
|
-
return
|
|
187
|
+
return h.valid(t) ? new h(t) : T.near(t);
|
|
191
188
|
}
|
|
192
189
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
190
|
+
function J(n) {
|
|
191
|
+
return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
|
|
195
192
|
}
|
|
196
|
-
function fe(
|
|
197
|
-
for (let e =
|
|
198
|
-
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);
|
|
199
196
|
if (t == 0) {
|
|
200
|
-
if (
|
|
197
|
+
if (i.type.spec.isolating)
|
|
201
198
|
return !0;
|
|
202
199
|
continue;
|
|
203
200
|
}
|
|
204
|
-
for (let r =
|
|
205
|
-
if (r.childCount == 0 && !r.inlineContent ||
|
|
201
|
+
for (let r = i.child(t - 1); ; r = r.lastChild) {
|
|
202
|
+
if (r.childCount == 0 && !r.inlineContent || J(r.type))
|
|
206
203
|
return !0;
|
|
207
204
|
if (r.inlineContent)
|
|
208
205
|
return !1;
|
|
@@ -210,16 +207,16 @@ function fe(i) {
|
|
|
210
207
|
}
|
|
211
208
|
return !0;
|
|
212
209
|
}
|
|
213
|
-
function
|
|
214
|
-
for (let e =
|
|
215
|
-
let t =
|
|
216
|
-
if (t ==
|
|
217
|
-
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)
|
|
218
215
|
return !0;
|
|
219
216
|
continue;
|
|
220
217
|
}
|
|
221
|
-
for (let r =
|
|
222
|
-
if (r.childCount == 0 && !r.inlineContent ||
|
|
218
|
+
for (let r = i.child(t); ; r = r.firstChild) {
|
|
219
|
+
if (r.childCount == 0 && !r.inlineContent || J(r.type))
|
|
223
220
|
return !0;
|
|
224
221
|
if (r.inlineContent)
|
|
225
222
|
return !1;
|
|
@@ -227,64 +224,64 @@ function he(i) {
|
|
|
227
224
|
}
|
|
228
225
|
return !0;
|
|
229
226
|
}
|
|
230
|
-
function
|
|
231
|
-
return new
|
|
227
|
+
function ge() {
|
|
228
|
+
return new R({
|
|
232
229
|
props: {
|
|
233
|
-
decorations:
|
|
234
|
-
createSelectionBetween(
|
|
235
|
-
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;
|
|
236
233
|
},
|
|
237
|
-
handleClick:
|
|
238
|
-
handleKeyDown:
|
|
239
|
-
handleDOMEvents: { beforeinput:
|
|
234
|
+
handleClick: we,
|
|
235
|
+
handleKeyDown: ve,
|
|
236
|
+
handleDOMEvents: { beforeinput: ye }
|
|
240
237
|
}
|
|
241
238
|
});
|
|
242
239
|
}
|
|
243
|
-
const
|
|
244
|
-
ArrowLeft:
|
|
245
|
-
ArrowRight:
|
|
246
|
-
ArrowUp:
|
|
247
|
-
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)
|
|
248
245
|
});
|
|
249
|
-
function
|
|
250
|
-
const t =
|
|
251
|
-
return function(
|
|
252
|
-
let s =
|
|
253
|
-
if (s instanceof
|
|
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
|
+
if (s instanceof H) {
|
|
254
251
|
if (!o.endOfTextblock(t) || l.depth == 0)
|
|
255
252
|
return !1;
|
|
256
|
-
a = !1, l =
|
|
253
|
+
a = !1, l = i.doc.resolve(e > 0 ? l.after() : l.before());
|
|
257
254
|
}
|
|
258
|
-
let d =
|
|
259
|
-
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;
|
|
260
257
|
};
|
|
261
258
|
}
|
|
262
|
-
function
|
|
263
|
-
if (!
|
|
259
|
+
function we(n, e, t) {
|
|
260
|
+
if (!n || !n.editable)
|
|
264
261
|
return !1;
|
|
265
|
-
let
|
|
266
|
-
if (!
|
|
262
|
+
let i = n.state.doc.resolve(e);
|
|
263
|
+
if (!h.valid(i))
|
|
267
264
|
return !1;
|
|
268
|
-
let r =
|
|
269
|
-
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);
|
|
270
267
|
}
|
|
271
|
-
function
|
|
272
|
-
if (e.inputType != "insertCompositionText" || !(
|
|
268
|
+
function ye(n, e) {
|
|
269
|
+
if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof h))
|
|
273
270
|
return !1;
|
|
274
|
-
let { $from: t } =
|
|
275
|
-
if (!
|
|
271
|
+
let { $from: t } = n.state.selection, i = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
|
|
272
|
+
if (!i)
|
|
276
273
|
return !1;
|
|
277
|
-
let r =
|
|
278
|
-
for (let s =
|
|
279
|
-
r =
|
|
280
|
-
let o =
|
|
281
|
-
return o.setSelection(
|
|
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;
|
|
282
279
|
}
|
|
283
|
-
function
|
|
284
|
-
if (!(
|
|
280
|
+
function Ce(n) {
|
|
281
|
+
if (!(n.selection instanceof h))
|
|
285
282
|
return null;
|
|
286
283
|
let e = document.createElement("div");
|
|
287
|
-
return e.className = "ProseMirror-gapcursor",
|
|
284
|
+
return e.className = "ProseMirror-gapcursor", de.create(n.doc, [ce.widget(n.selection.head, e, { key: "gapcursor" })]);
|
|
288
285
|
}
|
|
289
286
|
var D = 200, m = function() {
|
|
290
287
|
};
|
|
@@ -295,7 +292,7 @@ m.prototype.prepend = function(e) {
|
|
|
295
292
|
return e.length ? m.from(e).append(this) : this;
|
|
296
293
|
};
|
|
297
294
|
m.prototype.appendInner = function(e) {
|
|
298
|
-
return new
|
|
295
|
+
return new Ee(this, e);
|
|
299
296
|
};
|
|
300
297
|
m.prototype.slice = function(e, t) {
|
|
301
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));
|
|
@@ -304,24 +301,24 @@ m.prototype.get = function(e) {
|
|
|
304
301
|
if (!(e < 0 || e >= this.length))
|
|
305
302
|
return this.getInner(e);
|
|
306
303
|
};
|
|
307
|
-
m.prototype.forEach = function(e, t,
|
|
308
|
-
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);
|
|
309
306
|
};
|
|
310
|
-
m.prototype.map = function(e, t,
|
|
311
|
-
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);
|
|
312
309
|
var r = [];
|
|
313
310
|
return this.forEach(function(o, s) {
|
|
314
311
|
return r.push(e(o, s));
|
|
315
|
-
}, t,
|
|
312
|
+
}, t, i), r;
|
|
316
313
|
};
|
|
317
314
|
m.from = function(e) {
|
|
318
|
-
return e instanceof m ? e : e && e.length ? new
|
|
315
|
+
return e instanceof m ? e : e && e.length ? new Q(e) : m.empty;
|
|
319
316
|
};
|
|
320
|
-
var
|
|
321
|
-
function e(
|
|
322
|
-
|
|
317
|
+
var Q = /* @__PURE__ */ (function(n) {
|
|
318
|
+
function e(i) {
|
|
319
|
+
n.call(this), this.values = i;
|
|
323
320
|
}
|
|
324
|
-
|
|
321
|
+
n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e;
|
|
325
322
|
var t = { length: { configurable: !0 }, depth: { configurable: !0 } };
|
|
326
323
|
return e.prototype.flatten = function() {
|
|
327
324
|
return this.values;
|
|
@@ -349,41 +346,41 @@ var J = /* @__PURE__ */ (function(i) {
|
|
|
349
346
|
return 0;
|
|
350
347
|
}, Object.defineProperties(e.prototype, t), e;
|
|
351
348
|
})(m);
|
|
352
|
-
m.empty = new
|
|
353
|
-
var
|
|
354
|
-
function e(t,
|
|
355
|
-
|
|
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;
|
|
356
353
|
}
|
|
357
|
-
return
|
|
354
|
+
return n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
|
|
358
355
|
return this.left.flatten().concat(this.right.flatten());
|
|
359
|
-
}, e.prototype.getInner = function(
|
|
360
|
-
return
|
|
361
|
-
}, 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) {
|
|
362
359
|
var l = this.left.length;
|
|
363
|
-
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)
|
|
364
361
|
return !1;
|
|
365
|
-
}, e.prototype.forEachInvertedInner = function(
|
|
362
|
+
}, e.prototype.forEachInvertedInner = function(i, r, o, s) {
|
|
366
363
|
var l = this.left.length;
|
|
367
|
-
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)
|
|
368
365
|
return !1;
|
|
369
|
-
}, e.prototype.sliceInner = function(
|
|
370
|
-
if (
|
|
366
|
+
}, e.prototype.sliceInner = function(i, r) {
|
|
367
|
+
if (i == 0 && r == this.length)
|
|
371
368
|
return this;
|
|
372
369
|
var o = this.left.length;
|
|
373
|
-
return r <= o ? this.left.slice(
|
|
374
|
-
}, e.prototype.leafAppend = function(
|
|
375
|
-
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);
|
|
376
373
|
if (r)
|
|
377
374
|
return new e(this.left, r);
|
|
378
|
-
}, e.prototype.leafPrepend = function(
|
|
379
|
-
var r = this.left.leafPrepend(
|
|
375
|
+
}, e.prototype.leafPrepend = function(i) {
|
|
376
|
+
var r = this.left.leafPrepend(i);
|
|
380
377
|
if (r)
|
|
381
378
|
return new e(r, this.right);
|
|
382
|
-
}, e.prototype.appendInner = function(
|
|
383
|
-
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);
|
|
384
381
|
}, e;
|
|
385
382
|
})(m);
|
|
386
|
-
const
|
|
383
|
+
const be = 500;
|
|
387
384
|
class v {
|
|
388
385
|
constructor(e, t) {
|
|
389
386
|
this.items = e, this.eventCount = t;
|
|
@@ -393,46 +390,46 @@ class v {
|
|
|
393
390
|
popEvent(e, t) {
|
|
394
391
|
if (this.eventCount == 0)
|
|
395
392
|
return null;
|
|
396
|
-
let
|
|
397
|
-
for (; ;
|
|
398
|
-
if (this.items.get(
|
|
399
|
-
--
|
|
393
|
+
let i = this.items.length;
|
|
394
|
+
for (; ; i--)
|
|
395
|
+
if (this.items.get(i - 1).selection) {
|
|
396
|
+
--i;
|
|
400
397
|
break;
|
|
401
398
|
}
|
|
402
399
|
let r, o;
|
|
403
|
-
t && (r = this.remapping(
|
|
400
|
+
t && (r = this.remapping(i, this.items.length), o = r.maps.length);
|
|
404
401
|
let s = e.tr, l, a, d = [], u = [];
|
|
405
402
|
return this.items.forEach((c, p) => {
|
|
406
403
|
if (!c.step) {
|
|
407
|
-
r || (r = this.remapping(
|
|
404
|
+
r || (r = this.remapping(i, p + 1), o = r.maps.length), o--, u.push(c);
|
|
408
405
|
return;
|
|
409
406
|
}
|
|
410
407
|
if (r) {
|
|
411
408
|
u.push(new w(c.map));
|
|
412
|
-
let
|
|
413
|
-
|
|
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);
|
|
414
411
|
} else
|
|
415
412
|
s.maybeStep(c.step);
|
|
416
413
|
if (c.selection)
|
|
417
|
-
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;
|
|
418
415
|
}, this.items.length, 0), { remaining: a, transform: s, selection: l };
|
|
419
416
|
}
|
|
420
417
|
// Create a new branch with the given transform added.
|
|
421
|
-
addTransform(e, t,
|
|
418
|
+
addTransform(e, t, i, r) {
|
|
422
419
|
let o = [], s = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
|
|
423
420
|
for (let u = 0; u < e.steps.length; u++) {
|
|
424
|
-
let c = e.steps[u].invert(e.docs[u]), p = new w(e.mapping.maps[u], c, t),
|
|
425
|
-
(
|
|
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);
|
|
426
423
|
}
|
|
427
|
-
let d = s -
|
|
428
|
-
return d >
|
|
424
|
+
let d = s - i.depth;
|
|
425
|
+
return d > Ae && (l = Pe(l, d), s -= d), new v(l.append(o), s);
|
|
429
426
|
}
|
|
430
427
|
remapping(e, t) {
|
|
431
|
-
let
|
|
428
|
+
let i = new re();
|
|
432
429
|
return this.items.forEach((r, o) => {
|
|
433
|
-
let s = r.mirrorOffset != null && o - r.mirrorOffset >= e ?
|
|
434
|
-
|
|
435
|
-
}, 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;
|
|
436
433
|
}
|
|
437
434
|
addMaps(e) {
|
|
438
435
|
return this.eventCount == 0 ? this : new v(this.items.append(e.map((t) => new w(t))), this.eventCount);
|
|
@@ -444,28 +441,28 @@ class v {
|
|
|
444
441
|
rebased(e, t) {
|
|
445
442
|
if (!this.eventCount)
|
|
446
443
|
return this;
|
|
447
|
-
let
|
|
444
|
+
let i = [], r = Math.max(0, this.items.length - t), o = e.mapping, s = e.steps.length, l = this.eventCount;
|
|
448
445
|
this.items.forEach((p) => {
|
|
449
446
|
p.selection && l--;
|
|
450
447
|
}, r);
|
|
451
448
|
let a = t;
|
|
452
449
|
this.items.forEach((p) => {
|
|
453
|
-
let
|
|
454
|
-
if (
|
|
450
|
+
let f = o.getMirror(--a);
|
|
451
|
+
if (f == null)
|
|
455
452
|
return;
|
|
456
|
-
s = Math.min(s,
|
|
457
|
-
let g = o.maps[
|
|
453
|
+
s = Math.min(s, f);
|
|
454
|
+
let g = o.maps[f];
|
|
458
455
|
if (p.step) {
|
|
459
|
-
let
|
|
460
|
-
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));
|
|
461
458
|
} else
|
|
462
|
-
|
|
459
|
+
i.push(new w(g));
|
|
463
460
|
}, r);
|
|
464
461
|
let d = [];
|
|
465
462
|
for (let p = t; p < s; p++)
|
|
466
463
|
d.push(new w(o.maps[p]));
|
|
467
|
-
let u = this.items.slice(0, r).append(d).append(
|
|
468
|
-
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;
|
|
469
466
|
}
|
|
470
467
|
emptyItemCount() {
|
|
471
468
|
let e = 0;
|
|
@@ -480,33 +477,33 @@ class v {
|
|
|
480
477
|
// because `rebased` relies on a clean, untouched set of items in
|
|
481
478
|
// order to associate old items with rebased steps.
|
|
482
479
|
compress(e = this.items.length) {
|
|
483
|
-
let t = this.remapping(0, e),
|
|
480
|
+
let t = this.remapping(0, e), i = t.maps.length, r = [], o = 0;
|
|
484
481
|
return this.items.forEach((s, l) => {
|
|
485
482
|
if (l >= e)
|
|
486
483
|
r.push(s), s.selection && o++;
|
|
487
484
|
else if (s.step) {
|
|
488
|
-
let a = s.step.map(t.slice(
|
|
489
|
-
if (
|
|
490
|
-
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));
|
|
491
488
|
u && o++;
|
|
492
|
-
let c = new w(d.invert(), a, u), p,
|
|
493
|
-
(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);
|
|
494
491
|
}
|
|
495
|
-
} else s.map &&
|
|
492
|
+
} else s.map && i--;
|
|
496
493
|
}, this.items.length, 0), new v(m.from(r.reverse()), o);
|
|
497
494
|
}
|
|
498
495
|
}
|
|
499
496
|
v.empty = new v(m.empty, 0);
|
|
500
|
-
function
|
|
497
|
+
function Pe(n, e) {
|
|
501
498
|
let t;
|
|
502
|
-
return
|
|
503
|
-
if (
|
|
499
|
+
return n.forEach((i, r) => {
|
|
500
|
+
if (i.selection && e-- == 0)
|
|
504
501
|
return t = r, !1;
|
|
505
|
-
}),
|
|
502
|
+
}), n.slice(t);
|
|
506
503
|
}
|
|
507
504
|
class w {
|
|
508
|
-
constructor(e, t,
|
|
509
|
-
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;
|
|
510
507
|
}
|
|
511
508
|
merge(e) {
|
|
512
509
|
if (this.step && e.step && !e.selection) {
|
|
@@ -517,63 +514,63 @@ class w {
|
|
|
517
514
|
}
|
|
518
515
|
}
|
|
519
516
|
class y {
|
|
520
|
-
constructor(e, t,
|
|
521
|
-
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;
|
|
522
519
|
}
|
|
523
520
|
}
|
|
524
|
-
const
|
|
525
|
-
function Ie(
|
|
521
|
+
const Ae = 20;
|
|
522
|
+
function Ie(n, e, t, i) {
|
|
526
523
|
let r = t.getMeta(E), o;
|
|
527
524
|
if (r)
|
|
528
525
|
return r.historyState;
|
|
529
|
-
t.getMeta(
|
|
526
|
+
t.getMeta(Te) && (n = new y(n.done, n.undone, null, 0, -1));
|
|
530
527
|
let s = t.getMeta("appendedTransaction");
|
|
531
528
|
if (t.steps.length == 0)
|
|
532
|
-
return
|
|
529
|
+
return n;
|
|
533
530
|
if (s && s.getMeta(E))
|
|
534
|
-
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);
|
|
535
532
|
if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
|
|
536
|
-
let l = t.getMeta("composition"), a =
|
|
537
|
-
return new y(
|
|
538
|
-
} 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);
|
|
539
536
|
}
|
|
540
|
-
function
|
|
537
|
+
function Me(n, e) {
|
|
541
538
|
if (!e)
|
|
542
539
|
return !1;
|
|
543
|
-
if (!
|
|
540
|
+
if (!n.docChanged)
|
|
544
541
|
return !0;
|
|
545
542
|
let t = !1;
|
|
546
|
-
return
|
|
543
|
+
return n.mapping.maps[0].forEach((i, r) => {
|
|
547
544
|
for (let o = 0; o < e.length; o += 2)
|
|
548
|
-
|
|
545
|
+
i <= e[o + 1] && r >= e[o] && (t = !0);
|
|
549
546
|
}), t;
|
|
550
547
|
}
|
|
551
|
-
function
|
|
548
|
+
function V(n) {
|
|
552
549
|
let e = [];
|
|
553
|
-
for (let t =
|
|
554
|
-
|
|
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));
|
|
555
552
|
return e;
|
|
556
553
|
}
|
|
557
|
-
function k(
|
|
558
|
-
if (!
|
|
554
|
+
function k(n, e) {
|
|
555
|
+
if (!n)
|
|
559
556
|
return null;
|
|
560
557
|
let t = [];
|
|
561
|
-
for (let
|
|
562
|
-
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);
|
|
563
560
|
r <= o && t.push(r, o);
|
|
564
561
|
}
|
|
565
562
|
return t;
|
|
566
563
|
}
|
|
567
|
-
function xe(
|
|
568
|
-
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);
|
|
569
566
|
if (!o)
|
|
570
567
|
return null;
|
|
571
|
-
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);
|
|
572
569
|
return o.transform.setSelection(s).setMeta(E, { redo: t, historyState: a });
|
|
573
570
|
}
|
|
574
571
|
let z = !1, B = null;
|
|
575
|
-
function
|
|
576
|
-
let e =
|
|
572
|
+
function x(n) {
|
|
573
|
+
let e = n.plugins;
|
|
577
574
|
if (B != e) {
|
|
578
575
|
z = !1, B = e;
|
|
579
576
|
for (let t = 0; t < e.length; t++)
|
|
@@ -584,53 +581,53 @@ function S(i) {
|
|
|
584
581
|
}
|
|
585
582
|
return z;
|
|
586
583
|
}
|
|
587
|
-
const E = new W("history"),
|
|
588
|
-
function
|
|
589
|
-
return
|
|
590
|
-
depth:
|
|
591
|
-
newGroupDelay:
|
|
592
|
-
}, 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({
|
|
593
590
|
key: E,
|
|
594
591
|
state: {
|
|
595
592
|
init() {
|
|
596
593
|
return new y(v.empty, v.empty, null, 0, -1);
|
|
597
594
|
},
|
|
598
|
-
apply(e, t,
|
|
599
|
-
return Ie(t,
|
|
595
|
+
apply(e, t, i) {
|
|
596
|
+
return Ie(t, i, e, n);
|
|
600
597
|
}
|
|
601
598
|
},
|
|
602
|
-
config:
|
|
599
|
+
config: n,
|
|
603
600
|
props: {
|
|
604
601
|
handleDOMEvents: {
|
|
605
602
|
beforeinput(e, t) {
|
|
606
|
-
let
|
|
603
|
+
let i = t.inputType, r = i == "historyUndo" ? q : i == "historyRedo" ? ee : null;
|
|
607
604
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
608
605
|
}
|
|
609
606
|
}
|
|
610
607
|
}
|
|
611
608
|
});
|
|
612
609
|
}
|
|
613
|
-
function
|
|
614
|
-
return (t,
|
|
610
|
+
function $(n, e) {
|
|
611
|
+
return (t, i) => {
|
|
615
612
|
let r = E.getState(t);
|
|
616
|
-
if (!r || (
|
|
613
|
+
if (!r || (n ? r.undone : r.done).eventCount == 0)
|
|
617
614
|
return !1;
|
|
618
|
-
if (
|
|
619
|
-
let o = xe(r, t,
|
|
620
|
-
o &&
|
|
615
|
+
if (i) {
|
|
616
|
+
let o = xe(r, t, n);
|
|
617
|
+
o && i(e ? o.scrollIntoView() : o);
|
|
621
618
|
}
|
|
622
619
|
return !0;
|
|
623
620
|
};
|
|
624
621
|
}
|
|
625
|
-
const q =
|
|
622
|
+
const q = $(!1, !0), ee = $(!0, !0);
|
|
626
623
|
C.create({
|
|
627
624
|
name: "characterCount",
|
|
628
625
|
addOptions() {
|
|
629
626
|
return {
|
|
630
627
|
limit: null,
|
|
631
628
|
mode: "textSize",
|
|
632
|
-
textCounter: (
|
|
633
|
-
wordCounter: (
|
|
629
|
+
textCounter: (n) => n.length,
|
|
630
|
+
wordCounter: (n) => n.split(" ").filter((e) => e !== "").length
|
|
634
631
|
};
|
|
635
632
|
},
|
|
636
633
|
addStorage() {
|
|
@@ -640,53 +637,53 @@ C.create({
|
|
|
640
637
|
};
|
|
641
638
|
},
|
|
642
639
|
onBeforeCreate() {
|
|
643
|
-
this.storage.characters = (
|
|
644
|
-
const e = (
|
|
645
|
-
if (((
|
|
646
|
-
const
|
|
647
|
-
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);
|
|
648
645
|
}
|
|
649
646
|
return e.nodeSize;
|
|
650
|
-
}, this.storage.words = (
|
|
651
|
-
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, " ", " ");
|
|
652
649
|
return this.options.wordCounter(t);
|
|
653
650
|
};
|
|
654
651
|
},
|
|
655
652
|
addProseMirrorPlugins() {
|
|
656
|
-
let
|
|
653
|
+
let n = !1;
|
|
657
654
|
return [
|
|
658
|
-
new
|
|
659
|
-
key: new
|
|
660
|
-
appendTransaction: (e, t,
|
|
661
|
-
if (
|
|
655
|
+
new A({
|
|
656
|
+
key: new I("characterCount"),
|
|
657
|
+
appendTransaction: (e, t, i) => {
|
|
658
|
+
if (n)
|
|
662
659
|
return;
|
|
663
660
|
const r = this.options.limit;
|
|
664
661
|
if (r == null || r === 0) {
|
|
665
|
-
|
|
662
|
+
n = !0;
|
|
666
663
|
return;
|
|
667
664
|
}
|
|
668
|
-
const o = this.storage.characters({ node:
|
|
665
|
+
const o = this.storage.characters({ node: i.doc });
|
|
669
666
|
if (o > r) {
|
|
670
667
|
const s = o - r, l = 0, a = s;
|
|
671
668
|
console.warn(
|
|
672
669
|
`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`
|
|
673
670
|
);
|
|
674
|
-
const d =
|
|
675
|
-
return
|
|
671
|
+
const d = i.tr.deleteRange(l, a);
|
|
672
|
+
return n = !0, d;
|
|
676
673
|
}
|
|
677
|
-
|
|
674
|
+
n = !0;
|
|
678
675
|
},
|
|
679
676
|
filterTransaction: (e, t) => {
|
|
680
|
-
const
|
|
681
|
-
if (!e.docChanged ||
|
|
677
|
+
const i = this.options.limit;
|
|
678
|
+
if (!e.docChanged || i === 0 || i === null || i === void 0)
|
|
682
679
|
return !0;
|
|
683
680
|
const r = this.storage.characters({ node: t.doc }), o = this.storage.characters({ node: e.doc });
|
|
684
|
-
if (o <=
|
|
681
|
+
if (o <= i || r > i && o > i && o <= r)
|
|
685
682
|
return !0;
|
|
686
|
-
if (r >
|
|
683
|
+
if (r > i && o > i && o > r || !e.getMeta("paste"))
|
|
687
684
|
return !1;
|
|
688
|
-
const l = e.selection.$head.pos, a = o -
|
|
689
|
-
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);
|
|
690
687
|
}
|
|
691
688
|
})
|
|
692
689
|
];
|
|
@@ -702,7 +699,7 @@ C.create({
|
|
|
702
699
|
};
|
|
703
700
|
},
|
|
704
701
|
addProseMirrorPlugins() {
|
|
705
|
-
return [
|
|
702
|
+
return [pe(this.options)];
|
|
706
703
|
}
|
|
707
704
|
});
|
|
708
705
|
C.create({
|
|
@@ -715,15 +712,15 @@ C.create({
|
|
|
715
712
|
},
|
|
716
713
|
addProseMirrorPlugins() {
|
|
717
714
|
return [
|
|
718
|
-
new
|
|
719
|
-
key: new
|
|
715
|
+
new A({
|
|
716
|
+
key: new I("focus"),
|
|
720
717
|
props: {
|
|
721
|
-
decorations: ({ doc:
|
|
722
|
-
const { isEditable: t, isFocused:
|
|
723
|
-
if (!t || !
|
|
724
|
-
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, []);
|
|
725
722
|
let s = 0;
|
|
726
|
-
this.options.mode === "deepest" &&
|
|
723
|
+
this.options.mode === "deepest" && n.descendants((a, d) => {
|
|
727
724
|
if (a.isText)
|
|
728
725
|
return;
|
|
729
726
|
if (!(r >= d && r <= d + a.nodeSize - 1))
|
|
@@ -731,17 +728,17 @@ C.create({
|
|
|
731
728
|
s += 1;
|
|
732
729
|
});
|
|
733
730
|
let l = 0;
|
|
734
|
-
return
|
|
731
|
+
return n.descendants((a, d) => {
|
|
735
732
|
if (a.isText || !(r >= d && r <= d + a.nodeSize - 1))
|
|
736
733
|
return !1;
|
|
737
734
|
if (l += 1, this.options.mode === "deepest" && s - l > 0 || this.options.mode === "shallowest" && l > 1)
|
|
738
735
|
return this.options.mode === "deepest";
|
|
739
736
|
o.push(
|
|
740
|
-
|
|
737
|
+
N.node(d, d + a.nodeSize, {
|
|
741
738
|
class: this.options.className
|
|
742
739
|
})
|
|
743
740
|
);
|
|
744
|
-
}),
|
|
741
|
+
}), S.create(n, o);
|
|
745
742
|
}
|
|
746
743
|
}
|
|
747
744
|
})
|
|
@@ -751,26 +748,31 @@ C.create({
|
|
|
751
748
|
C.create({
|
|
752
749
|
name: "gapCursor",
|
|
753
750
|
addProseMirrorPlugins() {
|
|
754
|
-
return [
|
|
751
|
+
return [ge()];
|
|
755
752
|
},
|
|
756
|
-
extendNodeSchema(
|
|
753
|
+
extendNodeSchema(n) {
|
|
757
754
|
var e;
|
|
758
755
|
const t = {
|
|
759
|
-
name:
|
|
760
|
-
options:
|
|
761
|
-
storage:
|
|
756
|
+
name: n.name,
|
|
757
|
+
options: n.options,
|
|
758
|
+
storage: n.storage
|
|
762
759
|
};
|
|
763
760
|
return {
|
|
764
|
-
allowGapCursor: (e =
|
|
761
|
+
allowGapCursor: (e = ie(oe(n, "allowGapCursor", t))) != null ? e : null
|
|
765
762
|
};
|
|
766
763
|
}
|
|
767
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
|
+
}
|
|
768
769
|
C.create({
|
|
769
770
|
name: "placeholder",
|
|
770
771
|
addOptions() {
|
|
771
772
|
return {
|
|
772
773
|
emptyEditorClass: "is-editor-empty",
|
|
773
774
|
emptyNodeClass: "is-empty",
|
|
775
|
+
dataAttribute: K,
|
|
774
776
|
placeholder: "Write something …",
|
|
775
777
|
showOnlyWhenEditable: !0,
|
|
776
778
|
showOnlyCurrent: !0,
|
|
@@ -778,33 +780,34 @@ C.create({
|
|
|
778
780
|
};
|
|
779
781
|
},
|
|
780
782
|
addProseMirrorPlugins() {
|
|
783
|
+
const n = this.options.dataAttribute ? `data-${Oe(this.options.dataAttribute)}` : `data-${K}`;
|
|
781
784
|
return [
|
|
782
|
-
new
|
|
783
|
-
key: new
|
|
785
|
+
new A({
|
|
786
|
+
key: new I("placeholder"),
|
|
784
787
|
props: {
|
|
785
|
-
decorations: ({ doc:
|
|
786
|
-
const
|
|
787
|
-
if (!
|
|
788
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
789
|
+
const i = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
|
|
790
|
+
if (!i)
|
|
788
791
|
return null;
|
|
789
|
-
const
|
|
790
|
-
return
|
|
791
|
-
const
|
|
792
|
-
if ((
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
const
|
|
796
|
-
class:
|
|
797
|
-
|
|
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 ((d || !this.options.showOnlyCurrent) && u) {
|
|
796
|
+
const c = [this.options.emptyNodeClass];
|
|
797
|
+
s && c.push(this.options.emptyEditorClass);
|
|
798
|
+
const p = N.node(a, a + l.nodeSize, {
|
|
799
|
+
class: c.join(" "),
|
|
800
|
+
[n]: typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
798
801
|
editor: this.editor,
|
|
799
|
-
node:
|
|
800
|
-
pos:
|
|
801
|
-
hasAnchor:
|
|
802
|
+
node: l,
|
|
803
|
+
pos: a,
|
|
804
|
+
hasAnchor: d
|
|
802
805
|
}) : this.options.placeholder
|
|
803
806
|
});
|
|
804
|
-
|
|
807
|
+
o.push(p);
|
|
805
808
|
}
|
|
806
809
|
return this.options.includeChildren;
|
|
807
|
-
}),
|
|
810
|
+
}), S.create(e, o);
|
|
808
811
|
}
|
|
809
812
|
}
|
|
810
813
|
})
|
|
@@ -819,14 +822,14 @@ C.create({
|
|
|
819
822
|
};
|
|
820
823
|
},
|
|
821
824
|
addProseMirrorPlugins() {
|
|
822
|
-
const { editor:
|
|
825
|
+
const { editor: n, options: e } = this;
|
|
823
826
|
return [
|
|
824
|
-
new
|
|
825
|
-
key: new
|
|
827
|
+
new A({
|
|
828
|
+
key: new I("selection"),
|
|
826
829
|
props: {
|
|
827
830
|
decorations(t) {
|
|
828
|
-
return t.selection.empty ||
|
|
829
|
-
|
|
831
|
+
return t.selection.empty || n.isFocused || !n.isEditable || le(t.selection) || n.view.dragging ? null : S.create(t.doc, [
|
|
832
|
+
N.inline(t.selection.from, t.selection.to, {
|
|
830
833
|
class: e.className
|
|
831
834
|
})
|
|
832
835
|
]);
|
|
@@ -836,8 +839,8 @@ C.create({
|
|
|
836
839
|
];
|
|
837
840
|
}
|
|
838
841
|
});
|
|
839
|
-
function
|
|
840
|
-
return e && Array.isArray(
|
|
842
|
+
function _({ types: n, node: e }) {
|
|
843
|
+
return e && Array.isArray(n) && n.includes(e.type) || (e == null ? void 0 : e.type) === n;
|
|
841
844
|
}
|
|
842
845
|
C.create({
|
|
843
846
|
name: "trailingNode",
|
|
@@ -848,10 +851,10 @@ C.create({
|
|
|
848
851
|
};
|
|
849
852
|
},
|
|
850
853
|
addProseMirrorPlugins() {
|
|
851
|
-
var
|
|
852
|
-
const e = new
|
|
854
|
+
var n;
|
|
855
|
+
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));
|
|
853
856
|
return [
|
|
854
|
-
new
|
|
857
|
+
new A({
|
|
855
858
|
key: e,
|
|
856
859
|
appendTransaction: (r, o, s) => {
|
|
857
860
|
const { doc: l, tr: a, schema: d } = s, u = e.getState(s), c = l.content.size, p = d.nodes[t];
|
|
@@ -861,20 +864,20 @@ C.create({
|
|
|
861
864
|
state: {
|
|
862
865
|
init: (r, o) => {
|
|
863
866
|
const s = o.tr.doc.lastChild;
|
|
864
|
-
return !
|
|
867
|
+
return !_({ node: s, types: i });
|
|
865
868
|
},
|
|
866
869
|
apply: (r, o) => {
|
|
867
870
|
if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
|
|
868
871
|
return o;
|
|
869
872
|
const s = r.doc.lastChild;
|
|
870
|
-
return !
|
|
873
|
+
return !_({ node: s, types: i });
|
|
871
874
|
}
|
|
872
875
|
}
|
|
873
876
|
})
|
|
874
877
|
];
|
|
875
878
|
}
|
|
876
879
|
});
|
|
877
|
-
var
|
|
880
|
+
var De = C.create({
|
|
878
881
|
name: "undoRedo",
|
|
879
882
|
addOptions() {
|
|
880
883
|
return {
|
|
@@ -884,12 +887,12 @@ var Oe = C.create({
|
|
|
884
887
|
},
|
|
885
888
|
addCommands() {
|
|
886
889
|
return {
|
|
887
|
-
undo: () => ({ state:
|
|
888
|
-
redo: () => ({ state:
|
|
890
|
+
undo: () => ({ state: n, dispatch: e }) => q(n, e),
|
|
891
|
+
redo: () => ({ state: n, dispatch: e }) => ee(n, e)
|
|
889
892
|
};
|
|
890
893
|
},
|
|
891
894
|
addProseMirrorPlugins() {
|
|
892
|
-
return [
|
|
895
|
+
return [Se(this.options)];
|
|
893
896
|
},
|
|
894
897
|
addKeyboardShortcuts() {
|
|
895
898
|
return {
|
|
@@ -902,64 +905,63 @@ var Oe = C.create({
|
|
|
902
905
|
};
|
|
903
906
|
}
|
|
904
907
|
});
|
|
905
|
-
function
|
|
908
|
+
function Ke() {
|
|
906
909
|
var u;
|
|
907
|
-
const
|
|
910
|
+
const n = X(te.name), {
|
|
908
911
|
icon: e = void 0,
|
|
909
912
|
tooltip: t = void 0,
|
|
910
|
-
shortcutKeys:
|
|
913
|
+
shortcutKeys: i = void 0,
|
|
911
914
|
tooltipOptions: r = {},
|
|
912
915
|
action: o = void 0,
|
|
913
916
|
isActive: s = void 0
|
|
914
|
-
} = ((u =
|
|
917
|
+
} = ((u = n == null ? void 0 : n.componentProps) == null ? void 0 : u.undo) ?? {}, { disabled: l } = Y(s), a = ue[e], d = () => {
|
|
915
918
|
l || o && o();
|
|
916
919
|
};
|
|
917
|
-
return !
|
|
918
|
-
|
|
920
|
+
return !n || !a ? /* @__PURE__ */ O(j, {}) : /* @__PURE__ */ O(
|
|
921
|
+
Z,
|
|
919
922
|
{
|
|
920
923
|
action: d,
|
|
921
924
|
disabled: l,
|
|
922
925
|
icon: e,
|
|
923
|
-
shortcutKeys:
|
|
926
|
+
shortcutKeys: i,
|
|
924
927
|
tooltip: t,
|
|
925
928
|
tooltipOptions: r
|
|
926
929
|
}
|
|
927
930
|
);
|
|
928
931
|
}
|
|
929
|
-
function
|
|
932
|
+
function _e() {
|
|
930
933
|
var d;
|
|
931
|
-
const
|
|
934
|
+
const n = X(te.name), {
|
|
932
935
|
icon: e = void 0,
|
|
933
936
|
tooltip: t = void 0,
|
|
934
|
-
shortcutKeys:
|
|
937
|
+
shortcutKeys: i = void 0,
|
|
935
938
|
tooltipOptions: r = {},
|
|
936
939
|
action: o = void 0,
|
|
937
940
|
isActive: s = void 0
|
|
938
|
-
} = ((d =
|
|
941
|
+
} = ((d = n == null ? void 0 : n.componentProps) == null ? void 0 : d.redo) ?? {}, { disabled: l } = Y(s), a = () => {
|
|
939
942
|
l || o && o();
|
|
940
943
|
};
|
|
941
|
-
return
|
|
942
|
-
|
|
944
|
+
return n ? /* @__PURE__ */ O(
|
|
945
|
+
Z,
|
|
943
946
|
{
|
|
944
947
|
action: a,
|
|
945
948
|
disabled: l,
|
|
946
949
|
icon: e,
|
|
947
|
-
shortcutKeys:
|
|
950
|
+
shortcutKeys: i,
|
|
948
951
|
tooltip: t,
|
|
949
952
|
tooltipOptions: r
|
|
950
953
|
}
|
|
951
|
-
) : /* @__PURE__ */
|
|
954
|
+
) : /* @__PURE__ */ O(j, {});
|
|
952
955
|
}
|
|
953
|
-
const
|
|
954
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
956
|
+
const te = /* @__PURE__ */ De.extend({
|
|
955
957
|
//@ts-expect-error
|
|
956
958
|
addOptions() {
|
|
957
|
-
var
|
|
959
|
+
var n;
|
|
958
960
|
return {
|
|
959
|
-
...(
|
|
961
|
+
...(n = this.parent) == null ? void 0 : n.call(this),
|
|
960
962
|
depth: 100,
|
|
961
963
|
newGroupDelay: 500,
|
|
962
|
-
button: ({ editor: e, t, extension:
|
|
964
|
+
button: ({ editor: e, t, extension: i }) => {
|
|
963
965
|
var r, o;
|
|
964
966
|
return {
|
|
965
967
|
componentProps: {
|
|
@@ -967,7 +969,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
967
969
|
action: () => {
|
|
968
970
|
e.chain().focus().undo().run();
|
|
969
971
|
},
|
|
970
|
-
shortcutKeys: ((r =
|
|
972
|
+
shortcutKeys: ((r = i.options.shortcutKeys) == null ? void 0 : r[0]) ?? ["mod", "Z"],
|
|
971
973
|
isActive: () => e.can().undo(),
|
|
972
974
|
icon: "Undo2",
|
|
973
975
|
tooltip: t("editor.undo.tooltip")
|
|
@@ -976,7 +978,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
976
978
|
action: () => {
|
|
977
979
|
e.chain().focus().redo().run();
|
|
978
980
|
},
|
|
979
|
-
shortcutKeys: ((o =
|
|
981
|
+
shortcutKeys: ((o = i.options.shortcutKeys) == null ? void 0 : o[1]) ?? ["shift", "mod", "Z"],
|
|
980
982
|
isActive: () => e.can().redo(),
|
|
981
983
|
icon: "Redo2",
|
|
982
984
|
tooltip: t("editor.redo.tooltip")
|
|
@@ -988,7 +990,7 @@ const ee = /* @__PURE__ */ Oe.extend({
|
|
|
988
990
|
}
|
|
989
991
|
});
|
|
990
992
|
export {
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
993
|
+
te as History,
|
|
994
|
+
_e as RichTextRedo,
|
|
995
|
+
Ke as RichTextUndo
|
|
994
996
|
};
|