@clevertask/scribe 0.1.29 → 0.1.31

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 (94) hide show
  1. package/README.md +39 -53
  2. package/dist/BarMenu-Bm5IfWVV.js +302 -0
  3. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  4. package/dist/components/Menu/BarMenu.js +1 -2
  5. package/dist/components/Menu/BubbleMenu.js +2 -2
  6. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  7. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
  8. package/dist/components/Menu/LinkBubbleMenu.js +113 -103
  9. package/dist/components/Menu/LinkEditor.d.ts +0 -7
  10. package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
  11. package/dist/components/Menu/LinkEditor.js +148 -157
  12. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  13. package/dist/components/Menu/TableBubbleMenu.js +3 -3
  14. package/dist/components/Menu/TableHeightSettings.js +3 -11
  15. package/dist/components/Menu/TableLayoutOptions.js +1 -5
  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 +7 -7
  19. package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
  20. package/dist/components/Scribe/extension/extension-link.js +1 -2
  21. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  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 -51
  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 -2
  42. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  43. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +10 -14
  44. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  45. package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
  46. package/dist/components/Scribe/extension/table-layout.js +1 -2
  47. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  48. package/dist/components/Scribe/index.d.ts +3 -9
  49. package/dist/components/Scribe/index.d.ts.map +1 -1
  50. package/dist/components/Scribe/index.js +7 -21
  51. package/dist/{dist-DnVcys79.js → dist-BoAzo5MN.js} +491 -598
  52. package/dist/{dist-CDJRm4fL.js → dist-BqlzKS-_.js} +9 -17
  53. package/dist/{dist-B0xwy1Q5.js → dist-SM4NoN4h.js} +174 -385
  54. package/dist/document-node-capabilities.js +1 -1
  55. package/dist/{extension-BPeoqfHR.js → extension-dz0CIf3r.js} +1 -1
  56. package/dist/extension-link-DxIXGCtV.js +931 -0
  57. package/dist/{html-to-markdown-DF93it73.js → html-to-markdown-DeRG9OPm.js} +1 -1
  58. package/dist/main.css +1 -141
  59. package/dist/main.js +2 -2
  60. package/dist/{markdown-to-html-BoK5O_j-.js → markdown-to-html-tCPjQ5u6.js} +23 -70
  61. package/dist/{menus-scgppp2C.js → menus-BKxcTUsl.js} +36 -118
  62. package/dist/{purify.es-q6CUdJQi.js → purify.es-CSWcs7f1.js} +1 -23
  63. package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-B9hR1VrD.js} +1335 -1360
  64. package/dist/schema-extensions.js +1 -2
  65. package/dist/schema.js +1 -1
  66. package/dist/{table-layout-iVolql5p.js → table-layout-ClqaGg1E.js} +36 -36
  67. package/dist/{tippy.esm-MjWnmeEn.js → tippy.esm-C8V6GlaF.js} +5 -17
  68. package/dist/utils/create-scribe-editor.d.ts +1 -1
  69. package/dist/utils/create-scribe-editor.d.ts.map +1 -1
  70. package/dist/utils/create-scribe-editor.js +1 -2
  71. package/dist/utils/html-to-markdown.js +1 -2
  72. package/dist/utils/index.js +4 -4
  73. package/dist/utils/markdown-to-html.js +1 -2
  74. package/package.json +10 -10
  75. package/dist/BarMenu-BC8XoC6e.js +0 -302
  76. package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +0 -13
  77. package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +0 -1
  78. package/dist/components/Menu/ExternalLinkDisplayOptions.js +0 -90
  79. package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +0 -3
  80. package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +0 -1
  81. package/dist/components/Scribe/extension/external-link-preview/node-view.js +0 -97
  82. package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +0 -7
  83. package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +0 -1
  84. package/dist/components/Scribe/extension/external-link-preview/normalization.js +0 -21
  85. package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +0 -8
  86. package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +0 -1
  87. package/dist/components/Scribe/extension/external-link-preview/paste.js +0 -53
  88. package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +0 -7
  89. package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +0 -1
  90. package/dist/components/Scribe/extension/external-link-preview/policy.js +0 -38
  91. package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +0 -23
  92. package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +0 -1
  93. package/dist/components/Scribe/extension/external-link-preview/resolver.js +0 -118
  94. package/dist/extension-link-RvaqaDqr.js +0 -934
