reactjs-tiptap-editor 1.0.24 → 1.0.26
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-HYlhmRvw.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
- package/lib/{ActionMenuButton-B8NhVw5m.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +25 -25
- package/lib/Blockquote.cjs +5 -5
- package/lib/Blockquote.js +1490 -53
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +3 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +222 -8
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +56 -39
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +8 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-Was4hxYH.cjs → Drawer-D7E9kTca.cjs} +1 -1
- package/lib/{Drawer-CaXVhxo4.js → Drawer-DA0FLHs9.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +1644 -148
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +10 -10
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.js +133 -0
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +15 -11
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +38 -32
- package/lib/History.cjs +7 -1
- package/lib/History.js +519 -478
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bp986fj0.js → Iframe-DZ3r3QzK.js} +7 -7
- package/lib/{Iframe-BI0sq6pd.cjs → Iframe-OMVd0xa_.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +6 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +35 -35
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-FvM52kjA.cjs → Indent-QgCoonRk.cjs} +1 -1
- package/lib/{Indent-E6B8DkyN.js → Indent-kI4G-clX.js} +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-pzwyyiFJ.js → Katex-BPbXjcZQ.js} +6 -7
- package/lib/Katex-CUofhjB5.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-OjN4F2rM.js → LinkEditBlock-BYWwH2_x.js} +59 -32
- package/lib/{LinkEditBlock-Cmkmp2fW.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +9 -5
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +61 -62
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +14 -14
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-o323V8li.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
- package/lib/{SlashCommandNodeView-DarAytvt.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-Clnz-i4l.cjs → Table-D5G3rfwb.cjs} +5 -5
- package/lib/{Table-CC9uNHPL.js → Table-DwseaFSD.js} +115 -97
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +11 -11
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BVnXL8we.js → Twitter-DP26Lkn8.js} +195 -195
- package/lib/Twitter-q4ZGZL0i.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2783 -2137
- package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
- package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
- package/lib/components/ColorPicker.d.ts +1 -1
- package/lib/components/ReactBus.d.ts +1 -1
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
- package/lib/components/icons/Activity.d.ts +2 -1
- package/lib/components/icons/Animas.d.ts +2 -1
- package/lib/components/icons/AspectRatio.d.ts +1 -1
- package/lib/components/icons/Blockquote.d.ts +1 -1
- package/lib/components/icons/CodeView.d.ts +1 -1
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
- package/lib/components/icons/ColumnAddRight.d.ts +1 -1
- package/lib/components/icons/DeleteColumn.d.ts +1 -1
- package/lib/components/icons/DeleteRow.d.ts +1 -1
- package/lib/components/icons/Direction.d.ts +1 -1
- package/lib/components/icons/Excalidraw.d.ts +1 -1
- package/lib/components/icons/ExportPdf.d.ts +1 -1
- package/lib/components/icons/ExportWord.d.ts +2 -1
- package/lib/components/icons/FileWordOutline.d.ts +1 -1
- package/lib/components/icons/Flag.d.ts +2 -1
- package/lib/components/icons/Food.d.ts +2 -1
- package/lib/components/icons/GIfIcon.d.ts +1 -1
- package/lib/components/icons/Html.d.ts +1 -1
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/IconColorFill.d.ts +1 -1
- package/lib/components/icons/IconHighlightFill.d.ts +1 -1
- package/lib/components/icons/ImportWord.d.ts +2 -1
- package/lib/components/icons/LeftToRight.d.ts +1 -1
- package/lib/components/icons/LineHeight.d.ts +1 -1
- package/lib/components/icons/MenuDown.d.ts +1 -1
- package/lib/components/icons/Mermaid.d.ts +1 -1
- package/lib/components/icons/NoFill.d.ts +1 -1
- package/lib/components/icons/Object.d.ts +2 -1
- package/lib/components/icons/RightToLeft.d.ts +1 -1
- package/lib/components/icons/SizeL.d.ts +1 -1
- package/lib/components/icons/SizeM.d.ts +1 -1
- package/lib/components/icons/SizeS.d.ts +1 -1
- package/lib/components/icons/Symbol.d.ts +2 -1
- package/lib/components/icons/Travel.d.ts +2 -1
- package/lib/components/icons/Twitter.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +2 -2
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +4 -4
- package/lib/components/ui/toaster.d.ts +1 -1
- package/lib/{dropdown-menu-BW2M6saA.js → dropdown-menu-BKSX4gvT.js} +1 -1
- package/lib/{dropdown-menu-BIGvxqiu.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
- package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
- package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
- package/lib/extensions/FormatPainter/index.d.ts +1 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
- package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
- package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
- package/lib/extensions/Image/components/ImageView.d.ts +2 -1
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
- package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
- package/lib/index-BGfIcDCQ.cjs +26 -0
- package/lib/index-BaR0Brts.js +1115 -0
- package/lib/index-BgNKVyMW.cjs +2 -0
- package/lib/index-BpLw6ebr.cjs +1 -0
- package/lib/{index-BrsJsbds.js → index-C52cuQ_Y.js} +1503 -1352
- package/lib/index-CDw4Eszh.cjs +12 -0
- package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
- package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
- package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
- package/lib/index-Dbm_Mans.js +1756 -0
- package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
- package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
- package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
- package/lib/index-aujjnfSJ.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/{popover-BIVHT1W9.js → popover-BB-ZDnqk.js} +1 -1
- package/lib/{popover-DoSfJsFS.cjs → popover-CrywEkBR.cjs} +1 -1
- package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
- package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
- package/lib/{separator-SRbPfmGa.cjs → separator-BGO9AZp4.cjs} +1 -1
- package/lib/{separator-b-qOPJmp.js → separator-DuuOJRQd.js} +21 -21
- package/lib/store/EditorEditableReactive.d.ts +1 -1
- package/lib/store/ThemeColorReactive.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
- package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
- package/package.json +79 -66
- package/lib/Callout-B-S2f0Qo.cjs +0 -1
- package/lib/Callout-CF7Y9yJ7.js +0 -340
- package/lib/Katex-DP6EjdKz.cjs +0 -4
- package/lib/Twitter-0kmrijjL.cjs +0 -1
- package/lib/index-BF3EVCB1.cjs +0 -2
- package/lib/index-Bcj8cyOO.cjs +0 -24
- package/lib/index-CGjT-a9h.js +0 -1377
- package/lib/index-CPTpXLfX.cjs +0 -11
- package/lib/index-CWw4s87s.cjs +0 -1
- package/lib/index-Cal5SPfB.js +0 -779
- package/lib/index-deubsx3z.cjs +0 -1
- package/lib/textarea-CpxXPky_.js +0 -20
- package/lib/textarea-DbGw9oCU.cjs +0 -1
package/lib/History.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { O as
|
|
2
|
-
import { Plugin as A, PluginKey as
|
|
3
|
-
import { DecorationSet as O, Decoration as
|
|
4
|
-
import { k as
|
|
5
|
-
import { jsx as R, Fragment as
|
|
6
|
-
import { u as
|
|
1
|
+
import { O as L, x as ce, F as _, v as U, T as Y, u as Z, S as x, Q as J, R as de, E as P, U as ue, V as pe, W as fe, o as he, X as B } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { Plugin as A, PluginKey as S } from "@tiptap/pm/state";
|
|
3
|
+
import { DecorationSet as O, Decoration as V } from "@tiptap/pm/view";
|
|
4
|
+
import { k as me, D as ge, a as ve } from "./index-DQy9iBzV.js";
|
|
5
|
+
import { jsx as R, Fragment as Q } from "react/jsx-runtime";
|
|
6
|
+
import { u as $, e as q, A as ee, i as we } from "./index-C52cuQ_Y.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "./theme.js";
|
|
9
|
-
function
|
|
10
|
-
return new
|
|
9
|
+
function ye(n = {}) {
|
|
10
|
+
return new L({
|
|
11
11
|
view(e) {
|
|
12
|
-
return new
|
|
12
|
+
return new Ce(e, n);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
class
|
|
16
|
+
class Ce {
|
|
17
17
|
constructor(e, t) {
|
|
18
|
-
var
|
|
19
|
-
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (
|
|
18
|
+
var o;
|
|
19
|
+
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (o = t.width) !== null && o !== void 0 ? o : 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 i = (s) => {
|
|
21
21
|
this[r](s);
|
|
22
22
|
};
|
|
@@ -33,33 +33,33 @@ class ge {
|
|
|
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, o, r = this.editorView.dom, i = r.getBoundingClientRect(), s = i.width / r.offsetWidth, l = i.height / r.offsetHeight;
|
|
37
37
|
if (t) {
|
|
38
|
-
let
|
|
39
|
-
if (
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
|
|
38
|
+
let u = e.nodeBefore, p = e.nodeAfter;
|
|
39
|
+
if (u || p) {
|
|
40
|
+
let f = this.editorView.nodeDOM(this.cursorPos - (u ? u.nodeSize : 0));
|
|
41
|
+
if (f) {
|
|
42
|
+
let h = f.getBoundingClientRect(), v = u ? h.bottom : h.top;
|
|
43
|
+
u && p && (v = (v + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
44
|
+
let y = this.width / 2 * l;
|
|
45
|
+
o = { left: h.left, right: h.right, top: v - y, bottom: v + y };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
if (!
|
|
50
|
-
let
|
|
51
|
-
|
|
49
|
+
if (!o) {
|
|
50
|
+
let u = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * s;
|
|
51
|
+
o = { left: u.left - p, right: u.left + p, top: u.top, bottom: u.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);
|
|
55
|
-
let c,
|
|
55
|
+
let c, d;
|
|
56
56
|
if (!a || a == document.body && getComputedStyle(a).position == "static")
|
|
57
|
-
c = -pageXOffset,
|
|
57
|
+
c = -pageXOffset, d = -pageYOffset;
|
|
58
58
|
else {
|
|
59
|
-
let
|
|
60
|
-
c =
|
|
59
|
+
let u = a.getBoundingClientRect(), p = u.width / a.offsetWidth, f = u.height / a.offsetHeight;
|
|
60
|
+
c = u.left - a.scrollLeft * p, d = u.top - a.scrollTop * f;
|
|
61
61
|
}
|
|
62
|
-
this.element.style.left = (
|
|
62
|
+
this.element.style.left = (o.left - c) / s + "px", this.element.style.top = (o.top - d) / l + "px", this.element.style.width = (o.right - o.left) / s + "px", this.element.style.height = (o.bottom - o.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 ge {
|
|
|
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 }), o = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = o && o.type.spec.disableDropCursor, i = typeof r == "function" ? r(this.editorView, t, e) : r;
|
|
71
71
|
if (t && !i) {
|
|
72
72
|
let s = t.pos;
|
|
73
73
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
74
|
-
let l =
|
|
74
|
+
let l = ce(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 ge {
|
|
|
87
87
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
class
|
|
90
|
+
class m extends x {
|
|
91
91
|
/**
|
|
92
92
|
Create a gap cursor.
|
|
93
93
|
*/
|
|
@@ -95,14 +95,14 @@ class f extends x {
|
|
|
95
95
|
super(e, e);
|
|
96
96
|
}
|
|
97
97
|
map(e, t) {
|
|
98
|
-
let
|
|
99
|
-
return
|
|
98
|
+
let o = e.resolve(t.map(this.head));
|
|
99
|
+
return m.valid(o) ? new m(o) : x.near(o);
|
|
100
100
|
}
|
|
101
101
|
content() {
|
|
102
|
-
return
|
|
102
|
+
return U.empty;
|
|
103
103
|
}
|
|
104
104
|
eq(e) {
|
|
105
|
-
return e instanceof
|
|
105
|
+
return e instanceof m && e.head == this.head;
|
|
106
106
|
}
|
|
107
107
|
toJSON() {
|
|
108
108
|
return { type: "gapcursor", pos: this.head };
|
|
@@ -113,7 +113,7 @@ class f extends x {
|
|
|
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 m(e.resolve(t.pos));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
@internal
|
|
@@ -126,20 +126,20 @@ class f extends x {
|
|
|
126
126
|
*/
|
|
127
127
|
static valid(e) {
|
|
128
128
|
let t = e.parent;
|
|
129
|
-
if (t.inlineContent || !
|
|
129
|
+
if (t.inlineContent || !be(e) || !Pe(e))
|
|
130
130
|
return !1;
|
|
131
|
-
let
|
|
132
|
-
if (
|
|
133
|
-
return
|
|
131
|
+
let o = t.type.spec.allowGapCursor;
|
|
132
|
+
if (o != null)
|
|
133
|
+
return o;
|
|
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, o = !1) {
|
|
141
141
|
e: for (; ; ) {
|
|
142
|
-
if (!
|
|
142
|
+
if (!o && m.valid(e))
|
|
143
143
|
return e;
|
|
144
144
|
let r = e.pos, i = null;
|
|
145
145
|
for (let s = e.depth; ; s--) {
|
|
@@ -151,30 +151,30 @@ class f extends x {
|
|
|
151
151
|
return null;
|
|
152
152
|
r += t;
|
|
153
153
|
let a = e.doc.resolve(r);
|
|
154
|
-
if (
|
|
154
|
+
if (m.valid(a))
|
|
155
155
|
return a;
|
|
156
156
|
}
|
|
157
157
|
for (; ; ) {
|
|
158
158
|
let s = t > 0 ? i.firstChild : i.lastChild;
|
|
159
159
|
if (!s) {
|
|
160
|
-
if (i.isAtom && !i.isText && !
|
|
161
|
-
e = e.doc.resolve(r + i.nodeSize * t),
|
|
160
|
+
if (i.isAtom && !i.isText && !Z.isSelectable(i)) {
|
|
161
|
+
e = e.doc.resolve(r + i.nodeSize * t), o = !1;
|
|
162
162
|
continue e;
|
|
163
163
|
}
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
166
|
i = s, r += t;
|
|
167
167
|
let l = e.doc.resolve(r);
|
|
168
|
-
if (
|
|
168
|
+
if (m.valid(l))
|
|
169
169
|
return l;
|
|
170
170
|
}
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
x.jsonID("gapcursor",
|
|
175
|
+
m.prototype.visible = !1;
|
|
176
|
+
m.findFrom = m.findGapCursorFrom;
|
|
177
|
+
x.jsonID("gapcursor", m);
|
|
178
178
|
class F {
|
|
179
179
|
constructor(e) {
|
|
180
180
|
this.pos = e;
|
|
@@ -184,22 +184,22 @@ class F {
|
|
|
184
184
|
}
|
|
185
185
|
resolve(e) {
|
|
186
186
|
let t = e.resolve(this.pos);
|
|
187
|
-
return
|
|
187
|
+
return m.valid(t) ? new m(t) : x.near(t);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function te(n) {
|
|
191
|
+
return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
for (let e =
|
|
195
|
-
let t =
|
|
193
|
+
function be(n) {
|
|
194
|
+
for (let e = n.depth; e >= 0; e--) {
|
|
195
|
+
let t = n.index(e), o = n.node(e);
|
|
196
196
|
if (t == 0) {
|
|
197
|
-
if (
|
|
197
|
+
if (o.type.spec.isolating)
|
|
198
198
|
return !0;
|
|
199
199
|
continue;
|
|
200
200
|
}
|
|
201
|
-
for (let r =
|
|
202
|
-
if (r.childCount == 0 && !r.inlineContent ||
|
|
201
|
+
for (let r = o.child(t - 1); ; r = r.lastChild) {
|
|
202
|
+
if (r.childCount == 0 && !r.inlineContent || te(r.type))
|
|
203
203
|
return !0;
|
|
204
204
|
if (r.inlineContent)
|
|
205
205
|
return !1;
|
|
@@ -207,16 +207,16 @@ function ve(o) {
|
|
|
207
207
|
}
|
|
208
208
|
return !0;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
for (let e =
|
|
212
|
-
let t =
|
|
213
|
-
if (t ==
|
|
214
|
-
if (
|
|
210
|
+
function Pe(n) {
|
|
211
|
+
for (let e = n.depth; e >= 0; e--) {
|
|
212
|
+
let t = n.indexAfter(e), o = n.node(e);
|
|
213
|
+
if (t == o.childCount) {
|
|
214
|
+
if (o.type.spec.isolating)
|
|
215
215
|
return !0;
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
for (let r =
|
|
219
|
-
if (r.childCount == 0 && !r.inlineContent ||
|
|
218
|
+
for (let r = o.child(t); ; r = r.firstChild) {
|
|
219
|
+
if (r.childCount == 0 && !r.inlineContent || te(r.type))
|
|
220
220
|
return !0;
|
|
221
221
|
if (r.inlineContent)
|
|
222
222
|
return !1;
|
|
@@ -224,64 +224,64 @@ function we(o) {
|
|
|
224
224
|
}
|
|
225
225
|
return !0;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return new
|
|
227
|
+
function Ee() {
|
|
228
|
+
return new L({
|
|
229
229
|
props: {
|
|
230
|
-
decorations:
|
|
231
|
-
createSelectionBetween(
|
|
232
|
-
return e.pos == t.pos &&
|
|
230
|
+
decorations: Te,
|
|
231
|
+
createSelectionBetween(n, e, t) {
|
|
232
|
+
return e.pos == t.pos && m.valid(t) ? new m(t) : null;
|
|
233
233
|
},
|
|
234
|
-
handleClick:
|
|
235
|
-
handleKeyDown:
|
|
236
|
-
handleDOMEvents: { beforeinput:
|
|
234
|
+
handleClick: Ae,
|
|
235
|
+
handleKeyDown: Me,
|
|
236
|
+
handleDOMEvents: { beforeinput: Se }
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
ArrowLeft:
|
|
242
|
-
ArrowRight:
|
|
243
|
-
ArrowUp:
|
|
244
|
-
ArrowDown:
|
|
240
|
+
const Me = me({
|
|
241
|
+
ArrowLeft: T("horiz", -1),
|
|
242
|
+
ArrowRight: T("horiz", 1),
|
|
243
|
+
ArrowUp: T("vert", -1),
|
|
244
|
+
ArrowDown: T("vert", 1)
|
|
245
245
|
});
|
|
246
|
-
function
|
|
247
|
-
const t =
|
|
248
|
-
return function(
|
|
249
|
-
let s =
|
|
250
|
-
if (s instanceof
|
|
246
|
+
function T(n, e) {
|
|
247
|
+
const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
248
|
+
return function(o, r, i) {
|
|
249
|
+
let s = o.selection, l = e > 0 ? s.$to : s.$from, a = s.empty;
|
|
250
|
+
if (s instanceof Y) {
|
|
251
251
|
if (!i.endOfTextblock(t) || l.depth == 0)
|
|
252
252
|
return !1;
|
|
253
|
-
a = !1, l =
|
|
253
|
+
a = !1, l = o.doc.resolve(e > 0 ? l.after() : l.before());
|
|
254
254
|
}
|
|
255
|
-
let c =
|
|
256
|
-
return c ? (r && r(
|
|
255
|
+
let c = m.findGapCursorFrom(l, e, a);
|
|
256
|
+
return c ? (r && r(o.tr.setSelection(new m(c))), !0) : !1;
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
if (!
|
|
259
|
+
function Ae(n, e, t) {
|
|
260
|
+
if (!n || !n.editable)
|
|
261
261
|
return !1;
|
|
262
|
-
let
|
|
263
|
-
if (!
|
|
262
|
+
let o = n.state.doc.resolve(e);
|
|
263
|
+
if (!m.valid(o))
|
|
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 && Z.isSelectable(n.state.doc.nodeAt(r.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new m(o))), !0);
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
if (e.inputType != "insertCompositionText" || !(
|
|
268
|
+
function Se(n, e) {
|
|
269
|
+
if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof m))
|
|
270
270
|
return !1;
|
|
271
|
-
let { $from: t } =
|
|
272
|
-
if (!
|
|
271
|
+
let { $from: t } = n.state.selection, o = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
|
|
272
|
+
if (!o)
|
|
273
273
|
return !1;
|
|
274
|
-
let r =
|
|
275
|
-
for (let s =
|
|
276
|
-
r =
|
|
277
|
-
let i =
|
|
278
|
-
return i.setSelection(
|
|
274
|
+
let r = _.empty;
|
|
275
|
+
for (let s = o.length - 1; s >= 0; s--)
|
|
276
|
+
r = _.from(o[s].createAndFill(null, r));
|
|
277
|
+
let i = n.state.tr.replace(t.pos, t.pos, new U(r, 0, 0));
|
|
278
|
+
return i.setSelection(Y.near(i.doc.resolve(t.pos + 1))), n.dispatch(i), !1;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(
|
|
280
|
+
function Te(n) {
|
|
281
|
+
if (!(n.selection instanceof m))
|
|
282
282
|
return null;
|
|
283
283
|
let e = document.createElement("div");
|
|
284
|
-
return e.className = "ProseMirror-gapcursor",
|
|
284
|
+
return e.className = "ProseMirror-gapcursor", ge.create(n.doc, [ve.widget(n.selection.head, e, { key: "gapcursor" })]);
|
|
285
285
|
}
|
|
286
286
|
var D = 200, g = function() {
|
|
287
287
|
};
|
|
@@ -292,7 +292,7 @@ g.prototype.prepend = function(e) {
|
|
|
292
292
|
return e.length ? g.from(e).append(this) : this;
|
|
293
293
|
};
|
|
294
294
|
g.prototype.appendInner = function(e) {
|
|
295
|
-
return new
|
|
295
|
+
return new Ie(this, e);
|
|
296
296
|
};
|
|
297
297
|
g.prototype.slice = function(e, t) {
|
|
298
298
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? g.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
@@ -301,24 +301,24 @@ g.prototype.get = function(e) {
|
|
|
301
301
|
if (!(e < 0 || e >= this.length))
|
|
302
302
|
return this.getInner(e);
|
|
303
303
|
};
|
|
304
|
-
g.prototype.forEach = function(e, t,
|
|
305
|
-
t === void 0 && (t = 0),
|
|
304
|
+
g.prototype.forEach = function(e, t, o) {
|
|
305
|
+
t === void 0 && (t = 0), o === void 0 && (o = this.length), t <= o ? this.forEachInner(e, t, o, 0) : this.forEachInvertedInner(e, t, o, 0);
|
|
306
306
|
};
|
|
307
|
-
g.prototype.map = function(e, t,
|
|
308
|
-
t === void 0 && (t = 0),
|
|
307
|
+
g.prototype.map = function(e, t, o) {
|
|
308
|
+
t === void 0 && (t = 0), o === void 0 && (o = this.length);
|
|
309
309
|
var r = [];
|
|
310
310
|
return this.forEach(function(i, s) {
|
|
311
311
|
return r.push(e(i, s));
|
|
312
|
-
}, t,
|
|
312
|
+
}, t, o), r;
|
|
313
313
|
};
|
|
314
314
|
g.from = function(e) {
|
|
315
|
-
return e instanceof g ? e : e && e.length ? new
|
|
315
|
+
return e instanceof g ? e : e && e.length ? new ne(e) : g.empty;
|
|
316
316
|
};
|
|
317
|
-
var
|
|
318
|
-
function e(
|
|
319
|
-
|
|
317
|
+
var ne = /* @__PURE__ */ (function(n) {
|
|
318
|
+
function e(o) {
|
|
319
|
+
n.call(this), this.values = o;
|
|
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,42 +346,42 @@ var ee = /* @__PURE__ */ (function(o) {
|
|
|
346
346
|
return 0;
|
|
347
347
|
}, Object.defineProperties(e.prototype, t), e;
|
|
348
348
|
})(g);
|
|
349
|
-
g.empty = new
|
|
350
|
-
var
|
|
351
|
-
function e(t,
|
|
352
|
-
|
|
349
|
+
g.empty = new ne([]);
|
|
350
|
+
var Ie = /* @__PURE__ */ (function(n) {
|
|
351
|
+
function e(t, o) {
|
|
352
|
+
n.call(this), this.left = t, this.right = o, this.length = t.length + o.length, this.depth = Math.max(t.depth, o.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(o) {
|
|
357
|
+
return o < this.left.length ? this.left.get(o) : this.right.get(o - this.left.length);
|
|
358
|
+
}, e.prototype.forEachInner = function(o, r, i, s) {
|
|
359
359
|
var l = this.left.length;
|
|
360
|
-
if (r < l && this.left.forEachInner(
|
|
360
|
+
if (r < l && this.left.forEachInner(o, r, Math.min(i, l), s) === !1 || i > l && this.right.forEachInner(o, Math.max(r - l, 0), Math.min(this.length, i) - l, s + l) === !1)
|
|
361
361
|
return !1;
|
|
362
|
-
}, e.prototype.forEachInvertedInner = function(
|
|
362
|
+
}, e.prototype.forEachInvertedInner = function(o, r, i, s) {
|
|
363
363
|
var l = this.left.length;
|
|
364
|
-
if (r > l && this.right.forEachInvertedInner(
|
|
364
|
+
if (r > l && this.right.forEachInvertedInner(o, r - l, Math.max(i, l) - l, s + l) === !1 || i < l && this.left.forEachInvertedInner(o, Math.min(r, l), i, s) === !1)
|
|
365
365
|
return !1;
|
|
366
|
-
}, e.prototype.sliceInner = function(
|
|
367
|
-
if (
|
|
366
|
+
}, e.prototype.sliceInner = function(o, r) {
|
|
367
|
+
if (o == 0 && r == this.length)
|
|
368
368
|
return this;
|
|
369
369
|
var i = this.left.length;
|
|
370
|
-
return r <= i ? this.left.slice(
|
|
371
|
-
}, e.prototype.leafAppend = function(
|
|
372
|
-
var r = this.right.leafAppend(
|
|
370
|
+
return r <= i ? this.left.slice(o, r) : o >= i ? this.right.slice(o - i, r - i) : this.left.slice(o, i).append(this.right.slice(0, r - i));
|
|
371
|
+
}, e.prototype.leafAppend = function(o) {
|
|
372
|
+
var r = this.right.leafAppend(o);
|
|
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(o) {
|
|
376
|
+
var r = this.left.leafPrepend(o);
|
|
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(o) {
|
|
380
|
+
return this.left.depth >= Math.max(this.right.depth, o.depth) + 1 ? new e(this.left, new e(this.right, o)) : new e(this, o);
|
|
381
381
|
}, e;
|
|
382
382
|
})(g);
|
|
383
|
-
const
|
|
384
|
-
class
|
|
383
|
+
const xe = 500;
|
|
384
|
+
class w {
|
|
385
385
|
constructor(e, t) {
|
|
386
386
|
this.items = e, this.eventCount = t;
|
|
387
387
|
}
|
|
@@ -390,49 +390,49 @@ 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 o = this.items.length;
|
|
394
|
+
for (; ; o--)
|
|
395
|
+
if (this.items.get(o - 1).selection) {
|
|
396
|
+
--o;
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
let r, i;
|
|
400
|
-
t && (r = this.remapping(
|
|
401
|
-
let s = e.tr, l, a, c = [],
|
|
402
|
-
return this.items.forEach((
|
|
403
|
-
if (!
|
|
404
|
-
r || (r = this.remapping(
|
|
400
|
+
t && (r = this.remapping(o, this.items.length), i = r.maps.length);
|
|
401
|
+
let s = e.tr, l, a, c = [], d = [];
|
|
402
|
+
return this.items.forEach((u, p) => {
|
|
403
|
+
if (!u.step) {
|
|
404
|
+
r || (r = this.remapping(o, p + 1), i = r.maps.length), i--, d.push(u);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
407
|
if (r) {
|
|
408
|
-
|
|
409
|
-
let
|
|
410
|
-
|
|
408
|
+
d.push(new C(u.map));
|
|
409
|
+
let f = u.step.map(r.slice(i)), h;
|
|
410
|
+
f && s.maybeStep(f).doc && (h = s.mapping.maps[s.mapping.maps.length - 1], c.push(new C(h, void 0, void 0, c.length + d.length))), i--, h && r.appendMap(h, i);
|
|
411
411
|
} else
|
|
412
|
-
s.maybeStep(
|
|
413
|
-
if (
|
|
414
|
-
return l = r ?
|
|
412
|
+
s.maybeStep(u.step);
|
|
413
|
+
if (u.selection)
|
|
414
|
+
return l = r ? u.selection.map(r.slice(i)) : u.selection, a = new w(this.items.slice(0, o).append(d.reverse().concat(c)), 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, o, r) {
|
|
419
419
|
let i = [], s = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
|
|
420
|
-
for (let
|
|
421
|
-
let
|
|
422
|
-
(
|
|
420
|
+
for (let d = 0; d < e.steps.length; d++) {
|
|
421
|
+
let u = e.steps[d].invert(e.docs[d]), p = new C(e.mapping.maps[d], u, t), f;
|
|
422
|
+
(f = a && a.merge(p)) && (p = f, d ? i.pop() : l = l.slice(0, l.length - 1)), i.push(p), t && (s++, t = void 0), r || (a = p);
|
|
423
423
|
}
|
|
424
|
-
let c = s -
|
|
425
|
-
return c >
|
|
424
|
+
let c = s - o.depth;
|
|
425
|
+
return c > Re && (l = Oe(l, c), s -= c), new w(l.append(i), s);
|
|
426
426
|
}
|
|
427
427
|
remapping(e, t) {
|
|
428
|
-
let
|
|
428
|
+
let o = new de();
|
|
429
429
|
return this.items.forEach((r, i) => {
|
|
430
|
-
let s = r.mirrorOffset != null && i - r.mirrorOffset >= e ?
|
|
431
|
-
|
|
432
|
-
}, e, t),
|
|
430
|
+
let s = r.mirrorOffset != null && i - r.mirrorOffset >= e ? o.maps.length - r.mirrorOffset : void 0;
|
|
431
|
+
o.appendMap(r.map, s);
|
|
432
|
+
}, e, t), o;
|
|
433
433
|
}
|
|
434
434
|
addMaps(e) {
|
|
435
|
-
return this.eventCount == 0 ? this : new
|
|
435
|
+
return this.eventCount == 0 ? this : new w(this.items.append(e.map((t) => new C(t))), this.eventCount);
|
|
436
436
|
}
|
|
437
437
|
// When the collab module receives remote changes, the history has
|
|
438
438
|
// to know about those, so that it can adjust the steps that were
|
|
@@ -441,28 +441,28 @@ class v {
|
|
|
441
441
|
rebased(e, t) {
|
|
442
442
|
if (!this.eventCount)
|
|
443
443
|
return this;
|
|
444
|
-
let
|
|
445
|
-
this.items.forEach((
|
|
446
|
-
|
|
444
|
+
let o = [], r = Math.max(0, this.items.length - t), i = e.mapping, s = e.steps.length, l = this.eventCount;
|
|
445
|
+
this.items.forEach((p) => {
|
|
446
|
+
p.selection && l--;
|
|
447
447
|
}, r);
|
|
448
448
|
let a = t;
|
|
449
|
-
this.items.forEach((
|
|
450
|
-
let
|
|
451
|
-
if (
|
|
449
|
+
this.items.forEach((p) => {
|
|
450
|
+
let f = i.getMirror(--a);
|
|
451
|
+
if (f == null)
|
|
452
452
|
return;
|
|
453
|
-
s = Math.min(s,
|
|
454
|
-
let
|
|
455
|
-
if (
|
|
456
|
-
let
|
|
457
|
-
|
|
453
|
+
s = Math.min(s, f);
|
|
454
|
+
let h = i.maps[f];
|
|
455
|
+
if (p.step) {
|
|
456
|
+
let v = e.steps[f].invert(e.docs[f]), y = p.selection && p.selection.map(i.slice(a + 1, f));
|
|
457
|
+
y && l++, o.push(new C(h, v, y));
|
|
458
458
|
} else
|
|
459
|
-
|
|
459
|
+
o.push(new C(h));
|
|
460
460
|
}, r);
|
|
461
461
|
let c = [];
|
|
462
|
-
for (let
|
|
463
|
-
c.push(new
|
|
464
|
-
let
|
|
465
|
-
return
|
|
462
|
+
for (let p = t; p < s; p++)
|
|
463
|
+
c.push(new C(i.maps[p]));
|
|
464
|
+
let d = this.items.slice(0, r).append(c).append(o), u = new w(d, l);
|
|
465
|
+
return u.emptyItemCount() > xe && (u = u.compress(this.items.length - o.length)), u;
|
|
466
466
|
}
|
|
467
467
|
emptyItemCount() {
|
|
468
468
|
let e = 0;
|
|
@@ -477,102 +477,102 @@ 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), o = t.maps.length, r = [], i = 0;
|
|
481
481
|
return this.items.forEach((s, l) => {
|
|
482
482
|
if (l >= e)
|
|
483
483
|
r.push(s), s.selection && i++;
|
|
484
484
|
else if (s.step) {
|
|
485
|
-
let a = s.step.map(t.slice(
|
|
486
|
-
if (
|
|
487
|
-
let
|
|
488
|
-
|
|
489
|
-
let
|
|
490
|
-
(
|
|
485
|
+
let a = s.step.map(t.slice(o)), c = a && a.getMap();
|
|
486
|
+
if (o--, c && t.appendMap(c, o), a) {
|
|
487
|
+
let d = s.selection && s.selection.map(t.slice(o));
|
|
488
|
+
d && i++;
|
|
489
|
+
let u = new C(c.invert(), a, d), p, f = r.length - 1;
|
|
490
|
+
(p = r.length && r[f].merge(u)) ? r[f] = p : r.push(u);
|
|
491
491
|
}
|
|
492
|
-
} else s.map &&
|
|
493
|
-
}, this.items.length, 0), new
|
|
492
|
+
} else s.map && o--;
|
|
493
|
+
}, this.items.length, 0), new w(g.from(r.reverse()), i);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
|
|
497
|
-
function
|
|
496
|
+
w.empty = new w(g.empty, 0);
|
|
497
|
+
function Oe(n, e) {
|
|
498
498
|
let t;
|
|
499
|
-
return
|
|
500
|
-
if (
|
|
499
|
+
return n.forEach((o, r) => {
|
|
500
|
+
if (o.selection && e-- == 0)
|
|
501
501
|
return t = r, !1;
|
|
502
|
-
}),
|
|
502
|
+
}), n.slice(t);
|
|
503
503
|
}
|
|
504
|
-
class
|
|
505
|
-
constructor(e, t,
|
|
506
|
-
this.map = e, this.step = t, this.selection =
|
|
504
|
+
class C {
|
|
505
|
+
constructor(e, t, o, r) {
|
|
506
|
+
this.map = e, this.step = t, this.selection = o, this.mirrorOffset = r;
|
|
507
507
|
}
|
|
508
508
|
merge(e) {
|
|
509
509
|
if (this.step && e.step && !e.selection) {
|
|
510
510
|
let t = e.step.merge(this.step);
|
|
511
511
|
if (t)
|
|
512
|
-
return new
|
|
512
|
+
return new C(t.getMap().invert(), t, this.selection);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
class
|
|
517
|
-
constructor(e, t,
|
|
518
|
-
this.done = e, this.undone = t, this.prevRanges =
|
|
516
|
+
class b {
|
|
517
|
+
constructor(e, t, o, r, i) {
|
|
518
|
+
this.done = e, this.undone = t, this.prevRanges = o, this.prevTime = r, this.prevComposition = i;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
const
|
|
522
|
-
function
|
|
521
|
+
const Re = 20;
|
|
522
|
+
function De(n, e, t, o) {
|
|
523
523
|
let r = t.getMeta(E), i;
|
|
524
524
|
if (r)
|
|
525
525
|
return r.historyState;
|
|
526
|
-
t.getMeta(
|
|
526
|
+
t.getMeta(ze) && (n = new b(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
|
|
531
|
+
return s.getMeta(E).redo ? new b(n.done.addTransform(t, void 0, o, I(e)), n.undone, K(t.mapping.maps), n.prevTime, n.prevComposition) : new b(n.done, n.undone.addTransform(t, void 0, o, I(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
|
|
535
|
-
} else return (i = t.getMeta("rebased")) ? new
|
|
533
|
+
let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - o.newGroupDelay || !Ne(t, n.prevRanges)), c = s ? k(n.prevRanges, t.mapping) : K(t.mapping.maps);
|
|
534
|
+
return new b(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, o, I(e)), w.empty, c, t.time, l ?? n.prevComposition);
|
|
535
|
+
} else return (i = t.getMeta("rebased")) ? new b(n.done.rebased(t, i), n.undone.rebased(t, i), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new b(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 Ne(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((o, r) => {
|
|
544
544
|
for (let i = 0; i < e.length; i += 2)
|
|
545
|
-
|
|
545
|
+
o <= e[i + 1] && r >= e[i] && (t = !0);
|
|
546
546
|
}), t;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function K(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((o, r, i, s) => e.push(i, 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(o
|
|
558
|
+
for (let o = 0; o < n.length; o += 2) {
|
|
559
|
+
let r = e.map(n[o], 1), i = e.map(n[o + 1], -1);
|
|
560
560
|
r <= i && t.push(r, i);
|
|
561
561
|
}
|
|
562
562
|
return t;
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
let
|
|
564
|
+
function ke(n, e, t) {
|
|
565
|
+
let o = I(e), r = E.get(e).spec.config, i = (t ? n.undone : n.done).popEvent(e, o);
|
|
566
566
|
if (!i)
|
|
567
567
|
return null;
|
|
568
|
-
let s = i.selection.resolve(i.transform.doc), l = (t ?
|
|
568
|
+
let s = i.selection.resolve(i.transform.doc), l = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, o), a = new b(t ? l : i.remaining, t ? i.remaining : l, null, 0, -1);
|
|
569
569
|
return i.transform.setSelection(s).setMeta(E, { redo: t, historyState: a });
|
|
570
570
|
}
|
|
571
|
-
let z = !1,
|
|
572
|
-
function
|
|
573
|
-
let e =
|
|
574
|
-
if (
|
|
575
|
-
z = !1,
|
|
571
|
+
let z = !1, H = null;
|
|
572
|
+
function I(n) {
|
|
573
|
+
let e = n.plugins;
|
|
574
|
+
if (H != e) {
|
|
575
|
+
z = !1, H = e;
|
|
576
576
|
for (let t = 0; t < e.length; t++)
|
|
577
577
|
if (e[t].spec.historyPreserveItems) {
|
|
578
578
|
z = !0;
|
|
@@ -581,54 +581,54 @@ function S(o) {
|
|
|
581
581
|
}
|
|
582
582
|
return z;
|
|
583
583
|
}
|
|
584
|
-
const E = new
|
|
585
|
-
function
|
|
586
|
-
return
|
|
587
|
-
depth:
|
|
588
|
-
newGroupDelay:
|
|
589
|
-
}, new
|
|
584
|
+
const E = new J("history"), ze = new J("closeHistory");
|
|
585
|
+
function Le(n = {}) {
|
|
586
|
+
return n = {
|
|
587
|
+
depth: n.depth || 100,
|
|
588
|
+
newGroupDelay: n.newGroupDelay || 500
|
|
589
|
+
}, new L({
|
|
590
590
|
key: E,
|
|
591
591
|
state: {
|
|
592
592
|
init() {
|
|
593
|
-
return new
|
|
593
|
+
return new b(w.empty, w.empty, null, 0, -1);
|
|
594
594
|
},
|
|
595
|
-
apply(e, t,
|
|
596
|
-
return
|
|
595
|
+
apply(e, t, o) {
|
|
596
|
+
return De(t, o, 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 o = t.inputType, r = o == "historyUndo" ? re : o == "historyRedo" ? ie : 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 oe(n, e) {
|
|
611
|
+
return (t, o) => {
|
|
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 i =
|
|
617
|
-
i &&
|
|
615
|
+
if (o) {
|
|
616
|
+
let i = ke(r, t, n);
|
|
617
|
+
i && o(e ? i.scrollIntoView() : i);
|
|
618
618
|
}
|
|
619
619
|
return !0;
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
const
|
|
623
|
-
|
|
622
|
+
const re = oe(!1, !0), ie = oe(!0, !0);
|
|
623
|
+
P.create({
|
|
624
624
|
name: "characterCount",
|
|
625
625
|
addOptions() {
|
|
626
626
|
return {
|
|
627
627
|
limit: null,
|
|
628
628
|
autoTrim: !0,
|
|
629
629
|
mode: "textSize",
|
|
630
|
-
textCounter: (
|
|
631
|
-
wordCounter: (
|
|
630
|
+
textCounter: (n) => n.length,
|
|
631
|
+
wordCounter: (n) => n.split(" ").filter((e) => e !== "").length
|
|
632
632
|
};
|
|
633
633
|
},
|
|
634
634
|
addStorage() {
|
|
@@ -638,59 +638,59 @@ b.create({
|
|
|
638
638
|
};
|
|
639
639
|
},
|
|
640
640
|
onBeforeCreate() {
|
|
641
|
-
this.storage.characters = (
|
|
642
|
-
const e = (
|
|
643
|
-
if (((
|
|
644
|
-
const
|
|
645
|
-
return this.options.textCounter(
|
|
641
|
+
this.storage.characters = (n) => {
|
|
642
|
+
const e = (n == null ? void 0 : n.node) || this.editor.state.doc;
|
|
643
|
+
if (((n == null ? void 0 : n.mode) || this.options.mode) === "textSize") {
|
|
644
|
+
const o = e.textBetween(0, e.content.size, void 0, " ");
|
|
645
|
+
return this.options.textCounter(o);
|
|
646
646
|
}
|
|
647
647
|
return e.nodeSize;
|
|
648
|
-
}, this.storage.words = (
|
|
649
|
-
const e = (
|
|
648
|
+
}, this.storage.words = (n) => {
|
|
649
|
+
const e = (n == null ? void 0 : n.node) || this.editor.state.doc, t = e.textBetween(0, e.content.size, " ", " ");
|
|
650
650
|
return this.options.wordCounter(t);
|
|
651
651
|
};
|
|
652
652
|
},
|
|
653
653
|
addProseMirrorPlugins() {
|
|
654
|
-
let
|
|
654
|
+
let n = !1;
|
|
655
655
|
return [
|
|
656
656
|
new A({
|
|
657
|
-
key: new
|
|
658
|
-
appendTransaction: (e, t,
|
|
659
|
-
if (
|
|
657
|
+
key: new S("characterCount"),
|
|
658
|
+
appendTransaction: (e, t, o) => {
|
|
659
|
+
if (n)
|
|
660
660
|
return;
|
|
661
661
|
const r = this.options.limit, i = this.options.autoTrim;
|
|
662
662
|
if (r == null || r === 0 || i === !1) {
|
|
663
|
-
|
|
663
|
+
n = !0;
|
|
664
664
|
return;
|
|
665
665
|
}
|
|
666
|
-
const s = this.storage.characters({ node:
|
|
666
|
+
const s = this.storage.characters({ node: o.doc });
|
|
667
667
|
if (s > r) {
|
|
668
668
|
const l = s - r, a = 0, c = l;
|
|
669
669
|
console.warn(
|
|
670
670
|
`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`
|
|
671
671
|
);
|
|
672
|
-
const
|
|
673
|
-
return
|
|
672
|
+
const d = o.tr.deleteRange(a, c);
|
|
673
|
+
return n = !0, d;
|
|
674
674
|
}
|
|
675
|
-
|
|
675
|
+
n = !0;
|
|
676
676
|
},
|
|
677
677
|
filterTransaction: (e, t) => {
|
|
678
|
-
const
|
|
679
|
-
if (!e.docChanged ||
|
|
678
|
+
const o = this.options.limit;
|
|
679
|
+
if (!e.docChanged || o === 0 || o === null || o === void 0)
|
|
680
680
|
return !0;
|
|
681
681
|
const r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
|
|
682
|
-
if (i <=
|
|
682
|
+
if (i <= o || r > o && i > o && i <= r)
|
|
683
683
|
return !0;
|
|
684
|
-
if (r >
|
|
684
|
+
if (r > o && i > o && i > r || !e.getMeta("paste"))
|
|
685
685
|
return !1;
|
|
686
|
-
const l = e.selection.$head.pos, a = i -
|
|
687
|
-
return e.deleteRange(c,
|
|
686
|
+
const l = e.selection.$head.pos, a = i - o, c = l - a, d = l;
|
|
687
|
+
return e.deleteRange(c, d), !(this.storage.characters({ node: e.doc }) > o);
|
|
688
688
|
}
|
|
689
689
|
})
|
|
690
690
|
];
|
|
691
691
|
}
|
|
692
692
|
});
|
|
693
|
-
|
|
693
|
+
P.create({
|
|
694
694
|
name: "dropCursor",
|
|
695
695
|
addOptions() {
|
|
696
696
|
return {
|
|
@@ -700,10 +700,10 @@ b.create({
|
|
|
700
700
|
};
|
|
701
701
|
},
|
|
702
702
|
addProseMirrorPlugins() {
|
|
703
|
-
return [
|
|
703
|
+
return [ye(this.options)];
|
|
704
704
|
}
|
|
705
705
|
});
|
|
706
|
-
|
|
706
|
+
P.create({
|
|
707
707
|
name: "focus",
|
|
708
708
|
addOptions() {
|
|
709
709
|
return {
|
|
@@ -714,14 +714,14 @@ b.create({
|
|
|
714
714
|
addProseMirrorPlugins() {
|
|
715
715
|
return [
|
|
716
716
|
new A({
|
|
717
|
-
key: new
|
|
717
|
+
key: new S("focus"),
|
|
718
718
|
props: {
|
|
719
|
-
decorations: ({ doc:
|
|
720
|
-
const { isEditable: t, isFocused:
|
|
721
|
-
if (!t || !
|
|
722
|
-
return O.create(
|
|
719
|
+
decorations: ({ doc: n, selection: e }) => {
|
|
720
|
+
const { isEditable: t, isFocused: o } = this.editor, { anchor: r } = e, i = [];
|
|
721
|
+
if (!t || !o)
|
|
722
|
+
return O.create(n, []);
|
|
723
723
|
let s = 0;
|
|
724
|
-
this.options.mode === "deepest" &&
|
|
724
|
+
this.options.mode === "deepest" && n.descendants((a, c) => {
|
|
725
725
|
if (a.isText)
|
|
726
726
|
return;
|
|
727
727
|
if (!(r >= c && r <= c + a.nodeSize - 1))
|
|
@@ -729,54 +729,55 @@ b.create({
|
|
|
729
729
|
s += 1;
|
|
730
730
|
});
|
|
731
731
|
let l = 0;
|
|
732
|
-
return
|
|
732
|
+
return n.descendants((a, c) => {
|
|
733
733
|
if (a.isText || !(r >= c && r <= c + a.nodeSize - 1))
|
|
734
734
|
return !1;
|
|
735
735
|
if (l += 1, this.options.mode === "deepest" && s - l > 0 || this.options.mode === "shallowest" && l > 1)
|
|
736
736
|
return this.options.mode === "deepest";
|
|
737
737
|
i.push(
|
|
738
|
-
|
|
738
|
+
V.node(c, c + a.nodeSize, {
|
|
739
739
|
class: this.options.className
|
|
740
740
|
})
|
|
741
741
|
);
|
|
742
|
-
}), O.create(
|
|
742
|
+
}), O.create(n, i);
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
})
|
|
746
746
|
];
|
|
747
747
|
}
|
|
748
748
|
});
|
|
749
|
-
|
|
749
|
+
P.create({
|
|
750
750
|
name: "gapCursor",
|
|
751
751
|
addProseMirrorPlugins() {
|
|
752
|
-
return [
|
|
752
|
+
return [Ee()];
|
|
753
753
|
},
|
|
754
|
-
extendNodeSchema(
|
|
754
|
+
extendNodeSchema(n) {
|
|
755
755
|
var e;
|
|
756
756
|
const t = {
|
|
757
|
-
name:
|
|
758
|
-
options:
|
|
759
|
-
storage:
|
|
757
|
+
name: n.name,
|
|
758
|
+
options: n.options,
|
|
759
|
+
storage: n.storage
|
|
760
760
|
};
|
|
761
761
|
return {
|
|
762
|
-
allowGapCursor: (e =
|
|
762
|
+
allowGapCursor: (e = ue(pe(n, "allowGapCursor", t))) != null ? e : null
|
|
763
763
|
};
|
|
764
764
|
}
|
|
765
765
|
});
|
|
766
|
-
|
|
766
|
+
var se = "placeholder", M = new S("tiptap__placeholder"), G = 200;
|
|
767
|
+
function W(n) {
|
|
767
768
|
const {
|
|
768
769
|
editor: e,
|
|
769
770
|
placeholder: t,
|
|
770
|
-
dataAttribute:
|
|
771
|
+
dataAttribute: o,
|
|
771
772
|
pos: r,
|
|
772
773
|
node: i,
|
|
773
774
|
isEmptyDoc: s,
|
|
774
775
|
hasAnchor: l,
|
|
775
776
|
classes: { emptyNode: a, emptyEditor: c }
|
|
776
|
-
} =
|
|
777
|
-
return s &&
|
|
778
|
-
class:
|
|
779
|
-
[
|
|
777
|
+
} = n, d = [a];
|
|
778
|
+
return s && d.push(c), V.node(r, r + i.nodeSize, {
|
|
779
|
+
class: d.join(" "),
|
|
780
|
+
[o]: typeof t == "function" ? t({
|
|
780
781
|
editor: e,
|
|
781
782
|
node: i,
|
|
782
783
|
pos: r,
|
|
@@ -784,20 +785,90 @@ function H(o) {
|
|
|
784
785
|
}) : t
|
|
785
786
|
});
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
-
|
|
788
|
+
function X(n, e) {
|
|
789
|
+
return typeof n == "function" ? n(e) : n;
|
|
790
|
+
}
|
|
791
|
+
function Ve({
|
|
792
|
+
editor: n,
|
|
793
|
+
options: e,
|
|
794
|
+
dataAttribute: t,
|
|
795
|
+
doc: o,
|
|
796
|
+
selection: r
|
|
797
|
+
}) {
|
|
798
|
+
var i, s;
|
|
799
|
+
if (!(n.isEditable || !e.showOnlyWhenEditable))
|
|
800
|
+
return null;
|
|
801
|
+
const { anchor: a } = r, c = [], d = n.isEmpty;
|
|
802
|
+
if (e.showOnlyCurrent && !e.includeChildren) {
|
|
803
|
+
const p = o.resolve(a), f = p.depth > 0 ? p.node(1) : p.nodeAfter, h = p.depth > 0 ? p.before(1) : a;
|
|
804
|
+
if (f && f.type.isTextblock && B(f)) {
|
|
805
|
+
const v = a >= h && a <= h + f.nodeSize;
|
|
806
|
+
c.push(
|
|
807
|
+
W({
|
|
808
|
+
editor: n,
|
|
809
|
+
isEmptyDoc: d,
|
|
810
|
+
dataAttribute: t,
|
|
811
|
+
hasAnchor: v,
|
|
812
|
+
placeholder: e.placeholder,
|
|
813
|
+
classes: {
|
|
814
|
+
emptyEditor: e.emptyEditorClass,
|
|
815
|
+
emptyNode: X(e.emptyNodeClass, {
|
|
816
|
+
editor: n,
|
|
817
|
+
node: f,
|
|
818
|
+
pos: h,
|
|
819
|
+
hasAnchor: v
|
|
820
|
+
})
|
|
821
|
+
},
|
|
822
|
+
node: f,
|
|
823
|
+
pos: h
|
|
824
|
+
})
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
} else {
|
|
828
|
+
const p = M.getState(n.state), f = (i = p == null ? void 0 : p.topPos) != null ? i : 0, h = (s = p == null ? void 0 : p.bottomPos) != null ? s : o.content.size;
|
|
829
|
+
o.nodesBetween(f, h, (v, y) => {
|
|
830
|
+
const N = a >= y && a <= y + v.nodeSize, ae = !v.isLeaf && B(v);
|
|
831
|
+
return v.type.isTextblock && (N || !e.showOnlyCurrent) && ae && c.push(
|
|
832
|
+
W({
|
|
833
|
+
editor: n,
|
|
834
|
+
isEmptyDoc: d,
|
|
835
|
+
dataAttribute: t,
|
|
836
|
+
hasAnchor: N,
|
|
837
|
+
placeholder: e.placeholder,
|
|
838
|
+
classes: {
|
|
839
|
+
emptyEditor: e.emptyEditorClass,
|
|
840
|
+
emptyNode: X(e.emptyNodeClass, {
|
|
841
|
+
editor: n,
|
|
842
|
+
node: v,
|
|
843
|
+
pos: y,
|
|
844
|
+
hasAnchor: N
|
|
845
|
+
})
|
|
846
|
+
},
|
|
847
|
+
node: v,
|
|
848
|
+
pos: y
|
|
849
|
+
})
|
|
850
|
+
), e.includeChildren;
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
return O.create(o, c);
|
|
854
|
+
}
|
|
855
|
+
function Fe(n) {
|
|
856
|
+
return n.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
857
|
+
}
|
|
858
|
+
function _e(n) {
|
|
859
|
+
const e = getComputedStyle(n), t = `${e.overflow} ${e.overflowY} ${e.overflowX}`;
|
|
789
860
|
return /auto|scroll|overlay/.test(t);
|
|
790
861
|
}
|
|
791
|
-
function
|
|
792
|
-
let e =
|
|
862
|
+
function Be(n) {
|
|
863
|
+
let e = n;
|
|
793
864
|
for (; e; ) {
|
|
794
|
-
if (
|
|
865
|
+
if (_e(e))
|
|
795
866
|
return e;
|
|
796
867
|
const t = e.parentElement;
|
|
797
868
|
if (!t) {
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
e =
|
|
869
|
+
const o = e.getRootNode();
|
|
870
|
+
if (o instanceof ShadowRoot) {
|
|
871
|
+
e = o.host;
|
|
801
872
|
continue;
|
|
802
873
|
}
|
|
803
874
|
return window;
|
|
@@ -806,45 +877,103 @@ function ze(o) {
|
|
|
806
877
|
}
|
|
807
878
|
return window;
|
|
808
879
|
}
|
|
809
|
-
function
|
|
810
|
-
return
|
|
880
|
+
function Ke(n) {
|
|
881
|
+
return n === window ? { top: 0, bottom: window.innerHeight } : n.getBoundingClientRect();
|
|
811
882
|
}
|
|
812
|
-
function
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
scrollContainer: t
|
|
883
|
+
function He({
|
|
884
|
+
view: n,
|
|
885
|
+
scrollContainer: e
|
|
816
886
|
}) {
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
819
|
-
return
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
887
|
+
const t = n.dom.getBoundingClientRect();
|
|
888
|
+
if (t.width <= 0 || t.height <= 0)
|
|
889
|
+
return null;
|
|
890
|
+
const o = e ? Ke(e) : { top: 0, bottom: window.innerHeight }, r = Math.max(t.top, o.top) - G, i = Math.min(t.bottom, o.bottom) + G;
|
|
891
|
+
if (r >= i)
|
|
892
|
+
return null;
|
|
893
|
+
const s = t.left + 1, l = t.right - 1;
|
|
894
|
+
if (s > l)
|
|
895
|
+
return null;
|
|
896
|
+
const c = getComputedStyle(n.dom).direction === "rtl" ? t.right - 2 : t.left + 2, d = Math.min(Math.max(c, s), l), u = Math.max(r + 2, t.top + 1), p = Math.min(i - 2, t.bottom - 1);
|
|
897
|
+
if (u > p)
|
|
898
|
+
return null;
|
|
899
|
+
const f = n.posAtCoords({ left: d, top: u }), h = n.posAtCoords({ left: d, top: p });
|
|
900
|
+
return !f || !h ? null : { top: f.pos, bottom: h.pos };
|
|
825
901
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
902
|
+
var Ge = {
|
|
903
|
+
/**
|
|
904
|
+
* Initialises the viewport state with no known positions.
|
|
905
|
+
* @returns The initial viewport state.
|
|
906
|
+
*/
|
|
907
|
+
init() {
|
|
908
|
+
return { topPos: null, bottomPos: null };
|
|
909
|
+
},
|
|
910
|
+
/**
|
|
911
|
+
* Updates the viewport state from incoming transactions.
|
|
912
|
+
* @param tr - The transaction being applied.
|
|
913
|
+
* @param prev - The previous viewport state.
|
|
914
|
+
* @returns The next viewport state.
|
|
915
|
+
*/
|
|
916
|
+
apply(n, e) {
|
|
917
|
+
const t = n.getMeta(M);
|
|
918
|
+
return t != null && t.positions ? { topPos: t.positions.top, bottomPos: t.positions.bottom } : n.docChanged ? {
|
|
919
|
+
topPos: e.topPos !== null ? n.mapping.map(e.topPos) : null,
|
|
920
|
+
bottomPos: e.bottomPos !== null ? n.mapping.map(e.bottomPos) : null
|
|
921
|
+
} : e;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
function We(n) {
|
|
925
|
+
const e = Be(n.dom), t = () => {
|
|
926
|
+
const c = He({
|
|
927
|
+
view: n,
|
|
928
|
+
scrollContainer: e
|
|
929
|
+
});
|
|
930
|
+
if (c === null)
|
|
931
|
+
return;
|
|
932
|
+
const d = M.getState(n.state);
|
|
933
|
+
if ((d == null ? void 0 : d.topPos) === c.top && (d == null ? void 0 : d.bottomPos) === c.bottom)
|
|
934
|
+
return;
|
|
935
|
+
const u = n.state.tr.setMeta(M, { positions: c });
|
|
936
|
+
n.dispatch(u);
|
|
937
|
+
};
|
|
938
|
+
let o = null, r = 0;
|
|
939
|
+
const i = 150, s = () => {
|
|
940
|
+
o === null && (o = requestAnimationFrame(() => {
|
|
941
|
+
o = null;
|
|
942
|
+
const c = performance.now();
|
|
943
|
+
c - r >= i ? (r = c, t()) : s();
|
|
944
|
+
}));
|
|
945
|
+
};
|
|
946
|
+
e.addEventListener("scroll", s, { passive: !0 });
|
|
947
|
+
const l = typeof ResizeObserver < "u" ? new ResizeObserver(s) : null;
|
|
948
|
+
l == null || l.observe(n.dom);
|
|
949
|
+
const a = typeof IntersectionObserver < "u" ? new IntersectionObserver(s) : null;
|
|
950
|
+
return a == null || a.observe(n.dom), n.dom.addEventListener("focus", s), t(), {
|
|
951
|
+
update(c, d) {
|
|
952
|
+
n.state.doc.content.size !== d.doc.content.size && s();
|
|
953
|
+
},
|
|
954
|
+
destroy: () => {
|
|
955
|
+
o !== null && cancelAnimationFrame(o), e.removeEventListener("scroll", s), l == null || l.disconnect(), a == null || a.disconnect(), n.dom.removeEventListener("focus", s);
|
|
956
|
+
}
|
|
957
|
+
};
|
|
835
958
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
return
|
|
959
|
+
function Xe({ editor: n, options: e }) {
|
|
960
|
+
const t = e.dataAttribute ? `data-${Fe(e.dataAttribute)}` : `data-${se}`;
|
|
961
|
+
return new A({
|
|
962
|
+
key: M,
|
|
963
|
+
state: Ge,
|
|
964
|
+
view: We,
|
|
965
|
+
props: {
|
|
966
|
+
decorations: ({ doc: o, selection: r }) => Ve({ editor: n, options: e, dataAttribute: t, doc: o, selection: r })
|
|
967
|
+
}
|
|
968
|
+
});
|
|
839
969
|
}
|
|
840
|
-
|
|
841
|
-
b.create({
|
|
970
|
+
P.create({
|
|
842
971
|
name: "placeholder",
|
|
843
972
|
addOptions() {
|
|
844
973
|
return {
|
|
845
974
|
emptyEditorClass: "is-editor-empty",
|
|
846
975
|
emptyNodeClass: "is-empty",
|
|
847
|
-
dataAttribute:
|
|
976
|
+
dataAttribute: se,
|
|
848
977
|
placeholder: "Write something …",
|
|
849
978
|
showOnlyWhenEditable: !0,
|
|
850
979
|
showOnlyCurrent: !0,
|
|
@@ -852,108 +981,17 @@ b.create({
|
|
|
852
981
|
};
|
|
853
982
|
},
|
|
854
983
|
addProseMirrorPlugins() {
|
|
855
|
-
|
|
856
|
-
return [
|
|
857
|
-
new A({
|
|
858
|
-
state: {
|
|
859
|
-
init() {
|
|
860
|
-
return {
|
|
861
|
-
// null means "no viewport info yet" — decoration callback falls
|
|
862
|
-
// back to full document scan until the scroll handler fires.
|
|
863
|
-
topPos: null,
|
|
864
|
-
bottomPos: null
|
|
865
|
-
};
|
|
866
|
-
},
|
|
867
|
-
apply(e, t) {
|
|
868
|
-
const n = e.getMeta(M);
|
|
869
|
-
return n != null && n.positions ? {
|
|
870
|
-
topPos: n.positions.top,
|
|
871
|
-
bottomPos: n.positions.bottom
|
|
872
|
-
} : e.docChanged ? {
|
|
873
|
-
topPos: t.topPos !== null ? e.mapping.map(t.topPos) : null,
|
|
874
|
-
bottomPos: t.bottomPos !== null ? e.mapping.map(t.bottomPos) : null
|
|
875
|
-
} : t;
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
key: M,
|
|
879
|
-
view(e) {
|
|
880
|
-
const t = ze(e.dom), n = () => {
|
|
881
|
-
const l = Le({
|
|
882
|
-
view: e,
|
|
883
|
-
doc: e.state.doc,
|
|
884
|
-
scrollContainer: t
|
|
885
|
-
}), a = M.getState(e.state);
|
|
886
|
-
if (a.topPos === l.top && a.bottomPos === l.bottom)
|
|
887
|
-
return;
|
|
888
|
-
const c = e.state.tr.setMeta(M, { positions: l }).setMeta("tiptap__viewportUpdate", !0);
|
|
889
|
-
e.dispatch(c);
|
|
890
|
-
}, { call: r, cancel: i } = Fe(n, 250), s = t;
|
|
891
|
-
return s.addEventListener("scroll", r, { passive: !0 }), n(), {
|
|
892
|
-
update(l, a) {
|
|
893
|
-
e.state.doc.content.size !== a.doc.content.size && n();
|
|
894
|
-
},
|
|
895
|
-
destroy: () => {
|
|
896
|
-
i(), s.removeEventListener("scroll", r);
|
|
897
|
-
}
|
|
898
|
-
};
|
|
899
|
-
},
|
|
900
|
-
props: {
|
|
901
|
-
decorations: ({ doc: e, selection: t }) => {
|
|
902
|
-
var n, r;
|
|
903
|
-
if (!(this.editor.isEditable || !this.options.showOnlyWhenEditable))
|
|
904
|
-
return null;
|
|
905
|
-
const { anchor: s } = t, l = [], a = this.editor.isEmpty;
|
|
906
|
-
if (this.options.showOnlyCurrent && !this.options.includeChildren) {
|
|
907
|
-
const p = e.resolve(s);
|
|
908
|
-
if (p.depth > 0) {
|
|
909
|
-
const d = p.node(1), u = p.before(1);
|
|
910
|
-
if (d.type.isTextblock && _(d)) {
|
|
911
|
-
const h = s >= u && s <= u + d.nodeSize, m = H({
|
|
912
|
-
node: d,
|
|
913
|
-
dataAttribute: o,
|
|
914
|
-
hasAnchor: h,
|
|
915
|
-
placeholder: this.options.placeholder,
|
|
916
|
-
classes: {
|
|
917
|
-
emptyEditor: this.options.emptyEditorClass,
|
|
918
|
-
emptyNode: this.options.emptyNodeClass
|
|
919
|
-
},
|
|
920
|
-
editor: this.editor,
|
|
921
|
-
isEmptyDoc: a,
|
|
922
|
-
pos: p.before(1)
|
|
923
|
-
});
|
|
924
|
-
l.push(m);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
} else {
|
|
928
|
-
const p = M.getState(this.editor.state), d = (n = p.topPos) != null ? n : 0, u = (r = p.bottomPos) != null ? r : e.content.size;
|
|
929
|
-
e.nodesBetween(d, u, (h, m) => {
|
|
930
|
-
const y = s >= m && s <= m + h.nodeSize, P = !h.isLeaf && _(h);
|
|
931
|
-
if (!h.type.isTextblock)
|
|
932
|
-
return this.options.includeChildren;
|
|
933
|
-
if ((y || !this.options.showOnlyCurrent) && P) {
|
|
934
|
-
const ie = H({
|
|
935
|
-
classes: { emptyEditor: this.options.emptyEditorClass, emptyNode: this.options.emptyNodeClass },
|
|
936
|
-
editor: this.editor,
|
|
937
|
-
isEmptyDoc: a,
|
|
938
|
-
dataAttribute: o,
|
|
939
|
-
hasAnchor: y,
|
|
940
|
-
placeholder: this.options.placeholder,
|
|
941
|
-
node: h,
|
|
942
|
-
pos: m
|
|
943
|
-
});
|
|
944
|
-
l.push(ie);
|
|
945
|
-
}
|
|
946
|
-
return this.options.includeChildren;
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
return O.create(e, l);
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
})
|
|
953
|
-
];
|
|
984
|
+
return [Xe({ editor: this.editor, options: this.options })];
|
|
954
985
|
}
|
|
955
986
|
});
|
|
956
|
-
|
|
987
|
+
var je = `.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
988
|
+
background: transparent;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
992
|
+
background: transparent;
|
|
993
|
+
}`;
|
|
994
|
+
P.create({
|
|
957
995
|
name: "selection",
|
|
958
996
|
addOptions() {
|
|
959
997
|
return {
|
|
@@ -961,14 +999,14 @@ b.create({
|
|
|
961
999
|
};
|
|
962
1000
|
},
|
|
963
1001
|
addProseMirrorPlugins() {
|
|
964
|
-
const { editor:
|
|
965
|
-
return [
|
|
1002
|
+
const { editor: n, options: e } = this;
|
|
1003
|
+
return n.options.injectCSS && typeof document < "u" && fe(je, n.options.injectNonce, "selection"), [
|
|
966
1004
|
new A({
|
|
967
|
-
key: new
|
|
1005
|
+
key: new S("selection"),
|
|
968
1006
|
props: {
|
|
969
1007
|
decorations(t) {
|
|
970
|
-
return t.selection.empty ||
|
|
971
|
-
|
|
1008
|
+
return t.selection.empty || n.isFocused || !n.isEditable || he(t.selection) || n.view.dragging ? null : O.create(t.doc, [
|
|
1009
|
+
V.inline(t.selection.from, t.selection.to, {
|
|
972
1010
|
class: e.className
|
|
973
1011
|
})
|
|
974
1012
|
]);
|
|
@@ -978,11 +1016,14 @@ b.create({
|
|
|
978
1016
|
];
|
|
979
1017
|
}
|
|
980
1018
|
});
|
|
981
|
-
var
|
|
982
|
-
function
|
|
983
|
-
|
|
1019
|
+
var Ue = "skipTrailingNode";
|
|
1020
|
+
function j({
|
|
1021
|
+
types: n,
|
|
1022
|
+
node: e
|
|
1023
|
+
}) {
|
|
1024
|
+
return e && Array.isArray(n) && n.includes(e.type) || (e == null ? void 0 : e.type) === n;
|
|
984
1025
|
}
|
|
985
|
-
|
|
1026
|
+
P.create({
|
|
986
1027
|
name: "trailingNode",
|
|
987
1028
|
addOptions() {
|
|
988
1029
|
return {
|
|
@@ -991,33 +1032,33 @@ b.create({
|
|
|
991
1032
|
};
|
|
992
1033
|
},
|
|
993
1034
|
addProseMirrorPlugins() {
|
|
994
|
-
var
|
|
995
|
-
const e = new
|
|
1035
|
+
var n;
|
|
1036
|
+
const e = new S(this.name), t = this.options.node || ((n = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : n.name) || "paragraph", o = Object.entries(this.editor.schema.nodes).map(([, r]) => r).filter((r) => (this.options.notAfter || []).concat(t).includes(r.name));
|
|
996
1037
|
return [
|
|
997
1038
|
new A({
|
|
998
1039
|
key: e,
|
|
999
1040
|
appendTransaction: (r, i, s) => {
|
|
1000
|
-
const { doc: l, tr: a, schema: c } = s,
|
|
1001
|
-
if (!r.some((
|
|
1002
|
-
return a.insert(
|
|
1041
|
+
const { doc: l, tr: a, schema: c } = s, d = e.getState(s), u = l.content.size, p = c.nodes[t];
|
|
1042
|
+
if (!r.some((f) => f.getMeta(Ue)) && d)
|
|
1043
|
+
return a.insert(u, p.create());
|
|
1003
1044
|
},
|
|
1004
1045
|
state: {
|
|
1005
1046
|
init: (r, i) => {
|
|
1006
1047
|
const s = i.tr.doc.lastChild;
|
|
1007
|
-
return !
|
|
1048
|
+
return !j({ node: s, types: o });
|
|
1008
1049
|
},
|
|
1009
1050
|
apply: (r, i) => {
|
|
1010
1051
|
if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
|
|
1011
1052
|
return i;
|
|
1012
1053
|
const s = r.doc.lastChild;
|
|
1013
|
-
return !
|
|
1054
|
+
return !j({ node: s, types: o });
|
|
1014
1055
|
}
|
|
1015
1056
|
}
|
|
1016
1057
|
})
|
|
1017
1058
|
];
|
|
1018
1059
|
}
|
|
1019
1060
|
});
|
|
1020
|
-
var
|
|
1061
|
+
var Ye = P.create({
|
|
1021
1062
|
name: "undoRedo",
|
|
1022
1063
|
addOptions() {
|
|
1023
1064
|
return {
|
|
@@ -1027,12 +1068,12 @@ var Be = b.create({
|
|
|
1027
1068
|
},
|
|
1028
1069
|
addCommands() {
|
|
1029
1070
|
return {
|
|
1030
|
-
undo: () => ({ state:
|
|
1031
|
-
redo: () => ({ state:
|
|
1071
|
+
undo: () => ({ state: n, dispatch: e }) => re(n, e),
|
|
1072
|
+
redo: () => ({ state: n, dispatch: e }) => ie(n, e)
|
|
1032
1073
|
};
|
|
1033
1074
|
},
|
|
1034
1075
|
addProseMirrorPlugins() {
|
|
1035
|
-
return [
|
|
1076
|
+
return [Le(this.options)];
|
|
1036
1077
|
},
|
|
1037
1078
|
addKeyboardShortcuts() {
|
|
1038
1079
|
return {
|
|
@@ -1045,63 +1086,63 @@ var Be = b.create({
|
|
|
1045
1086
|
};
|
|
1046
1087
|
}
|
|
1047
1088
|
});
|
|
1048
|
-
function
|
|
1049
|
-
var
|
|
1050
|
-
const
|
|
1089
|
+
function ot() {
|
|
1090
|
+
var d;
|
|
1091
|
+
const n = $(le.name), {
|
|
1051
1092
|
icon: e = void 0,
|
|
1052
1093
|
tooltip: t = void 0,
|
|
1053
|
-
shortcutKeys:
|
|
1094
|
+
shortcutKeys: o = void 0,
|
|
1054
1095
|
tooltipOptions: r = {},
|
|
1055
1096
|
action: i = void 0,
|
|
1056
1097
|
isActive: s = void 0
|
|
1057
|
-
} = ((
|
|
1098
|
+
} = ((d = n == null ? void 0 : n.componentProps) == null ? void 0 : d.undo) ?? {}, { disabled: l } = q(s), a = we[e], c = () => {
|
|
1058
1099
|
l || i && i();
|
|
1059
1100
|
};
|
|
1060
|
-
return !
|
|
1061
|
-
|
|
1101
|
+
return !n || !a ? /* @__PURE__ */ R(Q, {}) : /* @__PURE__ */ R(
|
|
1102
|
+
ee,
|
|
1062
1103
|
{
|
|
1063
1104
|
action: c,
|
|
1064
1105
|
disabled: l,
|
|
1065
1106
|
icon: e,
|
|
1066
|
-
shortcutKeys:
|
|
1107
|
+
shortcutKeys: o,
|
|
1067
1108
|
tooltip: t,
|
|
1068
1109
|
tooltipOptions: r
|
|
1069
1110
|
}
|
|
1070
1111
|
);
|
|
1071
1112
|
}
|
|
1072
|
-
function
|
|
1113
|
+
function rt() {
|
|
1073
1114
|
var c;
|
|
1074
|
-
const
|
|
1115
|
+
const n = $(le.name), {
|
|
1075
1116
|
icon: e = void 0,
|
|
1076
1117
|
tooltip: t = void 0,
|
|
1077
|
-
shortcutKeys:
|
|
1118
|
+
shortcutKeys: o = void 0,
|
|
1078
1119
|
tooltipOptions: r = {},
|
|
1079
1120
|
action: i = void 0,
|
|
1080
1121
|
isActive: s = void 0
|
|
1081
|
-
} = ((c =
|
|
1122
|
+
} = ((c = n == null ? void 0 : n.componentProps) == null ? void 0 : c.redo) ?? {}, { disabled: l } = q(s), a = () => {
|
|
1082
1123
|
l || i && i();
|
|
1083
1124
|
};
|
|
1084
|
-
return
|
|
1085
|
-
|
|
1125
|
+
return n ? /* @__PURE__ */ R(
|
|
1126
|
+
ee,
|
|
1086
1127
|
{
|
|
1087
1128
|
action: a,
|
|
1088
1129
|
disabled: l,
|
|
1089
1130
|
icon: e,
|
|
1090
|
-
shortcutKeys:
|
|
1131
|
+
shortcutKeys: o,
|
|
1091
1132
|
tooltip: t,
|
|
1092
1133
|
tooltipOptions: r
|
|
1093
1134
|
}
|
|
1094
|
-
) : /* @__PURE__ */ R(
|
|
1135
|
+
) : /* @__PURE__ */ R(Q, {});
|
|
1095
1136
|
}
|
|
1096
|
-
const
|
|
1137
|
+
const le = /* @__PURE__ */ Ye.extend({
|
|
1097
1138
|
//@ts-expect-error
|
|
1098
1139
|
addOptions() {
|
|
1099
|
-
var
|
|
1140
|
+
var n;
|
|
1100
1141
|
return {
|
|
1101
|
-
...(
|
|
1142
|
+
...(n = this.parent) == null ? void 0 : n.call(this),
|
|
1102
1143
|
depth: 100,
|
|
1103
1144
|
newGroupDelay: 500,
|
|
1104
|
-
button: ({ editor: e, t, extension:
|
|
1145
|
+
button: ({ editor: e, t, extension: o }) => {
|
|
1105
1146
|
var r, i;
|
|
1106
1147
|
return {
|
|
1107
1148
|
componentProps: {
|
|
@@ -1109,7 +1150,7 @@ const re = /* @__PURE__ */ Be.extend({
|
|
|
1109
1150
|
action: () => {
|
|
1110
1151
|
e.chain().focus().undo().run();
|
|
1111
1152
|
},
|
|
1112
|
-
shortcutKeys: ((r =
|
|
1153
|
+
shortcutKeys: ((r = o.options.shortcutKeys) == null ? void 0 : r[0]) ?? ["mod", "Z"],
|
|
1113
1154
|
isActive: () => e.can().undo(),
|
|
1114
1155
|
icon: "Undo2",
|
|
1115
1156
|
tooltip: t("editor.undo.tooltip")
|
|
@@ -1118,7 +1159,7 @@ const re = /* @__PURE__ */ Be.extend({
|
|
|
1118
1159
|
action: () => {
|
|
1119
1160
|
e.chain().focus().redo().run();
|
|
1120
1161
|
},
|
|
1121
|
-
shortcutKeys: ((i =
|
|
1162
|
+
shortcutKeys: ((i = o.options.shortcutKeys) == null ? void 0 : i[1]) ?? ["shift", "mod", "Z"],
|
|
1122
1163
|
isActive: () => e.can().redo(),
|
|
1123
1164
|
icon: "Redo2",
|
|
1124
1165
|
tooltip: t("editor.redo.tooltip")
|
|
@@ -1130,7 +1171,7 @@ const re = /* @__PURE__ */ Be.extend({
|
|
|
1130
1171
|
}
|
|
1131
1172
|
});
|
|
1132
1173
|
export {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1174
|
+
le as History,
|
|
1175
|
+
rt as RichTextRedo,
|
|
1176
|
+
ot as RichTextUndo
|
|
1136
1177
|
};
|