@clevertask/scribe 0.1.12 → 0.1.14
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 +51 -1
- package/dist/{BarMenu-5M9g9Y1j.js → BarMenu-x4sf3ECS.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/ExternalLinkDisplayOptions.d.ts +13 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +1 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +90 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +161 -61
- package/dist/components/Menu/LinkEditor.d.ts +9 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +117 -64
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/contextualMenuOwner.d.ts +1 -1
- package/dist/components/Menu/contextualMenuOwner.d.ts.map +1 -1
- package/dist/components/Menu/contextualMenuOwner.js +9 -6
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +24 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +43 -6
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- 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/attributes.d.ts +18 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +82 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +53 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.js +134 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +13 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/index.js +138 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +3 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +97 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +21 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +8 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.js +54 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.js +38 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +62 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +23 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +118 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts +10 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +69 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +53 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/types.js +4 -0
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +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/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +14 -0
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +5 -5
- package/dist/{dist-Dw4STOPE.js → dist-DDjaA1Pn.js} +309 -150
- package/dist/{dist-DFua_Xbu.js → dist-tNcpTcFT.js} +893 -430
- package/dist/{extension-_8uh0Ik9.js → extension-dRUfQQo6.js} +2097 -2059
- package/dist/{extension-link-CjfUZ90W.js → extension-link-RYtPpHwt.js} +52 -51
- package/dist/{html-to-markdown-C920nQtn.js → html-to-markdown-nbQ6qHyO.js} +173 -162
- package/dist/main.css +148 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -9
- package/dist/{markdown-to-html-CW0Nb9Ye.js → markdown-to-html-B-KKCZRs.js} +115 -111
- package/dist/{menus-_EXlLMjz.js → menus-U2HdvQnu.js} +18 -18
- package/dist/{resizable-table-Ddw3l6DJ.js → resizable-table-m0AzovsZ.js} +42 -24
- package/dist/{slashCommand-CxX07Nbk.js → slashCommand-CtvgnL0Z.js} +2 -2
- package/dist/utils/create-scribe-editor.d.ts +4 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +48 -48
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { normalizeExternalLinkPreviewAttributes as e, normalizeExternalLinkPreviewMetadataPatch as t } from "./attributes.js";
|
|
2
|
+
import { NodeSelection as n, Plugin as r, PluginKey as i } from "@tiptap/pm/state";
|
|
3
|
+
//#region lib/components/Scribe/extension/external-link-preview/resolver.ts
|
|
4
|
+
var a = new i("scribeExternalLinkPreviewResolver"), o = (e, t) => e?.type.name === "externalLinkPreview" && e.attrs.href === t, s = (e, t) => Array.from(e.requests.values()).find((e) => e.token === t), c = (e, t, n) => (e.setMeta(a, {
|
|
5
|
+
type: "start",
|
|
6
|
+
href: n,
|
|
7
|
+
position: t
|
|
8
|
+
}), e), l = (e, t) => {
|
|
9
|
+
let n = a.getState(e);
|
|
10
|
+
return n ? Array.from(n.requests.values()).find((e) => e.position === t)?.status ?? "idle" : "idle";
|
|
11
|
+
}, u = (e, t) => {
|
|
12
|
+
let n = /* @__PURE__ */ new Map();
|
|
13
|
+
t.requests.forEach((t) => {
|
|
14
|
+
let r = e.mapping.mapResult(t.position, 1), i = e.doc.nodeAt(r.pos);
|
|
15
|
+
!r.deleted && o(i, t.href) && n.set(t.token, {
|
|
16
|
+
...t,
|
|
17
|
+
position: r.pos
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
let r = e.getMeta(a), i = t.nextToken;
|
|
21
|
+
if (!r) return {
|
|
22
|
+
nextToken: i,
|
|
23
|
+
requests: n
|
|
24
|
+
};
|
|
25
|
+
if (r.type === "start") n.forEach((e, t) => {
|
|
26
|
+
e.position === r.position && n.delete(t);
|
|
27
|
+
}), o(e.doc.nodeAt(r.position), r.href) && (i += 1, n.set(i, {
|
|
28
|
+
href: r.href,
|
|
29
|
+
position: r.position,
|
|
30
|
+
status: "loading",
|
|
31
|
+
token: i
|
|
32
|
+
}));
|
|
33
|
+
else if (r.type === "complete") n.delete(r.token);
|
|
34
|
+
else {
|
|
35
|
+
let e = s({
|
|
36
|
+
nextToken: i,
|
|
37
|
+
requests: n
|
|
38
|
+
}, r.token);
|
|
39
|
+
e && n.set(e.token, {
|
|
40
|
+
...e,
|
|
41
|
+
status: "error"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
nextToken: i,
|
|
46
|
+
requests: n
|
|
47
|
+
};
|
|
48
|
+
}, d = (e, t) => {
|
|
49
|
+
e.isDestroyed || e.dispatch(e.state.tr.setMeta(a, t).setMeta("addToHistory", !1));
|
|
50
|
+
}, f = (r, i, c) => {
|
|
51
|
+
if (r.isDestroyed) return;
|
|
52
|
+
let l = a.getState(r.state), u = l ? s(l, i.token) : void 0;
|
|
53
|
+
if (!u || u.status !== "loading" || !c) {
|
|
54
|
+
u && !c && d(r, {
|
|
55
|
+
type: "error",
|
|
56
|
+
token: i.token
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let f = r.state.doc.nodeAt(u.position);
|
|
61
|
+
if (!o(f, u.href) || !f) return;
|
|
62
|
+
let p = e({
|
|
63
|
+
...f.attrs,
|
|
64
|
+
...t(c)
|
|
65
|
+
});
|
|
66
|
+
if (!p) {
|
|
67
|
+
d(r, {
|
|
68
|
+
type: "error",
|
|
69
|
+
token: i.token
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let m = r.state.selection instanceof n && r.state.selection.from === u.position && r.state.selection.node.type.name === "externalLinkPreview", h = r.state.tr.setNodeMarkup(u.position, void 0, p).setMeta(a, {
|
|
74
|
+
type: "complete",
|
|
75
|
+
token: i.token
|
|
76
|
+
}).setMeta("addToHistory", !1);
|
|
77
|
+
m && h.setSelection(n.create(h.doc, u.position)), r.dispatch(h);
|
|
78
|
+
}, p = ({ editor: e, resolve: t }) => {
|
|
79
|
+
let n = /* @__PURE__ */ new Map(), i = (r) => {
|
|
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
|
+
n.forEach((e, t) => {
|
|
82
|
+
o.has(t) || (e.abort(), n.delete(t));
|
|
83
|
+
}), !(!t || e.isDestroyed || !i) && i.requests.forEach((e) => {
|
|
84
|
+
if (e.status !== "loading" || n.has(e.token)) return;
|
|
85
|
+
let i = new AbortController();
|
|
86
|
+
n.set(e.token, i), Promise.resolve().then(() => t(e.href, { signal: i.signal })).then((t) => {
|
|
87
|
+
i.signal.aborted || f(r, e, t);
|
|
88
|
+
}).catch(() => {
|
|
89
|
+
i.signal.aborted || d(r, {
|
|
90
|
+
type: "error",
|
|
91
|
+
token: e.token
|
|
92
|
+
});
|
|
93
|
+
}).finally(() => {
|
|
94
|
+
n.delete(e.token);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
return new r({
|
|
99
|
+
key: a,
|
|
100
|
+
state: {
|
|
101
|
+
init: () => ({
|
|
102
|
+
nextToken: 0,
|
|
103
|
+
requests: /* @__PURE__ */ new Map()
|
|
104
|
+
}),
|
|
105
|
+
apply: u
|
|
106
|
+
},
|
|
107
|
+
view(e) {
|
|
108
|
+
return i(e), {
|
|
109
|
+
update: i,
|
|
110
|
+
destroy() {
|
|
111
|
+
n.forEach((e) => e.abort()), n.clear();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
export { p as createExternalLinkPreviewResolverPlugin, a as externalLinkPreviewResolverPluginKey, l as getExternalLinkPreviewResolutionStatus, c as startExternalLinkPreviewResolution };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExternalLinkPreviewAttributes } from "./types";
|
|
2
|
+
export declare const getExternalLinkPreviewAttributesFromElement: (element: Element) => ExternalLinkPreviewAttributes | null;
|
|
3
|
+
export declare const getExternalLinkPreviewDataAttributes: (attributes: ExternalLinkPreviewAttributes) => Record<string, string>;
|
|
4
|
+
export declare const rebuildExternalLinkPreviewElement: (element: Element, attributes: ExternalLinkPreviewAttributes) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Canonicalize a persisted preview wrapper. Returns false for an invalid destination.
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizeExternalLinkPreviewElement: (element: Element) => boolean;
|
|
9
|
+
export declare const normalizeExternalLinkPreviewsInTree: (root: Element) => void;
|
|
10
|
+
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/external-link-preview/serialization.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAc7D,eAAO,MAAM,2CAA2C,YAC7C,OAAO,KACf,6BAA6B,GAAG,IAiBlC,CAAC;AAEF,eAAO,MAAM,oCAAoC,eAAgB,6BAA6B,2BAgB7F,CAAC;AAWF,eAAO,MAAM,iCAAiC,YACnC,OAAO,cACJ,6BAA6B,SA4D1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mCAAmC,YAAa,OAAO,KAAG,OAUtE,CAAC;AAEF,eAAO,MAAM,mCAAmC,SAAU,OAAO,KAAG,IAwBnE,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EXTERNAL_LINK_PREVIEW_SELECTOR as e, EXTERNAL_LINK_PREVIEW_TARGET_SELECTOR as t, getExternalLinkPreviewHostname as n, getExternalLinkPreviewTitle as r, normalizeExternalLinkPreviewAttributes as i } from "./attributes.js";
|
|
2
|
+
//#region lib/components/Scribe/extension/external-link-preview/serialization.ts
|
|
3
|
+
var a = {
|
|
4
|
+
href: "data-href",
|
|
5
|
+
linkText: "data-link-text",
|
|
6
|
+
display: "data-display",
|
|
7
|
+
pageTitle: "data-page-title",
|
|
8
|
+
description: "data-description",
|
|
9
|
+
siteName: "data-site-name",
|
|
10
|
+
faviconUrl: "data-favicon-url",
|
|
11
|
+
imageUrl: "data-image-url",
|
|
12
|
+
fetchedAt: "data-fetched-at"
|
|
13
|
+
}, o = (e) => {
|
|
14
|
+
let n = Array.from(e.children).find((e) => e.matches(t)), r = e.getAttribute(a.href) ?? n?.getAttribute("href");
|
|
15
|
+
return i({
|
|
16
|
+
href: r,
|
|
17
|
+
linkText: e.getAttribute(a.linkText) ?? r,
|
|
18
|
+
display: e.getAttribute(a.display),
|
|
19
|
+
pageTitle: e.getAttribute(a.pageTitle),
|
|
20
|
+
description: e.getAttribute(a.description),
|
|
21
|
+
siteName: e.getAttribute(a.siteName),
|
|
22
|
+
faviconUrl: e.getAttribute(a.faviconUrl),
|
|
23
|
+
imageUrl: e.getAttribute(a.imageUrl),
|
|
24
|
+
fetchedAt: e.getAttribute(a.fetchedAt)
|
|
25
|
+
});
|
|
26
|
+
}, s = (e) => {
|
|
27
|
+
let t = { "data-type": "external-link-preview" };
|
|
28
|
+
return Object.keys(a).forEach((n) => {
|
|
29
|
+
let r = e[n];
|
|
30
|
+
r !== null && (t[a[n]] = r);
|
|
31
|
+
}), t;
|
|
32
|
+
}, c = (e, t, n) => {
|
|
33
|
+
let r = e.createElement("span");
|
|
34
|
+
return r.setAttribute(t, ""), r.textContent = n, r;
|
|
35
|
+
}, l = (e, t) => {
|
|
36
|
+
let i = e.ownerDocument, a = i.createElement("a"), o = i.createElement("span"), l = i.createElement("span");
|
|
37
|
+
if (Array.from(e.attributes).forEach((t) => e.removeAttribute(t.name)), Object.entries(s(t)).forEach(([t, n]) => {
|
|
38
|
+
e.setAttribute(t, n);
|
|
39
|
+
}), a.setAttribute("data-link-preview-target", ""), a.setAttribute("href", t.href), a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer"), t.display === "card" && t.imageUrl) {
|
|
40
|
+
let e = i.createElement("img");
|
|
41
|
+
e.setAttribute("data-link-preview-image", ""), e.setAttribute("src", t.imageUrl), e.setAttribute("alt", ""), a.append(e);
|
|
42
|
+
}
|
|
43
|
+
if (o.setAttribute("data-link-preview-main", ""), t.faviconUrl) {
|
|
44
|
+
let e = i.createElement("img");
|
|
45
|
+
e.setAttribute("data-link-preview-favicon", ""), e.setAttribute("src", t.faviconUrl), e.setAttribute("alt", ""), o.append(e);
|
|
46
|
+
} else {
|
|
47
|
+
let e = c(i, "data-link-preview-favicon-fallback", "↗");
|
|
48
|
+
e.setAttribute("aria-hidden", "true"), o.append(e);
|
|
49
|
+
}
|
|
50
|
+
l.setAttribute("data-link-preview-copy", ""), l.append(c(i, "data-link-preview-title", r(t)));
|
|
51
|
+
let u = t.siteName || n(t.href);
|
|
52
|
+
u && l.append(c(i, "data-link-preview-site", u)), t.display === "card" && t.description && l.append(c(i, "data-link-preview-description", t.description)), o.append(l), a.append(o), e.replaceChildren(a);
|
|
53
|
+
}, u = (e) => {
|
|
54
|
+
let t = o(e);
|
|
55
|
+
return t ? (l(e, t), !0) : !1;
|
|
56
|
+
}, d = (t) => {
|
|
57
|
+
[...t.matches("span[data-type=\"external-link-preview\"]") ? [t] : [], ...Array.from(t.querySelectorAll(e))].forEach((e) => {
|
|
58
|
+
let n = e.getAttribute(a.linkText) ?? e.textContent ?? "";
|
|
59
|
+
if (!u(e)) {
|
|
60
|
+
if (e === t) {
|
|
61
|
+
Array.from(e.attributes).forEach((t) => e.removeAttribute(t.name)), e.replaceChildren(e.ownerDocument.createTextNode(n));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
e.replaceWith(e.ownerDocument.createTextNode(n));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { o as getExternalLinkPreviewAttributesFromElement, s as getExternalLinkPreviewDataAttributes, u as normalizeExternalLinkPreviewElement, d as normalizeExternalLinkPreviewsInTree, l as rebuildExternalLinkPreviewElement };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
2
|
+
export declare const EXTERNAL_LINK_PREVIEW_DISPLAYS: readonly ["compact", "card"];
|
|
3
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
4
|
+
export type ExternalLinkPreviewDisplay = (typeof EXTERNAL_LINK_PREVIEW_DISPLAYS)[number];
|
|
5
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
6
|
+
export interface ExternalLinkPreviewMetadata {
|
|
7
|
+
pageTitle?: string | null;
|
|
8
|
+
description?: string | null;
|
|
9
|
+
siteName?: string | null;
|
|
10
|
+
faviconUrl?: string | null;
|
|
11
|
+
imageUrl?: string | null;
|
|
12
|
+
fetchedAt?: string | null;
|
|
13
|
+
}
|
|
14
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
15
|
+
export interface ExternalLinkPreviewAttributes {
|
|
16
|
+
href: string;
|
|
17
|
+
linkText: string;
|
|
18
|
+
display: ExternalLinkPreviewDisplay;
|
|
19
|
+
pageTitle: string | null;
|
|
20
|
+
description: string | null;
|
|
21
|
+
siteName: string | null;
|
|
22
|
+
faviconUrl: string | null;
|
|
23
|
+
imageUrl: string | null;
|
|
24
|
+
fetchedAt: string | null;
|
|
25
|
+
}
|
|
26
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
27
|
+
export interface ExternalLinkPreviewResolverContext {
|
|
28
|
+
signal: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
31
|
+
export type ExternalLinkPreviewResolver = (href: string, context: ExternalLinkPreviewResolverContext) => Promise<ExternalLinkPreviewMetadata | null>;
|
|
32
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
33
|
+
export interface ExternalLinkPreviewOptions {
|
|
34
|
+
HTMLAttributes?: Record<string, unknown>;
|
|
35
|
+
resolve?: ExternalLinkPreviewResolver;
|
|
36
|
+
shouldPreview?: (href: string) => boolean;
|
|
37
|
+
}
|
|
38
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
39
|
+
export interface InsertExternalLinkPreviewOptions extends ExternalLinkPreviewMetadata {
|
|
40
|
+
href: string;
|
|
41
|
+
linkText?: string;
|
|
42
|
+
display?: ExternalLinkPreviewDisplay;
|
|
43
|
+
}
|
|
44
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
45
|
+
export interface UpdateExternalLinkPreviewOptions extends ExternalLinkPreviewMetadata {
|
|
46
|
+
href?: string;
|
|
47
|
+
linkText?: string;
|
|
48
|
+
}
|
|
49
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
50
|
+
export type ExternalLinkDisplay = "plain" | ExternalLinkPreviewDisplay;
|
|
51
|
+
/** @experimental Part of Scribe's evolving external-link-preview contract. */
|
|
52
|
+
export type ExternalLinkPreviewResolutionStatus = "idle" | "loading" | "error";
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/external-link-preview/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,8BAA8B,YAAI,SAAS,EAAE,MAAM,CAAU,CAAC;AAE3E,8EAA8E;AAC9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzF,8EAA8E;AAC9E,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAA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
@@ -16,5 +16,5 @@ export declare const initExtensions: (props: ScribeProps) => (import("@tiptap/co
|
|
|
16
16
|
updateScrollParent: () => void;
|
|
17
17
|
}> | import("@tiptap/core").Extension<{
|
|
18
18
|
slashSuggestion: Partial<import("@tiptap/suggestion").SuggestionOptions<import("./slashCommand").SuggestionItem, import("./slashCommand").SuggestionItem>>;
|
|
19
|
-
}, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("./callout").CalloutOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
|
|
19
|
+
}, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("./callout").CalloutOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("./external-link-preview").ExternalLinkPreviewOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAwBtC,eAAO,MAAM,cAAc,UAAW,WAAW;;;;;;;;;;;;;;;;;4kCA0FhD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../extension-
|
|
1
|
+
import { t as e } from "../../../extension-dRUfQQo6.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-m0AzovsZ.js";
|
|
2
2
|
export { e as ScribeTable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../../../slashCommand-
|
|
1
|
+
import { n as e, t } from "../../../../slashCommand-CtvgnL0Z.js";
|
|
2
2
|
export { t as SlashCommand, e as slashMenuPluginKey };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e } from "../../../../dist-DDjaA1Pn.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
|
|
3
3
|
import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
|
|
4
4
|
import { SlashCommandList as r } from "./SlashCommandList.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "../../../dist-
|
|
1
|
+
import { n as e } from "../../../dist-tNcpTcFT.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) => {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import "katex/dist/katex.css";
|
|
2
2
|
import { ClassValue } from "clsx";
|
|
3
3
|
import type { ScribeSlashCommandOptions } from "./extension/slashCommand";
|
|
4
|
+
import type { ExternalLinkPreviewOptions } from "./extension/external-link-preview";
|
|
4
5
|
import type { ScribeTableOfContentsChangeHandler, ScribeTableOfContentsScrollTarget } from "./extension/tableOfContents";
|
|
5
6
|
import { Content, Editor, Extension, JSONContent, UseEditorOptions } from "@tiptap/react";
|
|
6
7
|
import { KeyboardEventHandler } from "react";
|
|
7
8
|
export type { ScribeSlashCommandOptions, SlashCommandContext, SlashCommandItemsProvider, SlashCommandItemsProviderProps, SuggestionItem, } from "./extension/slashCommand";
|
|
8
9
|
export { SuggestionItemType } from "./extension/slashCommand/items";
|
|
9
10
|
export type { ScribeTableOfContentsChangeHandler, ScribeTableOfContentsItem, ScribeTableOfContentsScrollTarget, } from "./extension/tableOfContents";
|
|
11
|
+
export type { ExternalLinkDisplay, ExternalLinkPreviewAttributes, ExternalLinkPreviewDisplay, ExternalLinkPreviewMetadata, ExternalLinkPreviewOptions, ExternalLinkPreviewResolver, ExternalLinkPreviewResolverContext, InsertExternalLinkPreviewOptions, UpdateExternalLinkPreviewOptions, } from "./extension/external-link-preview";
|
|
10
12
|
export type ScribeOnChangeContents = {
|
|
11
13
|
jsonContent: Content;
|
|
12
14
|
htmlContent: Content;
|
|
@@ -53,6 +55,18 @@ export interface ScribeProps {
|
|
|
53
55
|
* Scribe's default command list available.
|
|
54
56
|
*/
|
|
55
57
|
slashCommand?: ScribeSlashCommandOptions;
|
|
58
|
+
/**
|
|
59
|
+
* Configures enhanced previews for external links. The consumer owns metadata
|
|
60
|
+
* fetching; Scribe never requests a website directly.
|
|
61
|
+
*
|
|
62
|
+
* Scribe reads this configuration when it creates its editor. Pass stable
|
|
63
|
+
* callback references when the component can re-render.
|
|
64
|
+
*
|
|
65
|
+
* A caller-owned `externalEditor` must register the extension itself.
|
|
66
|
+
*
|
|
67
|
+
* @experimental The link-preview API and built-in UI may change while this feature is tested.
|
|
68
|
+
*/
|
|
69
|
+
externalLinkPreview?: Partial<ExternalLinkPreviewOptions>;
|
|
56
70
|
/** @experimental Enables Scribe's app-owned table-of-contents API. */
|
|
57
71
|
enableTableOfContents?: boolean;
|
|
58
72
|
/** @experimental Receives the current table-of-contents items when they change. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Scribe/index.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAK9B,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAGxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Scribe/index.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAK9B,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAGxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,KAAK,EACV,kCAAkC,EAElC,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,OAAO,EACP,MAAM,EAGN,SAAS,EACT,WAAW,EACX,gBAAgB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AAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC1D,sEAAsE;IACtE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mFAAmF;IACnF,uBAAuB,CAAC,EAAE,kCAAkC,CAAC;CAC9D;AAqbD,eAAO,MAAM,MAAM,mGAMlB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as e, t } from "../../BarMenu-
|
|
2
|
-
import {
|
|
1
|
+
import { n as e, t } from "../../BarMenu-x4sf3ECS.js";
|
|
2
|
+
import { o as n, t as r } from "../../dist-DDjaA1Pn.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-nbQ6qHyO.js";
|
|
7
|
+
import { t as c } from "../../extension-dRUfQQo6.js";
|
|
8
8
|
import { SuggestionItemType as l } from "./extension/slashCommand/items.js";
|
|
9
9
|
import "./extension/tableOfContents.js";
|
|
10
10
|
import "../../utils/index.js";
|
|
@@ -166,7 +166,7 @@ var y = "Rich text editor", b = [
|
|
|
166
166
|
S,
|
|
167
167
|
C,
|
|
168
168
|
w
|
|
169
|
-
]), p(() => (S.
|
|
169
|
+
]), p(() => (S.on("update", R), () => {
|
|
170
170
|
S.off("update", R);
|
|
171
171
|
}), [S, R]), p(() => {
|
|
172
172
|
d && S.commands.focus("end");
|