@@ -1,188 +1,179 @@
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.");
21
- return;
22
- }
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;
27
- }
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.");
34
- return;
35
- }
36
- j();
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
+ };
37
45
  }, [
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.");
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.");
48
58
  return;
49
59
  }
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);
60
+ let o = E.current, s = D.trim() ? D : a, c = !1;
61
+ 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));
94
+ }
95
+ return !0;
96
+ }).run(), c ? (S && e.commands.selectTextblockEnd(), P()) : M("Scribe could not save this link.");
58
97
  }, [
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, {
98
+ e,
99
+ P,
100
+ S,
101
+ D,
102
+ w
103
+ ]), I = c(() => {
104
+ let t = E.current;
105
+ e.chain().focus().command(({ tr: e, state: i }) => {
106
+ let a = i.schema.marks.link;
107
+ 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);
108
+ }).run() ? P() : M("Scribe could not remove this link.");
109
+ }, [e, P]), L = c((e) => {
110
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), P());
111
+ }, [P]);
112
+ return /* @__PURE__ */ p("form", {
113
+ onKeyDown: L,
114
+ onSubmit: F,
115
+ children: /* @__PURE__ */ m(a, {
70
116
  direction: "column",
71
117
  gap: "4",
72
118
  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, {
119
+ /* @__PURE__ */ p("label", { children: /* @__PURE__ */ m(a, {
85
120
  direction: "column",
86
121
  gap: "2",
87
- children: [/* @__PURE__ */ d(a, {
122
+ children: [/* @__PURE__ */ p(o, {
123
+ as: "span",
124
+ size: "2",
125
+ weight: "medium",
126
+ children: "Text to display"
127
+ }), /* @__PURE__ */ p(s.Root, {
128
+ value: D,
129
+ disabled: !k,
130
+ onChange: (e) => {
131
+ M(null), O(e.target.value);
132
+ }
133
+ })]
134
+ }) }),
135
+ /* @__PURE__ */ p("label", { children: /* @__PURE__ */ m(a, {
136
+ direction: "column",
137
+ gap: "2",
138
+ children: [/* @__PURE__ */ p(o, {
88
139
  as: "span",
89
140
  size: "2",
90
141
  weight: "medium",
91
142
  children: "URL"
92
- }), /* @__PURE__ */ d(o.Root, {
93
- ref: _,
94
- "aria-describedby": D ? k : void 0,
95
- "aria-invalid": !!D,
96
- autoFocus: !_,
143
+ }), /* @__PURE__ */ p(s.Root, {
144
+ ref: v,
145
+ "aria-describedby": j ? N : void 0,
146
+ "aria-invalid": !!j,
147
+ autoFocus: !v,
97
148
  placeholder: "https://example.com",
98
- value: E,
99
- onChange: (e) => M(e.target.value)
149
+ value: w,
150
+ onChange: (e) => {
151
+ M(null), b(e.target.value);
152
+ }
100
153
  })]
101
154
  }) }),
102
- D ? /* @__PURE__ */ d(a, {
103
- id: k,
155
+ j ? /* @__PURE__ */ p(o, {
156
+ id: N,
104
157
  as: "p",
105
158
  role: "alert",
106
159
  size: "2",
107
160
  color: "red",
108
- children: D
161
+ children: j
109
162
  }) : 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, {
163
+ /* @__PURE__ */ m(a, {
140
164
  justify: "between",
141
165
  gap: "3",
142
- wrap: "wrap",
143
- children: [m === "plain" ? /* @__PURE__ */ d(r, {
166
+ children: [/* @__PURE__ */ p(i, {
144
167
  type: "button",
145
168
  color: "red",
146
169
  variant: "soft",
147
- disabled: !g,
148
- onClick: P,
170
+ disabled: !_,
171
+ onClick: I,
149
172
  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
- ]
173
+ }), /* @__PURE__ */ p(i, {
174
+ type: "submit",
175
+ disabled: w.trim().length === 0,
176
+ children: "Apply"
186
177
  })]
187
178
  })
188
179
  ]
@@ -190,4 +181,4 @@ var p = ({ canRefreshPreview: p = !1, currentDisplay: m = "plain", editor: h, ex
190
181
  });
191
182
  };
192
183
  //#endregion
193
- export { p as default };
184
+ export { _ as default };
@@ -1,4 +1,4 @@
1
- import { s as e } from "../../../dist-B0xwy1Q5.js";
1
+ import { a as e } from "../../../dist-SM4NoN4h.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-iVolql5p.js";
2
- import { s as n } from "../../dist-B0xwy1Q5.js";
1
+ import { c as e, u as t } from "../../table-layout-ClqaGg1E.js";
2
+ import { a as n } from "../../dist-SM4NoN4h.js";
3
3
  import { getPopupMountTarget as r } from "../Scribe/extension/getPopupMountTarget.js";
4
- import { t as i } from "../../menus-scgppp2C.js";
4
+ import { t as i } from "../../menus-BKxcTUsl.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-iVolql5p.js";
1
+ import { c as e, n as t } from "../../table-layout-ClqaGg1E.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";
@@ -28,11 +28,7 @@ var _ = ({ editor: _, maxHeight: v, canSetMaxHeight: y, onClose: b }) => {
28
28
  };
29
29
  }, [_, b]);
30
30
  let R = (e) => {
31
- if (!L()) {
32
- N.current = !1, b();
33
- return;
34
- }
35
- y && _.commands.setTableMaxHeight(e) && (D.current = _.state.selection.getBookmark(), N.current = !0, b());
31
+ L() ? y && _.commands.setTableMaxHeight(e) && (D.current = _.state.selection.getBookmark(), N.current = !0, b()) : (N.current = !1, b());
36
32
  };
37
33
  return /* @__PURE__ */ h(o.Root, {
38
34
  open: !0,
@@ -69,11 +65,7 @@ var _ = ({ editor: _, maxHeight: v, canSetMaxHeight: y, onClose: b }) => {
69
65
  return;
70
66
  }
71
67
  let r = e(x.trim());
72
- if (r === null) {
73
- w(`Enter a whole number from 120 to ${t}.`), T.current?.focus();
74
- return;
75
- }
76
- R(r);
68
+ r === null ? (w(`Enter a whole number from 120 to ${t}.`), T.current?.focus()) : R(r);
77
69
  },
78
70
  children: [/* @__PURE__ */ g(s, {
79
71
  direction: "column",
@@ -59,11 +59,7 @@ var l = [
59
59
  e.stopPropagation(), E.current = !0;
60
60
  },
61
61
  onCloseAutoFocus: (e) => {
62
- if (D.current) {
63
- e.preventDefault(), D.current = !1;
64
- return;
65
- }
66
- E.current && !u.isDestroyed && (e.preventDefault(), u.chain().focus().run());
62
+ D.current ? (e.preventDefault(), D.current = !1) : E.current && !u.isDestroyed && (e.preventDefault(), u.chain().focus().run());
67
63
  },
68
64
  children: [
69
65
  /* @__PURE__ */ s(n.Label, { children: "Width" }),
@@ -1 +1 @@
1
- {"version":3,"file":"linkBubbleMenuPlugin.d.ts","sourceRoot":"","sources":["../../../l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ist-DnVcys79.js";
1
+ import { v as e } from "../../dist-BoAzo5MN.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, j as t, z as n } from "../../../dist-DnVcys79.js";
1
+ import { B as e, M as t, a as n } from "../../../dist-BoAzo5MN.js";
2
2
  import { TextSelection as r } from "@tiptap/pm/state";
3
3
  //#region lib/components/Scribe/extension/callout.ts
4
4
  var i = [
@@ -42,7 +42,7 @@ var i = [
42
42
  if (p?.type !== o || p.content.size) return !1;
43
43
  let m = a.after(s) + 1;
44
44
  return i.delete(a.before(), a.after()), i.setSelection(r.create(i.doc, i.mapping.map(m))), e.view.dispatch(i.scrollIntoView()), !0;
45
- }, f = e.create({
45
+ }, f = n.create({
46
46
  name: "callout",
47
47
  group: "block",
48
48
  content: "block+",
@@ -64,13 +64,13 @@ 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 t = c(e["data-variant"]);
67
+ renderHTML({ HTMLAttributes: t }) {
68
+ let n = c(t["data-variant"]);
69
69
  return [
70
70
  "aside",
71
- n(this.options.HTMLAttributes, e, {
71
+ e(this.options.HTMLAttributes, t, {
72
72
  "data-type": this.name,
73
- "data-variant": t,
73
+ "data-variant": n,
74
74
  role: "note"
75
75
  }),
76
76
  [
@@ -86,7 +86,7 @@ var i = [
86
86
  [
87
87
  "span",
88
88
  { "data-callout-label": "" },
89
- o[t]
89
+ o[n]
90
90
  ]
91
91
  ],
92
92
  [
@@ -1,6 +1,6 @@
1
- import { i as e } from "../../../../dist-B0xwy1Q5.js";
1
+ import { n as e } from "../../../../dist-SM4NoN4h.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
- import { t as n } from "../../../../tippy.esm-MjWnmeEn.js";
3
+ import { t as n } from "../../../../tippy.esm-C8V6GlaF.js";
4
4
  import { EmojiList as r } from "./EmojiList.js";
5
5
  //#region lib/components/Scribe/extension/emoji/suggest.ts
6
6
  var i = () => ({
@@ -1,2 +1 @@
1
- import { t as e } from "../../../extension-link-RvaqaDqr.js";
2
- export { e as default };
1
+ export { t as default } from "../../../extension-link-DxIXGCtV.js";
@@ -1,5 +1,5 @@
1
- import { n as e } from "../../../dist-DnVcys79.js";
2
- import { n as t, t as n } from "../../../markdown-to-html-BoK5O_j-.js";
1
+ import { n as e } from "../../../dist-BoAzo5MN.js";
2
+ import { n as t, t as n } from "../../../markdown-to-html-tCPjQ5u6.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 { n as e } from "../../../dist-DnVcys79.js";
1
+ import { n as e } from "../../../dist-BoAzo5MN.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":[],"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8B,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"}