@clevertask/scribe 0.1.28 → 0.1.30

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.
Files changed (85) hide show
  1. package/README.md +30 -47
  2. package/dist/BarMenu-Bban-B3t.js +302 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  5. package/dist/components/Menu/BarMenu.js +1 -1
  6. package/dist/components/Menu/BubbleMenu.js +2 -2
  7. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  8. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
  9. package/dist/components/Menu/LinkBubbleMenu.js +107 -119
  10. package/dist/components/Menu/LinkEditor.d.ts +0 -7
  11. package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
  12. package/dist/components/Menu/LinkEditor.js +152 -153
  13. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  14. package/dist/components/Menu/TableBubbleMenu.js +3 -3
  15. package/dist/components/Menu/TableHeightSettings.js +1 -1
  16. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
  17. package/dist/components/Menu/linkBubbleMenuPlugin.js +9 -5
  18. package/dist/components/Scribe/extension/callout.js +5 -5
  19. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  20. package/dist/components/Scribe/extension/extension-link.js +1 -1
  21. package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
  22. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  23. package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts +0 -7
  24. package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -1
  25. package/dist/components/Scribe/extension/external-link-preview/attributes.js +26 -51
  26. package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +5 -12
  27. package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -1
  28. package/dist/components/Scribe/extension/external-link-preview/commands.js +56 -121
  29. package/dist/components/Scribe/extension/external-link-preview/index.d.ts +4 -6
  30. package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
  31. package/dist/components/Scribe/extension/external-link-preview/index.js +5 -41
  32. package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +1 -0
  33. package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -1
  34. package/dist/components/Scribe/extension/external-link-preview/render-html.js +17 -60
  35. package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +2 -2
  36. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  37. package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -1
  38. package/dist/components/Scribe/extension/external-link-preview/serialization.js +29 -45
  39. package/dist/components/Scribe/extension/external-link-preview/types.d.ts +14 -17
  40. package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -1
  41. package/dist/components/Scribe/extension/index.js +1 -1
  42. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  43. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  44. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  45. package/dist/components/Scribe/extension/table-layout.js +1 -1
  46. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  47. package/dist/components/Scribe/index.d.ts +3 -9
  48. package/dist/components/Scribe/index.d.ts.map +1 -1
  49. package/dist/components/Scribe/index.js +3 -3
  50. package/dist/{dist-xjmWZ-oh.js → dist-DGEcUiqG.js} +650 -686
  51. package/dist/{dist-Dk0fXvrc.js → dist-TKt66Yz8.js} +2 -2
  52. package/dist/{dist-BiognBi4.js → dist-ZGDUiMX8.js} +189 -376
  53. package/dist/document-node-capabilities.js +1 -1
  54. package/dist/{extension-BU2USLV1.js → extension-I7Ocj_D_.js} +2 -2
  55. package/dist/extension-link-Cb1UO6hv.js +939 -0
  56. package/dist/main.css +0 -141
  57. package/dist/{menus-BDXjZsFU.js → menus-BrQTLTFL.js} +17 -17
  58. package/dist/{schema-extensions-DyCk1Goa.js → schema-extensions-CzDKrIf8.js} +1616 -1489
  59. package/dist/schema-extensions.js +1 -1
  60. package/dist/schema.js +1 -1
  61. package/dist/{table-layout-BoDS50DR.js → table-layout-Dt7KmVp_.js} +174 -123
  62. package/dist/utils/create-scribe-editor.d.ts +1 -1
  63. package/dist/utils/create-scribe-editor.d.ts.map +1 -1
  64. package/dist/utils/index.js +2 -2
  65. package/package.json +51 -51
  66. package/dist/BarMenu-BGWT4Oyk.js +0 -302
  67. package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +0 -13
  68. package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +0 -1
  69. package/dist/components/Menu/ExternalLinkDisplayOptions.js +0 -90
  70. package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +0 -3
  71. package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +0 -1
  72. package/dist/components/Scribe/extension/external-link-preview/node-view.js +0 -97
  73. package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +0 -7
  74. package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +0 -1
  75. package/dist/components/Scribe/extension/external-link-preview/normalization.js +0 -21
  76. package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +0 -8
  77. package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +0 -1
  78. package/dist/components/Scribe/extension/external-link-preview/paste.js +0 -53
  79. package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +0 -7
  80. package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +0 -1
  81. package/dist/components/Scribe/extension/external-link-preview/policy.js +0 -38
  82. package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +0 -23
  83. package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +0 -1
  84. package/dist/components/Scribe/extension/external-link-preview/resolver.js +0 -118
  85. package/dist/extension-link-DmM_EJTn.js +0 -909
@@ -1,188 +1,187 @@
1
- import e from "./ExternalLinkDisplayOptions.js";
1
+ import { getSelectionLinkContext as e } from "./linkBubbleMenuPlugin.js";
2
2
  import { normalizeLinkUrl as t } from "./linkUrl.js";
