@clevertask/scribe 0.1.19 → 0.1.21
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/README.md +2 -2
- package/dist/{BarMenu-C9tCdvyV.js → BarMenu-tPZoiOba.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.js +6 -6
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +3 -3
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/tableOfContents.js +3 -3
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-CzXFZHMF.js → dist-Cer8ra_P.js} +55 -39
- package/dist/{dist-CkWsQ5Lj.js → dist-ClNucvAM.js} +612 -819
- package/dist/{dist-DRPH9MfF.js → dist-D31OwZrM.js} +231 -168
- package/dist/{extension-CKcvyrIW.js → extension-B-7qHi2u.js} +2 -2
- package/dist/{extension-link-yMrg9JOz.js → extension-link-BQrkQZHi.js} +23 -23
- package/dist/{html-to-markdown-pY8ngCXa.js → html-to-markdown-D7PT8MhP.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-COv0iaxr.js → markdown-to-html-ChfR7P_Y.js} +39 -11
- package/dist/{menus-D1cst_3I.js → menus-DLKcWlVX.js} +56 -54
- package/dist/{resizable-table-D0mls3aB.js → resizable-table-DgMCiXeO.js} +28 -31
- package/dist/{schema-extensions-ChhE6XCo.js → schema-extensions-BMJIwh-u.js} +309 -314
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{tippy.esm-DOXqN1Qm.js → tippy.esm-8vSV0zL7.js} +6 -6
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +59 -56
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../BarMenu-
|
|
1
|
+
import { t as e } from "../../BarMenu-tPZoiOba.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as e } from "../../dist-
|
|
1
|
+
import { s as e } from "../../dist-D31OwZrM.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../menus-
|
|
3
|
+
import { t as n } from "../../menus-DLKcWlVX.js";
|
|
4
4
|
import { Flex as r, IconButton as i } from "@radix-ui/themes";
|
|
5
5
|
import { useCallback as a } from "react";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CALLOUT_VARIANTS as e, CALLOUT_VARIANT_LABELS as t, isCalloutVariant as n } from "../Scribe/extension/callout.js";
|
|
2
|
-
import { s as r } from "../../dist-
|
|
2
|
+
import { s as r } from "../../dist-D31OwZrM.js";
|
|
3
3
|
import { getPopupMountTarget as i } from "../Scribe/extension/getPopupMountTarget.js";
|
|
4
|
-
import { t as a } from "../../menus-
|
|
4
|
+
import { t as a } from "../../menus-DLKcWlVX.js";
|
|
5
5
|
import { CalloutIcon as o, RemoveCalloutIcon as s } from "../../icons/CalloutIcon.js";
|
|
6
6
|
import { calloutBubbleMenuPluginKey as c, getSelectionCalloutContext as l } from "./calloutBubbleMenuPlugin.js";
|
|
7
7
|
import { getSelectionContextualMenuOwner as u } from "./contextualMenuOwner.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getExternalLinkPreviewHostname as e } from "../Scribe/extension/external-link-preview/attributes.js";
|
|
2
|
-
import { s as t } from "../../dist-
|
|
2
|
+
import { s as t } from "../../dist-D31OwZrM.js";
|
|
3
3
|
import { getPopupMountTarget as n } from "../Scribe/extension/getPopupMountTarget.js";
|
|
4
4
|
import r from "./LinkEditor.js";
|
|
5
5
|
import { consumeLinkBubbleMenuFocusTarget as i, getPlainLinkContextAtPosition as a, getSelectionLinkContext as o, hideLinkBubbleMenu as s, linkBubbleMenuPluginKey as c, showLinkBubbleMenu as l } from "./linkBubbleMenuPlugin.js";
|
|
6
|
-
import { t as u } from "../../menus-
|
|
6
|
+
import { t as u } from "../../menus-DLKcWlVX.js";
|
|
7
7
|
import { getSelectionContextualMenuOwner as d } from "./contextualMenuOwner.js";
|
|
8
8
|
import { getExternalLinkPreviewResolutionStatus as f } from "../Scribe/extension/external-link-preview/resolver.js";
|
|
9
9
|
import { Box as p } from "@radix-ui/themes";
|
|
@@ -53,7 +53,7 @@ var b = /auto|overlay|scroll/, x = (e) => {
|
|
|
53
53
|
}), d(b.state) !== "link") ? !1 : (l(b, "url"), !0), r = (n) => {
|
|
54
54
|
if (n.button !== 0 || !b.isEditable) return;
|
|
55
55
|
let r = n.target?.closest?.("a");
|
|
56
|
-
|
|
56
|
+
r && e.contains(r) && !r.closest("[data-type=\"external-link-preview\"]") && (t = {
|
|
57
57
|
x: n.clientX,
|
|
58
58
|
y: n.clientY
|
|
59
59
|
});
|
|
@@ -70,7 +70,7 @@ var b = /auto|overlay|scroll/, x = (e) => {
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
let c = a(b.state, s), l = c ? b.view.nodeDOM(c.from) : null;
|
|
73
|
-
|
|
73
|
+
l && i.contains(l) && n(c) && r.preventDefault();
|
|
74
74
|
};
|
|
75
75
|
return e.addEventListener("mousedown", r), e.addEventListener("click", i), () => {
|
|
76
76
|
e.removeEventListener("mousedown", r), e.removeEventListener("click", i);
|
|
@@ -79,7 +79,7 @@ var b = /auto|overlay|scroll/, x = (e) => {
|
|
|
79
79
|
let e = b.view.dom, t = (e) => {
|
|
80
80
|
if (e.key !== "F10" || !e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !b.isEditable) return;
|
|
81
81
|
let t = o(b.state);
|
|
82
|
-
t?.kind === "plain" && (b.chain().extendMarkRange("link").run(), t = o(b.state)),
|
|
82
|
+
t?.kind === "plain" && (b.chain().extendMarkRange("link").run(), t = o(b.state)), t && d(b.state) === "link" && (e.preventDefault(), e.stopImmediatePropagation(), l(b, t.kind === "preview" ? "dialog" : "url"));
|
|
83
83
|
};
|
|
84
84
|
return e.addEventListener("keydown", t, !0), () => e.removeEventListener("keydown", t, !0);
|
|
85
85
|
}, [b]), h(() => {
|
|
@@ -87,7 +87,7 @@ var b = /auto|overlay|scroll/, x = (e) => {
|
|
|
87
87
|
if (!t) return;
|
|
88
88
|
let n = (e) => {
|
|
89
89
|
let n = O.current;
|
|
90
|
-
|
|
90
|
+
n?.isConnected && e instanceof t.Node && !n.contains(e) && !b.view.dom.contains(e) && s(b);
|
|
91
91
|
}, r = (e) => n(e.target), i = (e) => n(e.target);
|
|
92
92
|
return e.addEventListener("pointerdown", r, !0), e.addEventListener("focusin", i), () => {
|
|
93
93
|
e.removeEventListener("pointerdown", r, !0), e.removeEventListener("focusin", i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as e } from "../../dist-
|
|
1
|
+
import { s as e } from "../../dist-D31OwZrM.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../menus-
|
|
3
|
+
import { t as n } from "../../menus-DLKcWlVX.js";
|
|
4
4
|
import { getSelectionTableContext as r, tableBubbleMenuPluginKey as i } from "./tableBubbleMenuPlugin.js";
|
|
5
5
|
import { getSelectionContextualMenuOwner as a } from "./contextualMenuOwner.js";
|
|
6
6
|
import { Flex as o, IconButton as s, Separator as c } from "@radix-ui/themes";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as e } from "../../dist-
|
|
1
|
+
import { v as e } from "../../dist-ClNucvAM.js";
|
|
2
2
|
import { normalizeExternalLinkPreviewAttributes as t } from "../Scribe/extension/external-link-preview/attributes.js";
|
|
3
3
|
import { NodeSelection as n, PluginKey as r } from "@tiptap/pm/state";
|
|
4
4
|
//#region lib/components/Menu/linkBubbleMenuPlugin.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as e } from "../../../../dist-
|
|
1
|
+
import { i as e } from "../../../../dist-D31OwZrM.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../../../tippy.esm-
|
|
3
|
+
import { t as n } from "../../../../tippy.esm-8vSV0zL7.js";
|
|
4
4
|
import { EmojiList as r } from "./EmojiList.js";
|
|
5
5
|
//#region lib/components/Scribe/extension/emoji/suggest.ts
|
|
6
6
|
var i = () => ({
|
|
@@ -25,7 +25,7 @@ var i = () => ({
|
|
|
25
25
|
}));
|
|
26
26
|
},
|
|
27
27
|
onUpdate(e) {
|
|
28
|
-
|
|
28
|
+
i && a && e.clientRect && (i.updateProps(e), a.setProps({ getReferenceClientRect: e.clientRect }));
|
|
29
29
|
},
|
|
30
30
|
onKeyDown(e) {
|
|
31
31
|
return e.event.key === "Escape" && a ? (a.hide(), !0) : i?.ref?.onKeyDown(e) ?? !1;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../extension-link-
|
|
1
|
+
import { t as e } from "../../../extension-link-BQrkQZHi.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e } from "../../../dist-
|
|
2
|
-
import { n as t, t as n } from "../../../markdown-to-html-
|
|
1
|
+
import { n as e } from "../../../dist-ClNucvAM.js";
|
|
2
|
+
import { n as t, t as n } from "../../../markdown-to-html-ChfR7P_Y.js";
|
|
3
3
|
import { Plugin as r, PluginKey as i } from "@tiptap/pm/state";
|
|
4
4
|
//#region lib/components/Scribe/extension/extension-markdown-paste.ts
|
|
5
5
|
var a = new i("markdownPaste"), o = /* @__PURE__ */ new Set([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as e } from "../../../../dist-
|
|
1
|
+
import { v as e } from "../../../../dist-ClNucvAM.js";
|
|
2
2
|
import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t, hasExternalLinkPreviewMetadata as n, normalizeExternalLinkPreviewAttributes as r, normalizeExternalLinkPreviewHref as i } from "./attributes.js";
|
|
3
3
|
import { normalizeLinkUrl as a } from "../../../Menu/linkUrl.js";
|
|
4
4
|
import { startExternalLinkPreviewResolution as o } from "./resolver.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EXTERNAL_LINK_PREVIEW_DISPLAYS as e } from "./types.js";
|
|
2
2
|
import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t } from "./attributes.js";
|
|
3
3
|
import { ExternalLinkPreviewSchema as n } from "./schema.js";
|
|
4
|
-
import { r } from "../../../../dist-
|
|
4
|
+
import { r } from "../../../../dist-D31OwZrM.js";
|
|
5
5
|
import { createExternalLinkPreviewResolverPlugin as i } from "./resolver.js";
|
|
6
6
|
import { createExternalLinkPreviewCommands as a } from "./commands.js";
|
|
7
7
|
import { ExternalLinkPreviewNodeView as o } from "./node-view.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getExternalLinkPreviewHostname as e, getExternalLinkPreviewTitle as t, normalizeExternalLinkPreviewAttributes as n } from "./attributes.js";
|
|
2
|
-
import { n as r, s as i } from "../../../../dist-
|
|
2
|
+
import { n as r, s as i } from "../../../../dist-D31OwZrM.js";
|
|
3
3
|
import { showLinkBubbleMenu as a } from "../../../Menu/linkBubbleMenuPlugin.js";
|
|
4
4
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
//#region lib/components/Scribe/extension/external-link-preview/node-view.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as e } from "../../../../dist-ClNucvAM.js";
|
|
2
2
|
import { getExternalLinkPreviewHostname as t, getExternalLinkPreviewTitle as n } from "./attributes.js";
|
|
3
3
|
import { getExternalLinkPreviewDataAttributes as r } from "./serialization.js";
|
|
4
4
|
//#region lib/components/Scribe/extension/external-link-preview/render-html.ts
|
|
@@ -80,7 +80,7 @@ var a = new i("scribeExternalLinkPreviewResolver"), o = (e, t) => e?.type.name =
|
|
|
80
80
|
let i = a.getState(r.state), o = new Set(Array.from(i?.requests.values() ?? []).filter((e) => e.status === "loading").map((e) => e.token));
|
|
81
81
|
n.forEach((e, t) => {
|
|
82
82
|
o.has(t) || (e.abort(), n.delete(t));
|
|
83
|
-
}),
|
|
83
|
+
}), t && !e.isDestroyed && i && i.requests.forEach((e) => {
|
|
84
84
|
if (e.status !== "loading" || n.has(e.token)) return;
|
|
85
85
|
let i = new AbortController();
|
|
86
86
|
n.set(e.token, i), Promise.resolve().then(() => t(e.href, { signal: i.signal })).then((t) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e } from "../../../../dist-
|
|
1
|
+
import { a as e } from "../../../../dist-ClNucvAM.js";
|
|
2
2
|
import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t, isExternalLinkPreviewDisplay as n, normalizeExternalLinkPreviewAttributes as r, normalizeExternalLinkPreviewHref as i, normalizeExternalLinkPreviewLinkText as a, normalizeExternalLinkPreviewMediaUrl as o, normalizeExternalLinkPreviewMetadata as s } from "./attributes.js";
|
|
3
3
|
import { getExternalLinkPreviewAttributesFromElement as c } from "./serialization.js";
|
|
4
4
|
import { renderExternalLinkPreviewHTML as l } from "./render-html.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../extension-
|
|
1
|
+
import { t as e } from "../../../extension-B-7qHi2u.js";
|
|
2
2
|
export { e as initExtensions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../resizable-table-
|
|
1
|
+
import { t as e } from "../../../resizable-table-DgMCiXeO.js";
|
|
2
2
|
export { e as ScribeTable };
|
|
@@ -988,7 +988,7 @@ var d = (/* @__PURE__ */ e(((e, t) => {
|
|
|
988
988
|
function ta(e) {
|
|
989
989
|
if (!K(e)) return ds(e);
|
|
990
990
|
var t = os(e), n = [];
|
|
991
|
-
for (var r in e) r
|
|
991
|
+
for (var r in e) (r != "constructor" || !t && w.call(e, r)) && n.push(r);
|
|
992
992
|
return n;
|
|
993
993
|
}
|
|
994
994
|
function na(e, t) {
|
|
@@ -3077,7 +3077,7 @@ var d = (/* @__PURE__ */ e(((e, t) => {
|
|
|
3077
3077
|
});
|
|
3078
3078
|
function yf(e, t, n) {
|
|
3079
3079
|
var r = Z(t), i = Mi(t, r);
|
|
3080
|
-
n == null && !
|
|
3080
|
+
n == null && (!K(t) || !i.length && r.length) && (n = t, t = e, e = this, i = Mi(t, Z(t)));
|
|
3081
3081
|
var a = !(K(n) && "chain" in n) || !!n.chain, o = du(e);
|
|
3082
3082
|
return M(i, function(n) {
|
|
3083
3083
|
var r = t[n];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e } from "../../../../dist-
|
|
2
|
-
import { n as t } from "../../../../dist-
|
|
1
|
+
import { n as e } from "../../../../dist-ClNucvAM.js";
|
|
2
|
+
import { n as t } from "../../../../dist-Cer8ra_P.js";
|
|
3
3
|
import { PluginKey as n } from "@tiptap/pm/state";
|
|
4
4
|
//#region lib/components/Scribe/extension/slashCommand/index.ts
|
|
5
5
|
var r = new n("slashSuggestion"), i = e.create({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as e } from "../../../../dist-
|
|
1
|
+
import { i as e } from "../../../../dist-D31OwZrM.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../../../tippy.esm-
|
|
3
|
+
import { t as n } from "../../../../tippy.esm-8vSV0zL7.js";
|
|
4
4
|
import { SlashCommandList as r } from "./SlashCommandList.js";
|
|
5
5
|
//#region lib/components/Scribe/extension/slashCommand/renderItems.ts
|
|
6
6
|
var i = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "../../../dist-
|
|
1
|
+
import { n as e } from "../../../dist-ClNucvAM.js";
|
|
2
2
|
import { Plugin as t, PluginKey as n } from "@tiptap/pm/state";
|
|
3
3
|
//#region lib/components/Scribe/extension/tableOfContents.ts
|
|
4
4
|
var r = "scribeTableOfContents", i = new n("scribeTableOfContents"), a = 10, o = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "heading", s = (e, t) => {
|
|
@@ -34,7 +34,7 @@ var r = "scribeTableOfContents", i = new n("scribeTableOfContents"), a = 10, o =
|
|
|
34
34
|
}, _ = (e, t) => {
|
|
35
35
|
let n = [];
|
|
36
36
|
return e.state.doc.descendants((e, r) => {
|
|
37
|
-
|
|
37
|
+
t.includes(e.type.name) && e.textContent.length !== 0 && n.push({
|
|
38
38
|
node: e,
|
|
39
39
|
pos: r
|
|
40
40
|
});
|
|
@@ -80,7 +80,7 @@ var r = "scribeTableOfContents", i = new n("scribeTableOfContents"), a = 10, o =
|
|
|
80
80
|
textContent: e.textContent
|
|
81
81
|
}))), S = (e, t, n) => {
|
|
82
82
|
let r = x(n), i = !e.hasCreated;
|
|
83
|
-
e.anchors = n.map((e) => e.dom), e.content = n,
|
|
83
|
+
e.anchors = n.map((e) => e.dom), e.content = n, (i || r !== e.lastSignature) && (e.hasCreated = !0, e.lastSignature = r, t.onUpdate?.(n, i));
|
|
84
84
|
}, C = e.create({
|
|
85
85
|
name: "scribeTableOfContents",
|
|
86
86
|
addOptions() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as e, t } from "../../BarMenu-
|
|
2
|
-
import { o as n, t as r } from "../../dist-
|
|
1
|
+
import { n as e, t } from "../../BarMenu-tPZoiOba.js";
|
|
2
|
+
import { o as n, t as r } from "../../dist-D31OwZrM.js";
|
|
3
3
|
import i from "../Menu/CalloutBubbleMenu.js";
|
|
4
4
|
import a from "../Menu/LinkBubbleMenu.js";
|
|
5
5
|
import o from "../Menu/TableBubbleMenu.js";
|
|
6
|
-
import { t as s } from "../../html-to-markdown-
|
|
7
|
-
import { t as c } from "../../extension-
|
|
6
|
+
import { t as s } from "../../html-to-markdown-D7PT8MhP.js";
|
|
7
|
+
import { t as c } from "../../extension-B-7qHi2u.js";
|
|
8
8
|
import { SuggestionItemType as l } from "./extension/slashCommand/items.js";
|
|
9
9
|
import "./extension/tableOfContents.js";
|
|
10
10
|
import "../../utils/index.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as e } from "./dist-
|
|
1
|
+
import { f as e } from "./dist-ClNucvAM.js";
|
|
2
2
|
import { a as t, c as n, i as r, r as i } from "./floating-ui.dom-CmJ6iBdh.js";
|
|
3
3
|
import { Plugin as a, PluginKey as o } from "@tiptap/pm/state";
|
|
4
4
|
import { Decoration as s, DecorationSet as c } from "@tiptap/pm/view";
|
|
5
|
-
//#region node_modules/.pnpm/@tiptap+suggestion@3.
|
|
5
|
+
//#region node_modules/.pnpm/@tiptap+suggestion@3.31.3_@floating-ui+dom@1.8.0_@tiptap+core@3.31.3_@tiptap+pm@3.31.3__@tiptap+pm@3.31.3/node_modules/@tiptap/suggestion/dist/index.js
|
|
6
6
|
function l(t) {
|
|
7
7
|
let { char: n, allowSpaces: r, allowToIncludeChar: i, allowedPrefixes: a, startOfLine: o, $position: s } = t, c = r && !i, l = e(n), u = RegExp(`\\s${l}$`), d = o ? "^" : "", f = i ? "" : l, p = RegExp(c ? `${d}${l}.*?(?=\\s${f}|$)` : `${d}(?:^)?${l}[^\\s${f}]*`, "gm"), m = s.nodeBefore?.isText && s.nodeBefore.text;
|
|
8
8
|
if (!m) return null;
|
|
@@ -63,15 +63,20 @@ function h({ pluginKey: e, decorationTag: t, decorationClass: n, decorationConte
|
|
|
63
63
|
handleKeyDown(t, n) {
|
|
64
64
|
var r;
|
|
65
65
|
let i = e.getState(t.state);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
if (!i.active) return !1;
|
|
67
|
+
if (n.key === "Escape" || n.key === "Esc") {
|
|
68
|
+
var s;
|
|
69
|
+
return a == null || (s = a.onKeyDown) == null || s.call(a, {
|
|
70
|
+
view: t,
|
|
71
|
+
event: n,
|
|
72
|
+
range: i.range
|
|
73
|
+
}), o(t), !0;
|
|
74
|
+
}
|
|
75
|
+
return (a == null || (r = a.onKeyDown) == null ? void 0 : r.call(a, {
|
|
71
76
|
view: t,
|
|
72
77
|
event: n,
|
|
73
78
|
range: i.range
|
|
74
|
-
}) || !1
|
|
79
|
+
})) || !1;
|
|
75
80
|
},
|
|
76
81
|
decorations(a) {
|
|
77
82
|
let { active: o, range: l, decorationId: u, query: d } = e.getState(a);
|
|
@@ -180,14 +185,15 @@ function _({ editor: e, items: t }) {
|
|
|
180
185
|
};
|
|
181
186
|
}
|
|
182
187
|
function v({ placement: e, offset: r, flip: i, floatingUi: a }) {
|
|
183
|
-
|
|
188
|
+
var o;
|
|
189
|
+
let s = [n({
|
|
184
190
|
mainAxis: r.mainAxis ?? 4,
|
|
185
191
|
crossAxis: r.crossAxis ?? 0
|
|
186
192
|
})];
|
|
187
|
-
return i &&
|
|
193
|
+
return i && s.push(t()), a != null && (o = a.middleware) != null && o.length && s.push(...a.middleware), {
|
|
188
194
|
placement: e,
|
|
189
195
|
strategy: a?.strategy ?? "absolute",
|
|
190
|
-
middleware:
|
|
196
|
+
middleware: s
|
|
191
197
|
};
|
|
192
198
|
}
|
|
193
199
|
function y(e) {
|
|
@@ -248,42 +254,44 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
|
|
|
248
254
|
floatingUi: d
|
|
249
255
|
});
|
|
250
256
|
function S(e, t) {
|
|
251
|
-
var n, i, a;
|
|
252
257
|
switch (e) {
|
|
253
258
|
case "started":
|
|
254
|
-
|
|
259
|
+
var n;
|
|
260
|
+
r == null || (n = r.onStart) == null || n.call(r, t);
|
|
255
261
|
break;
|
|
256
262
|
case "updated":
|
|
257
|
-
|
|
263
|
+
var i;
|
|
264
|
+
r == null || (i = r.onUpdate) == null || i.call(r, t);
|
|
258
265
|
break;
|
|
259
|
-
case "stopped":
|
|
266
|
+
case "stopped":
|
|
267
|
+
var a;
|
|
268
|
+
r == null || (a = r.onExit) == null || a.call(r, t);
|
|
260
269
|
}
|
|
261
270
|
}
|
|
262
271
|
return {
|
|
263
272
|
update: async (n, d) => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
else if (
|
|
270
|
-
else if (w.active && k) T = "updated";
|
|
273
|
+
let _ = t.getState(d), v = t.getState(n.state);
|
|
274
|
+
if (!_ || !v) return;
|
|
275
|
+
let C = null, w = _.query !== v.query, T = _.text !== v.text, E = _.range.from !== v.range.from || _.range.to !== v.range.to, D = w || T || E;
|
|
276
|
+
if (!_.active && v.active) C = "started";
|
|
277
|
+
else if (_.active && !v.active) C = "stopped";
|
|
278
|
+
else if (v.active && D) C = "updated";
|
|
271
279
|
else return;
|
|
272
|
-
let
|
|
280
|
+
let O = C === "stopped" ? _ : v, k = n.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`), A = m(n, k), j = i === 0 || (O.query ? O.query.length >= i : !1), M = (C === "started" || C === "updated") && j;
|
|
273
281
|
if (g = {
|
|
274
282
|
editor: e,
|
|
275
|
-
range:
|
|
276
|
-
query:
|
|
277
|
-
text:
|
|
283
|
+
range: O.range,
|
|
284
|
+
query: O.query || "",
|
|
285
|
+
text: O.text || "",
|
|
278
286
|
items: o ?? [],
|
|
279
287
|
command: (t) => p({
|
|
280
288
|
editor: e,
|
|
281
|
-
range:
|
|
289
|
+
range: O.range,
|
|
282
290
|
props: t
|
|
283
291
|
}),
|
|
284
|
-
decorationNode:
|
|
285
|
-
clientRect:
|
|
286
|
-
loading:
|
|
292
|
+
decorationNode: k,
|
|
293
|
+
clientRect: A,
|
|
294
|
+
loading: M,
|
|
287
295
|
placement: s,
|
|
288
296
|
offset: {
|
|
289
297
|
mainAxis: c.mainAxis ?? 4,
|
|
@@ -293,15 +301,23 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
|
|
|
293
301
|
flip: u,
|
|
294
302
|
floatingUi: x,
|
|
295
303
|
mount: b({
|
|
296
|
-
getReferenceRect:
|
|
304
|
+
getReferenceRect: A,
|
|
297
305
|
contextElement: n.dom,
|
|
298
306
|
config: x,
|
|
299
307
|
container: l,
|
|
300
308
|
dismissOnOutsideClick: f,
|
|
301
309
|
dismiss: () => h(e.view)
|
|
302
310
|
})
|
|
303
|
-
},
|
|
304
|
-
|
|
311
|
+
}, C === "started") {
|
|
312
|
+
var N;
|
|
313
|
+
r == null || (N = r.onBeforeStart) == null || N.call(r, g);
|
|
314
|
+
}
|
|
315
|
+
if (C === "updated") {
|
|
316
|
+
var P;
|
|
317
|
+
r == null || (P = r.onBeforeUpdate) == null || P.call(r, g);
|
|
318
|
+
}
|
|
319
|
+
if (C === "started" && S(C, g), C === "started" || C === "updated") {
|
|
320
|
+
if (!M) y.abort(), g = {
|
|
305
321
|
...g,
|
|
306
322
|
items: o ?? [],
|
|
307
323
|
loading: !1
|
|
@@ -311,8 +327,8 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
|
|
|
311
327
|
...g,
|
|
312
328
|
items: o ?? [],
|
|
313
329
|
loading: !0
|
|
314
|
-
},
|
|
315
|
-
let e = await y.fetch(
|
|
330
|
+
}, C = "updated", S(C, g);
|
|
331
|
+
let e = await y.fetch(O.query || "", a);
|
|
316
332
|
if (e.status === "aborted") return;
|
|
317
333
|
if (!t.getState(n.state)?.active) {
|
|
318
334
|
y.abort();
|
|
@@ -328,15 +344,15 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
|
|
|
328
344
|
};
|
|
329
345
|
}
|
|
330
346
|
}
|
|
331
|
-
if (
|
|
332
|
-
y.abort(), S(
|
|
347
|
+
if (C === "stopped") {
|
|
348
|
+
y.abort(), S(C, g), g = void 0;
|
|
333
349
|
return;
|
|
334
350
|
}
|
|
335
|
-
|
|
351
|
+
C === "updated" && S(C, g);
|
|
336
352
|
},
|
|
337
353
|
destroy: () => {
|
|
338
354
|
var e;
|
|
339
|
-
y.abort(), g && ((e = r
|
|
355
|
+
y.abort(), g && (r == null || (e = r.onExit) == null || e.call(r, g));
|
|
340
356
|
}
|
|
341
357
|
};
|
|
342
358
|
}
|