3
- import { Box as n, Button as r, Flex as i, Text as a, TextField as o } from "@radix-ui/themes";
4
- import { useCallback as s, useEffect as c, useId as l, useState as u } from "react";
5
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { TextSelection as n } from "@tiptap/pm/state";
4
+ import { closeHistory as r } from "@tiptap/pm/history";
5
+ import { Button as i, Flex as a, Text as o, TextField as s } from "@radix-ui/themes";
6
+ import { useCallback as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
7
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
8
  //#region lib/components/Menu/LinkEditor.tsx
7
- var p = ({ canRefreshPreview: p = !1, currentDisplay: m = "plain", editor: h, existingHref: g, inputRef: _, onClose: v, onRefreshPreview: y, onValueChange: b, previewStatus: x = "idle", previewStatusLabel: S, resetToken: C, selectTextblockEndAfterSave: w = !1, targetPosition: T, value: E }) => {
8
- let [D, O] = u(null), k = l(), A = t(E), j = s(() => {
9
- O(null), v();
10
- }, [v]);
11
- c(() => {
12
- O(null);
13
- }, [g, C]);
14
- let M = s((e) => {
15
- O(null), b(e);
16
- }, [b]), N = s((e) => {
17
- e.preventDefault();
18
- let n = m !== "plain" && E === g ? g : t(E);
19
- if (!n) {
20
- O("Enter a valid web address or root-relative path.");
9
+ var h = (e, t, n) => {
10
+ if (t < 0 || t > n || n > e.content.size) return !1;
11
+ let r = e.resolve(t), i = e.resolve(n), a = r.sameParent(i) && r.parent.isTextblock;
12
+ return e.nodesBetween(t, n, (e) => {
13
+ e.isInline && !e.isText && (a = !1);
14
+ }), a;
15
+ }, g = (t) => {
16
+ let { doc: n, selection: r } = t.state, i = e(t.state), a = i?.from ?? r.from, o = i?.to ?? r.to;
17
+ return i?.kind === "preview" ? {
18
+ from: a,
19
+ to: o,
20
+ text: i.attributes.linkText,
21
+ editableText: !0,
22
+ preview: !0
23
+ } : {
24
+ from: a,
25
+ to: o,
26
+ text: n.textBetween(a, o, "\n", ""),
27
+ editableText: h(n, a, o),
28
+ preview: !1
29
+ };
30
+ }, _ = ({ editor: e, existingHref: _, inputRef: v, onClose: y, onValueChange: b, resetToken: x, selectTextblockEndAfterSave: S = !1, targetPosition: C, value: w }) => {
31
+ let T = g(e), E = d(T), [D, O] = f(T.text), [k, A] = f(T.editableText), [j, M] = f(null), N = u();
32
+ l(() => {
33
+ let t = g(e);
34
+ E.current = t, O(t.text), A(t.editableText), M(null);
35
+ let n = ({ transaction: e }) => {
36
+ E.current = {
37
+ ...E.current,
38
+ from: e.mapping.map(E.current.from, 1),
39
+ to: e.mapping.map(E.current.to, E.current.from === E.current.to ? 1 : -1)
40
+ };
41
+ };
42
+ return e.on("transaction", n), () => {
43
+ e.off("transaction", n);
44
+ };
45
+ }, [
46
+ e,
47
+ _,
48
+ x,
49
+ C
50
+ ]);
51
+ let P = c(() => {
52
+ M(null), y();
53
+ }, [y]), F = c((i) => {
54
+ i.preventDefault();
55
+ let a = t(w);
56
+ if (!a) {
57
+ M("Enter a valid web address or root-relative path.");
21
58
  return;
22
59
  }
23
- if (m !== "plain") {
24
- if (!(h.can().updateExternalLinkPreview({ href: n }, T) && h.chain().focus().updateExternalLinkPreview({ href: n }, T).run())) {
25
- O("This URL can't be used as a preview. Choose Plain link to keep this destination.");
26
- return;
60
+ let o = E.current, s = D.trim() ? D : a, c = !1;
61
+ if (c = o.preview && a.startsWith("/") ? e.chain().focus().command(({ tr: e, state: t }) => {
62
+ let i = t.schema.marks.link, c = e.doc.nodeAt(o.from);
63
+ if (!i || c?.type.name !== "externalLinkPreview" || !e.doc.resolve(o.from).parent.type.allowsMarkType(i)) return !1;
64
+ r(e), e.setMeta("preventAutolink", !0);
65
+ let l = [...c.marks.filter((e) => e.type !== i), i.create({ href: a })];
66
+ return e.replaceWith(o.from, o.from + c.nodeSize, t.schema.text(s, l)), e.setSelection(n.create(e.doc, o.from + s.length)), !0;
67
+ }).run() : o.preview ? e.can().updateExternalLinkPreview({
68
+ href: a,
69
+ linkText: s
70
+ }, o.from) && e.chain().focus().command(({ tr: e }) => (r(e), !0)).updateExternalLinkPreview({
71
+ href: a,
72
+ linkText: s
73
+ }, o.from).run() : e.chain().focus().command(({ tr: e, state: t }) => {
74
+ let i = t.schema.marks.link, { from: c, to: l } = o;
75
+ if (!i || c > l || l > e.doc.content.size) return !1;
76
+ if (r(e), e.setMeta("preventAutolink", !0), c === l || D !== o.text) {
77
+ if (!h(e.doc, c, l) || !e.doc.resolve(c).parent.type.allowsMarkType(i)) return !1;
78
+ let r = c === l ? t.storedMarks ?? e.doc.resolve(c).marks() : e.doc.nodeAt(c)?.marks ?? [], o = r.find((e) => e.type === i), u = [...r.filter((e) => e.type !== i), i.create({
79
+ ...o?.attrs,
80
+ href: a
81
+ })];
82
+ e.replaceWith(c, l, t.schema.text(s, u)), e.setSelection(n.create(e.doc, c + s.length));
83
+ } else {
84
+ let t = !1;
85
+ if (e.doc.nodesBetween(c, l, (n, r, o) => {
86
+ if (!n.isText || !o?.type.allowsMarkType(i)) return;
87
+ let s = n.marks.find((e) => e.type === i);
88
+ e.addMark(Math.max(c, r), Math.min(l, r + n.nodeSize), i.create({
89
+ ...s?.attrs,
90
+ href: a
91
+ })), t = !0;
92
+ }), !t) return !1;
93
+ e.setSelection(n.create(e.doc, l));
27
94
  }
28
- j();
29
- return;
30
- }
31
- let r = h.chain().focus().extendMarkRange("link").setLink({ href: n });
32
- if (w && r.selectTextblockEnd(), !r.run()) {
33
- O("Scribe could not save this link.");
95
+ return !0;
96
+ }).run(), !c) {
97
+ M("Scribe could not save this link.");
34
98
  return;
35
99
  }
36
- j();
100
+ S && e.commands.selectTextblockEnd(), P();
37
101
  }, [
38
- m,
39
- h,
40
- g,
41
- j,
42
- w,
43
- T,
44
- E
45
- ]), P = s(() => {
46
- if (!h.chain().focus().extendMarkRange("link").unsetLink().run()) {
47
- O("Scribe could not remove this link.");
102
+ e,
103
+ P,
104
+ S,
105
+ D,
106
+ w
107
+ ]), I = c(() => {
108
+ let t = E.current;
109
+ if (!e.chain().focus().command(({ tr: e, state: i }) => {
110
+ let a = i.schema.marks.link;
111
+ return !a || t.from > t.to || t.to > e.doc.content.size ? !1 : (r(e), e.setMeta("preventAutolink", !0), t.preview ? (e.replaceWith(t.from, t.to, i.schema.text(t.text)), e.setSelection(n.create(e.doc, t.from + t.text.length))) : (e.removeMark(t.from, t.to, a), e.setSelection(n.create(e.doc, t.to))), !0);
112
+ }).run()) {
113
+ M("Scribe could not remove this link.");
48
114
  return;
49
115
  }
50
- j();
51
- }, [h, j]), F = E !== g, I = x === "loading" || F, L = s(() => {
52
- I || y?.();
53
- }, [I, y]), R = s((e) => {
54
- let n = t(E);
55
- if (!n) return O("Enter a valid external web address before changing its display."), !1;
56
- let r = !1;
57
- return r = m === "plain" ? h.chain().focus().extendMarkRange("link").setLink({ href: n }).setExternalLinkDisplay(e).run() : e === "plain" ? h.commands.convertExternalLinkPreviewToPlain(n, T) : h.can().updateExternalLinkPreview({ href: n }, T) && h.chain().focus().updateExternalLinkPreview({ href: n }, T).setExternalLinkDisplay(e, T).run(), r ? !0 : (O(e === "plain" ? "Scribe could not update this link." : "This link can't use Compact or Preview card."), !1);
58
- }, [
59
- m,
60
- h,
61
- T,
62
- E
63
- ]), z = s((e) => {
64
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), j());
65
- }, [j]);
66
- return /* @__PURE__ */ d("form", {
67
- onKeyDown: z,
68
- onSubmit: N,
69
- children: /* @__PURE__ */ f(i, {
116
+ P();
117
+ }, [e, P]), L = c((e) => {
118
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), P());
119
+ }, [P]);
120
+ return /* @__PURE__ */ p("form", {
121
+ onKeyDown: L,
122
+ onSubmit: F,
123
+ children: /* @__PURE__ */ m(a, {
70
124
  direction: "column",
71
125
  gap: "4",
72
126
  children: [
73
- /* @__PURE__ */ f(n, { children: [/* @__PURE__ */ d(a, {
74
- as: "p",
75
- size: "3",
76
- weight: "medium",
77
- children: "Link"
78
- }), /* @__PURE__ */ d(a, {
79
- as: "p",
80
- size: "2",
81
- color: "gray",
82
- children: "Add or update a link for the current selection."
83
- })] }),
84
- /* @__PURE__ */ d("label", { children: /* @__PURE__ */ f(i, {
127
+ /* @__PURE__ */ p("label", { children: /* @__PURE__ */ m(a, {
85
128
  direction: "column",
86
129
  gap: "2",
87
- children: [/* @__PURE__ */ d(a, {
130
+ children: [/* @__PURE__ */ p(o, {
131
+ as: "span",
132
+ size: "2",
133
+ weight: "medium",
134
+ children: "Text to display"
135
+ }), /* @__PURE__ */ p(s.Root, {
136
+ value: D,
137
+ disabled: !k,
138
+ onChange: (e) => {
139
+ M(null), O(e.target.value);
140
+ }
141
+ })]
142
+ }) }),
143
+ /* @__PURE__ */ p("label", { children: /* @__PURE__ */ m(a, {
144
+ direction: "column",
145
+ gap: "2",
146
+ children: [/* @__PURE__ */ p(o, {
88
147
  as: "span",
89
148
  size: "2",
90
149
  weight: "medium",
91
150
  children: "URL"
92
- }), /* @__PURE__ */ d(o.Root, {
93
- ref: _,
94
- "aria-describedby": D ? k : void 0,
95
- "aria-invalid": !!D,
96
- autoFocus: !_,
151
+ }), /* @__PURE__ */ p(s.Root, {
152
+ ref: v,
153
+ "aria-describedby": j ? N : void 0,
154
+ "aria-invalid": !!j,
155
+ autoFocus: !v,
97
156
  placeholder: "https://example.com",
98
- value: E,
99
- onChange: (e) => M(e.target.value)
157
+ value: w,
158
+ onChange: (e) => {
159
+ M(null), b(e.target.value);
160
+ }
100
161
  })]
101
162
  }) }),
102
- D ? /* @__PURE__ */ d(a, {
103
- id: k,
163
+ j ? /* @__PURE__ */ p(o, {
164
+ id: N,
104
165
  as: "p",
105
166
  role: "alert",
106
167
  size: "2",
107
168
  color: "red",
108
- children: D
169
+ children: j
109
170
  }) : null,
110
- /* @__PURE__ */ d(e, {
111
- currentDisplay: m,
112
- editor: h,
113
- executeDisplayChange: F ? R : void 0,
114
- onDisplayChange: j,
115
- targetPosition: T
116
- }),
117
- m === "plain" ? null : /* @__PURE__ */ f(i, {
118
- align: "center",
119
- justify: "between",
120
- gap: "2",
121
- wrap: "wrap",
122
- children: [/* @__PURE__ */ d(a, {
123
- as: "span",
124
- role: "status",
125
- "aria-live": "polite",
126
- size: "1",
127
- color: x === "error" ? "red" : "gray",
128
- children: x === "loading" ? "Loading preview…" : x === "error" ? "Preview unavailable" : S
129
- }), p && y ? /* @__PURE__ */ d(r, {
130
- type: "button",
131
- color: "gray",
132
- variant: "soft",
133
- "aria-disabled": I,
134
- "data-disabled": I ? "" : void 0,
135
- onClick: L,
136
- children: "Refresh preview"
137
- }) : null]
138
- }),
139
- /* @__PURE__ */ f(i, {
171
+ /* @__PURE__ */ m(a, {
140
172
  justify: "between",
141
173
  gap: "3",
142
- wrap: "wrap",
143
- children: [m === "plain" ? /* @__PURE__ */ d(r, {
174
+ children: [/* @__PURE__ */ p(i, {
144
175
  type: "button",
145
176
  color: "red",
146
177
  variant: "soft",
147
- disabled: !g,
148
- onClick: P,
178
+ disabled: !_,
179
+ onClick: I,
149
180
  children: "Remove link"
150
- }) : null, /* @__PURE__ */ f(i, {
151
- gap: "2",
152
- justify: "end",
153
- style: { marginLeft: "auto" },
154
- wrap: "wrap",
155
- children: [
156
- A ? /* @__PURE__ */ d(r, {
157
- asChild: !0,
158
- variant: "soft",
159
- color: "gray",
160
- children: /* @__PURE__ */ d("a", {
161
- href: A,
162
- target: "_blank",
163
- rel: "noopener noreferrer",
164
- children: "Open link"
165
- })
166
- }) : /* @__PURE__ */ d(r, {
167
- type: "button",
168
- variant: "soft",
169
- color: "gray",
170
- disabled: !0,
171
- children: "Open link"
172
- }),
173
- /* @__PURE__ */ d(r, {
174
- type: "button",
175
- variant: "soft",
176
- color: "gray",
177
- onClick: j,
178
- children: "Cancel"
179
- }),
180
- /* @__PURE__ */ d(r, {
181
- type: "submit",
182
- disabled: E.trim().length === 0,
183
- children: "Save"
184
- })
185
- ]
181
+ }), /* @__PURE__ */ p(i, {
182
+ type: "submit",
183
+ disabled: w.trim().length === 0,
184
+ children: "Apply"
186
185
  })]
187
186
  })
188
187
  ]
@@ -190,4 +189,4 @@ var p = ({ canRefreshPreview: p = !1, currentDisplay: m = "plain", editor: h, ex
190
189
  });
191
190
  };
192
191
  //#endregion
193
- export { p as default };
192
+ export { _ as default };
@@ -1,4 +1,4 @@
1
- import { s as e } from "../../../dist-BiognBi4.js";
1
+ import { a as e } from "../../../dist-ZGDUiMX8.js";
2
2
  import { Button as t, Flex as n } from "@radix-ui/themes";
3
3
  import { useCallback as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
- import { c as e, u as t } from "../../table-layout-BoDS50DR.js";
2
- import { s as n } from "../../dist-BiognBi4.js";
1
+ import { c as e, u as t } from "../../table-layout-Dt7KmVp_.js";
2
+ import { a as n } from "../../dist-ZGDUiMX8.js";
3
3
  import { getPopupMountTarget as r } from "../Scribe/extension/getPopupMountTarget.js";
4
- import { t as i } from "../../menus-BDXjZsFU.js";
4
+ import { t as i } from "../../menus-BrQTLTFL.js";
5
5
  import { getSelectionTableContext as a, tableBubbleMenuPluginKey as o } from "./tableBubbleMenuPlugin.js";
6
6
  import { getSelectionContextualMenuOwner as s } from "./contextualMenuOwner.js";
7
7
  import c from "./TableLayoutOptions.js";
@@ -1,4 +1,4 @@
1
- import { c as e, n as t } from "../../table-layout-BoDS50DR.js";
1
+ import { c as e, n as t } from "../../table-layout-Dt7KmVp_.js";
2
2
  import { getPopupMountTarget as n } from "../Scribe/extension/getPopupMountTarget.js";
3
3
  import { getSelectionTableContext as r } from "./tableBubbleMenuPlugin.js";
4
4
  import { NodeSelection as i } from "@tiptap/pm/state";
@@ -1 +1 @@
1
- {"version":3,"file":"linkBubbleMenuPlugin.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/linkBubbleMenuPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,iDAAiD,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAC7B;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,UAAU,EAAE,6BAA6B,CAAC;IAC1C,OAAO,EAAE,0BAA0B,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEN,eAAO,MAAM,uBAAuB,gBAAwC,CAAC;AAG7E,eAAO,MAAM,6BAA6B,UACjC,WAAW,YACR,MAAM,KACf,OAAO,CAAC,qBAAqB,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,IAqCtD,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAW,WAAW,KAAG,qBAAqB,GAAG,IAiCpF,CAAC;AAEF,eAAO,MAAM,gCAAgC,WAAY,MAAM,8BAM9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,WACrB,MAAM,gBACD,yBAAyB,SAevC,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,MAAM,SAMhD,CAAC"}
1
+ {"version":3,"file":"linkBubbleMenuPlugin.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/linkBubbleMenuPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,iDAAiD,CAAC;AAEzD,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAC7B;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,UAAU,EAAE,6BAA6B,CAAC;IAC1C,OAAO,EAAE,0BAA0B,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEN,eAAO,MAAM,uBAAuB,gBAAwC,CAAC;AAG7E,eAAO,MAAM,6BAA6B,UACjC,WAAW,YACR,MAAM,KACf,OAAO,CAAC,qBAAqB,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,IA+CtD,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAW,WAAW,KAAG,qBAAqB,GAAG,IAiCpF,CAAC;AAEF,eAAO,MAAM,gCAAgC,WAAY,MAAM,8BAM9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,WACrB,MAAM,gBACD,yBAAyB,SAevC,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,MAAM,SAMhD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { v as e } from "../../dist-xjmWZ-oh.js";
1
+ import { v as e } from "../../dist-DGEcUiqG.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
@@ -9,11 +9,15 @@ var i = new r("scribeLinkBubbleMenu"), a = /* @__PURE__ */ new WeakMap(), o = (t
9
9
  if (!i.parent.isTextblock) return null;
10
10
  let a = e(i, r);
11
11
  if (!a) return null;
12
- let o = t.doc.nodeAt(a.from)?.marks.find((e) => e.type === r), s = typeof o?.attrs.href == "string" ? o.attrs.href : "";
13
- return s ? {
12
+ let o = !1;
13
+ if (t.doc.nodesBetween(a.from, a.to, (e) => {
14
+ e.isInline && !e.isText && (o = !0);
15
+ }), o) return null;
16
+ let s = t.doc.nodeAt(a.from)?.marks.find((e) => e.type === r), c = typeof s?.attrs.href == "string" ? s.attrs.href : "";
17
+ return c ? {
14
18
  display: "plain",
15
19
  from: a.from,
16
- href: s,
20
+ href: c,
17
21
  kind: "plain",
18
22
  to: a.to
19
23
  } : null;
@@ -31,7 +35,7 @@ var i = new r("scribeLinkBubbleMenu"), a = /* @__PURE__ */ new WeakMap(), o = (t
31
35
  to: r.to
32
36
  } : null;
33
37
  }
34
- if (!r.$from.sameParent(r.$to)) return null;
38
+ if (r instanceof n || !r.$from.sameParent(r.$to)) return null;
35
39
  let i = o(e, r.from);
36
40
  return !i || r.from < i.from || r.to > i.to ? null : i;
37
41
  }, c = (e) => {
@@ -1,4 +1,4 @@
1
- import { A as e, I as t, a as n } from "../../../dist-xjmWZ-oh.js";
1
+ import { B as e, M as t, a as n } from "../../../dist-DGEcUiqG.js";
2
2
  import { TextSelection as r } from "@tiptap/pm/state";
3
3
  //#region lib/components/Scribe/extension/callout.ts
4
4
  var i = [
@@ -64,11 +64,11 @@ var i = [
64
64
  contentElement: (e) => Array.from(e.children).find((e) => e.hasAttribute("data-callout-content")) ?? e
65
65
  }];
66
66
  },
67
- renderHTML({ HTMLAttributes: e }) {
68
- let n = c(e["data-variant"]);
67
+ renderHTML({ HTMLAttributes: t }) {
68
+ let n = c(t["data-variant"]);
69
69
  return [
70
70
  "aside",
71
- t(this.options.HTMLAttributes, e, {
71
+ e(this.options.HTMLAttributes, t, {
72
72
  "data-type": this.name,
73
73
  "data-variant": n,
74
74
  role: "note"
@@ -100,7 +100,7 @@ var i = [
100
100
  return {
101
101
  insertCallout: (e = a) => ({ commands: t }) => s(e) && t.wrapIn(this.name, { variant: e }),
102
102
  setCalloutVariant: (e) => ({ commands: t }) => s(e) && t.updateAttributes(this.name, { variant: e }),
103
- toggleCallout: (t = a) => ({ commands: n, state: r }) => s(t) ? e(r, this.type) ? n.lift(this.name) : n.wrapIn(this.name, { variant: t }) : !1,
103
+ toggleCallout: (e = a) => ({ commands: n, state: r }) => s(e) ? t(r, this.type) ? n.lift(this.name) : n.wrapIn(this.name, { variant: e }) : !1,
104
104
  unsetCallout: () => ({ commands: e }) => e.lift(this.name)
105
105
  };
106
106
  },
@@ -1,4 +1,4 @@
1
- import { i as e } from "../../../../dist-BiognBi4.js";
1
+ import { n as e } from "../../../../dist-ZGDUiMX8.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
3
  import { t as n } from "../../../../tippy.esm-MjWnmeEn.js";
4
4
  import { EmojiList as r } from "./EmojiList.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../extension-link-DmM_EJTn.js";
1
+ import { t as e } from "../../../extension-link-Cb1UO6hv.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-xjmWZ-oh.js";
1
+ import { n as e } from "../../../dist-DGEcUiqG.js";
2
2
  import { n as t, t as n } from "../../../markdown-to-html-BoK5O_j-.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
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-xjmWZ-oh.js";
1
+ import { n as e } from "../../../dist-DGEcUiqG.js";
2
2
  //#region lib/components/Scribe/extension/extension-selectedText.ts
3
3
  var t = e.create({
4
4
  name: "SelectedText",
@@ -10,12 +10,5 @@ export declare const normalizeExternalLinkPreviewHref: (value: unknown) => strin
10
10
  /** Preview media may be proxied by a consumer through a strict root-relative path. */
11
11
  export declare const normalizeExternalLinkPreviewMediaUrl: (value: unknown) => string | null;
12
12
  export declare const normalizeExternalLinkPreviewMetadata: (metadata: ExternalLinkPreviewMetadata | Record<string, unknown> | null | undefined) => Required<ExternalLinkPreviewMetadata>;
13
- /** Normalize only metadata fields that a resolver deliberately returned. */
14
- export declare const normalizeExternalLinkPreviewMetadataPatch: (metadata: ExternalLinkPreviewMetadata) => Partial<Required<ExternalLinkPreviewMetadata>>;
15
13
  export declare const normalizeExternalLinkPreviewAttributes: (input: Partial<Record<keyof ExternalLinkPreviewAttributes, unknown>>) => ExternalLinkPreviewAttributes | null;
16
- export declare const getExternalLinkPreviewHostname: (href: string) => string;
17
- /** Build a concise, presentation-only label without changing the authored destination. */
18
- export declare const getExternalLinkPreviewReadableLabel: (href: string) => string;
19
- export declare const getExternalLinkPreviewTitle: (attributes: Pick<ExternalLinkPreviewAttributes, "href" | "linkText" | "pageTitle" | "siteName">, display: ExternalLinkPreviewDisplay) => string;
20
- export declare const hasExternalLinkPreviewMetadata: (attributes: Pick<ExternalLinkPreviewAttributes, "pageTitle" | "description" | "siteName" | "faviconUrl" | "imageUrl">) => boolean;
21
14
  //# sourceMappingURL=attributes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/external-link-preview/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EACjC,MAAM,SAAS,CAAC;AA8CjB,8EAA8E;AAC9E,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AACrE,eAAO,MAAM,8BAA8B,8CAA4C,CAAC;AACxF,eAAO,MAAM,qCAAqC,gCAAgC,CAAC;AAEnF,eAAO,MAAM,4BAA4B,UAAW,OAAO,KAAG,KAAK,IAAI,0BAC2B,CAAC;AAwBnG,eAAO,MAAM,oCAAoC,UAAW,OAAO,KAAG,MAAM,GAAG,IACE,CAAC;AAElF,oGAAoG;AACpG,eAAO,MAAM,gCAAgC,UAAW,OAAO,KAAG,MAAM,GAAG,IAuB1E,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,oCAAoC,UAAW,OAAO,KAAG,MAAM,GAAG,IAwB9E,CAAC;AAcF,eAAO,MAAM,oCAAoC,aACrC,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,KACjF,QAAQ,CAAC,2BAA2B,CAOrC,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,yCAAyC,aAC1C,2BAA2B,KACpC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAW/C,CAAC;AAEF,eAAO,MAAM,sCAAsC,UAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,6BAA6B,EAAE,OAAO,CAAC,CAAC,KACnE,6BAA6B,GAAG,IAgBlC,CAAC;AAEF,eAAO,MAAM,8BAA8B,SAAU,MAAM,WAM1D,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,mCAAmC,SAAU,MAAM,WAS/D,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAC1B,IAAI,CAAC,6BAA6B,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC,WACtF,0BAA0B,WAWpC,CAAC;AAEF,eAAO,MAAM,8BAA8B,eAC7B,IAAI,CACd,6BAA6B,EAC7B,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CACrE,YAQA,CAAC"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/external-link-preview/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EACjC,MAAM,SAAS,CAAC;AAsCjB,8EAA8E;AAC9E,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AACrE,eAAO,MAAM,8BAA8B,8CAA4C,CAAC;AACxF,eAAO,MAAM,qCAAqC,gCAAgC,CAAC;AAEnF,eAAO,MAAM,4BAA4B,UAAW,OAAO,KAAG,KAAK,IAAI,0BAC2B,CAAC;AAwBnG,eAAO,MAAM,oCAAoC,UAAW,OAAO,KAAG,MAAM,GAAG,IACE,CAAC;AAElF,oGAAoG;AACpG,eAAO,MAAM,gCAAgC,UAAW,OAAO,KAAG,MAAM,GAAG,IAuB1E,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,oCAAoC,UAAW,OAAO,KAAG,MAAM,GAAG,IAwB9E,CAAC;AAcF,eAAO,MAAM,oCAAoC,aACrC,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,KACjF,QAAQ,CAAC,2BAA2B,CAOrC,CAAC;AAEH,eAAO,MAAM,sCAAsC,UAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,6BAA6B,EAAE,OAAO,CAAC,CAAC,KACnE,6BAA6B,GAAG,IAgBlC,CAAC"}
@@ -1,89 +1,64 @@
1
1
  import { EXTERNAL_LINK_PREVIEW_DISPLAYS as e } from "./types.js";
2
2
  //#region lib/components/Scribe/extension/external-link-preview/attributes.ts
3
- var t = /^\/(?![\\/])/, n = /^https?:\/\//i, r = 16384, i = 16384, a = 512, o = 2048, s = 256, c = 16384, l = 128, u = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/, d = [
4
- "pageTitle",
5
- "description",
6
- "siteName",
7
- "faviconUrl",
8
- "imageUrl",
9
- "fetchedAt"
10
- ], f = (e) => {
3
+ var t = /^\/(?![\\/])/, n = /^https?:\/\//i, r = 16384, i = 16384, a = 512, o = 2048, s = 256, c = 16384, l = 128, u = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/, d = (e) => {
11
4
  for (let t of e) {
12
5
  let e = t.charCodeAt(0);
13
6
  if (e <= 31 || e === 127) return !0;
14
7
  }
15
8
  return !1;
16
- }, p = (e) => {
9
+ }, f = (e) => {
17
10
  let t = e.indexOf("//") + 2, n = [
18
11
  "/",
19
12
  "?",
20
13
  "#"
21
14
  ].map((n) => e.indexOf(n, t)).filter((e) => e >= 0), r = n.length ? Math.min(...n) : e.length;
22
15
  return e.slice(t, r).includes("@");
23
- }, m = "externalLinkPreview", h = "span[data-type=\"external-link-preview\"]", g = "a[data-link-preview-target]", _ = (t) => typeof t == "string" && e.some((e) => e === t), v = (e, t, { preserveWhitespace: n = !1 } = {}) => {
16
+ }, p = "externalLinkPreview", m = "span[data-type=\"external-link-preview\"]", h = "a[data-link-preview-target]", g = (t) => typeof t == "string" && e.some((e) => e === t), _ = (e, t, { preserveWhitespace: n = !1 } = {}) => {
24
17
  if (typeof e != "string") return null;
25
18
  let r = n ? e : e.trim();
26
- return !r.trim() || r.length > t || f(r) ? null : r;
27
- }, y = (e) => v(e, i, { preserveWhitespace: !0 }), b = (e) => {
28
- let t = v(e, r);
29
- if (!t || t.includes("\\") || !n.test(t) || p(t)) return null;
19
+ return !r.trim() || r.length > t || d(r) ? null : r;
20
+ }, v = (e) => _(e, i, { preserveWhitespace: !0 }), y = (e) => {
21
+ let t = _(e, r);
22
+ if (!t || t.includes("\\") || !n.test(t) || f(t)) return null;
30
23
  try {
31
24
  let e = new URL(t);
32
25
  return e.protocol !== "http:" && e.protocol !== "https:" || e.username || e.password ? null : t;
33
26
  } catch {
34
27
  return null;
35
28
  }
36
- }, x = (e) => {
37
- let r = v(e, c);
29
+ }, b = (e) => {
30
+ let r = _(e, c);
38
31
  if (!r || r.includes("\\")) return null;
39
32
  if (t.test(r)) return r;
40
- if (!n.test(r) || p(r)) return null;
33
+ if (!n.test(r) || f(r)) return null;
41
34
  try {
42
35
  let e = new URL(r);
43
36
  return (e.protocol === "http:" || e.protocol === "https:") && !e.username && !e.password ? r : null;
44
37
  } catch {
45
38
  return null;
46
39
  }
47
- }, S = (e) => {
48
- let t = v(e, l);
40
+ }, x = (e) => {
41
+ let t = _(e, l);
49
42
  if (!t || !u.test(t)) return null;
50
43
  let n = new Date(t);
51
44
  return Number.isNaN(n.getTime()) ? null : n.toISOString();
52
- }, C = (e) => ({
53
- pageTitle: v(e?.pageTitle, a),
54
- description: v(e?.description, o),
55
- siteName: v(e?.siteName, s),
56
- faviconUrl: x(e?.faviconUrl),
57
- imageUrl: x(e?.imageUrl),
58
- fetchedAt: S(e?.fetchedAt)
59
- }), w = (e) => {
60
- let t = C(e), n = {};
61
- return d.forEach((r) => {
62
- Object.prototype.hasOwnProperty.call(e, r) && e[r] !== void 0 && (n[r] = t[r]);
63
- }), n;
64
- }, T = (e) => {
65
- let t = b(e.href);
45
+ }, S = (e) => ({
46
+ pageTitle: _(e?.pageTitle, a),
47
+ description: _(e?.description, o),
48
+ siteName: _(e?.siteName, s),
49
+ faviconUrl: b(e?.faviconUrl),
50
+ imageUrl: b(e?.imageUrl),
51
+ fetchedAt: x(e?.fetchedAt)
52
+ }), C = (e) => {
53
+ let t = y(e.href);
66
54
  if (!t) return null;
67
- let n = C(e);
55
+ let n = S(e);
68
56
  return {
69
57
  href: t,
70
- linkText: y(e.linkText) ?? t,
71
- display: _(e.display) ? e.display : "compact",
58
+ linkText: v(e.linkText) ?? t,
59
+ display: g(e.display) ? e.display : "compact",
72
60
  ...n
73
61
  };
74
- }, E = (e) => {
75
- try {
76
- return new URL(e).hostname;
77
- } catch {
78
- return e;
79
- }
80
- }, D = (e) => {
81
- try {
82
- let t = new URL(e), n = t.pathname === "/" ? "" : t.pathname;
83
- return `${t.host}${n}`;
84
- } catch {
85
- return e;
86
- }
87
- }, O = (e, t) => t === "compact" ? e.linkText === e.href ? D(e.href) : e.linkText : e.pageTitle || e.siteName || E(e.href), k = (e) => !!(e.pageTitle || e.description || e.siteName || e.faviconUrl || e.imageUrl);
62
+ };
88
63
  //#endregion
89
- export { m as EXTERNAL_LINK_PREVIEW_NODE_NAME, h as EXTERNAL_LINK_PREVIEW_SELECTOR, g as EXTERNAL_LINK_PREVIEW_TARGET_SELECTOR, E as getExternalLinkPreviewHostname, D as getExternalLinkPreviewReadableLabel, O as getExternalLinkPreviewTitle, k as hasExternalLinkPreviewMetadata, _ as isExternalLinkPreviewDisplay, T as normalizeExternalLinkPreviewAttributes, b as normalizeExternalLinkPreviewHref, y as normalizeExternalLinkPreviewLinkText, x as normalizeExternalLinkPreviewMediaUrl, C as normalizeExternalLinkPreviewMetadata, w as normalizeExternalLinkPreviewMetadataPatch };
64
+ export { p as EXTERNAL_LINK_PREVIEW_NODE_NAME, m as EXTERNAL_LINK_PREVIEW_SELECTOR, h as EXTERNAL_LINK_PREVIEW_TARGET_SELECTOR, g as isExternalLinkPreviewDisplay, C as normalizeExternalLinkPreviewAttributes, y as normalizeExternalLinkPreviewHref, v as normalizeExternalLinkPreviewLinkText, b as normalizeExternalLinkPreviewMediaUrl, S as normalizeExternalLinkPreviewMetadata };