@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.
- package/README.md +39 -53
- package/dist/BarMenu-Bm5IfWVV.js +302 -0
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -2
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +113 -103
- package/dist/components/Menu/LinkEditor.d.ts +0 -7
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +148 -157
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +3 -11
- package/dist/components/Menu/TableLayoutOptions.js +1 -5
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +9 -5
- package/dist/components/Scribe/extension/callout.js +7 -7
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -2
- 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 +0 -7
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +26 -51
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +5 -12
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +56 -121
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +4 -6
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +5 -41
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +17 -60
- package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +2 -2
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +29 -51
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +14 -17
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -2
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +10 -14
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/table-layout.js +1 -2
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +3 -9
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +7 -21
- package/dist/{dist-DnVcys79.js → dist-BoAzo5MN.js} +491 -598
- package/dist/{dist-CDJRm4fL.js → dist-BqlzKS-_.js} +9 -17
- package/dist/{dist-B0xwy1Q5.js → dist-SM4NoN4h.js} +174 -385
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BPeoqfHR.js → extension-dz0CIf3r.js} +1 -1
- package/dist/extension-link-DxIXGCtV.js +931 -0
- package/dist/{html-to-markdown-DF93it73.js → html-to-markdown-DeRG9OPm.js} +1 -1
- package/dist/main.css +1 -141
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-BoK5O_j-.js → markdown-to-html-tCPjQ5u6.js} +23 -70
- package/dist/{menus-scgppp2C.js → menus-BKxcTUsl.js} +36 -118
- package/dist/{purify.es-q6CUdJQi.js → purify.es-CSWcs7f1.js} +1 -23
- package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-B9hR1VrD.js} +1335 -1360
- package/dist/schema-extensions.js +1 -2
- package/dist/schema.js +1 -1
- package/dist/{table-layout-iVolql5p.js → table-layout-ClqaGg1E.js} +36 -36
- package/dist/{tippy.esm-MjWnmeEn.js → tippy.esm-C8V6GlaF.js} +5 -17
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.js +1 -2
- package/dist/utils/html-to-markdown.js +1 -2
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -2
- package/package.json +10 -10
- package/dist/BarMenu-BC8XoC6e.js +0 -302
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +0 -13
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +0 -1
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +0 -90
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +0 -3
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +0 -97
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +0 -21
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +0 -8
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/paste.js +0 -53
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/policy.js +0 -38
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +0 -23
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +0 -118
- package/dist/extension-link-RvaqaDqr.js +0 -934
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ A versatile, block-based rich text editor for diverse applications, built with T
|
|
|
11
11
|
- **Markdown Support:** Parse and render Markdown content effortlessly.
|
|
12
12
|
- **Markdown Paste:** Paste plain-text markdown into the editor and have it converted into rich content automatically.
|
|
13
13
|
- **Table Authoring:** Insert, resize, and edit tables with controls that stay next to the active table.
|
|
14
|
-
- **
|
|
14
|
+
- **Ordinary Links:** Edit display text and URL with an accessible popover and native Tiptap paste behavior.
|
|
15
15
|
- **Versatile Integration:** Easily integrate `@clevertask/scribe` into any project requiring rich text editing.
|
|
16
16
|
- **View and Edit:** Seamlessly switch between viewing and editing modes.
|
|
17
17
|
- **Experimental Table of Contents:** Subscribe to heading changes and render an app-owned table of contents outside the editor.
|
|
@@ -23,7 +23,7 @@ A versatile, block-based rich text editor for diverse applications, built with T
|
|
|
23
23
|
- [Headless schema](#headless-schema)
|
|
24
24
|
- [Usage](#usage)
|
|
25
25
|
- [Table Authoring](#table-authoring)
|
|
26
|
-
- [
|
|
26
|
+
- [Links](#links)
|
|
27
27
|
- [Experimental Table of Contents](#experimental-table-of-contents)
|
|
28
28
|
- [Math Expressions](#math-expressions)
|
|
29
29
|
- [Props](#props)
|
|
@@ -240,56 +240,42 @@ calls to `insertContent`, Markdown table paste, and rich-HTML table paste remain
|
|
|
240
240
|
points. Applications that require a hard no-nested-table guarantee must validate or filter those
|
|
241
241
|
paths too.
|
|
242
242
|
|
|
243
|
-
##
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
autoPreviewOnPaste: false,
|
|
280
|
-
}}
|
|
281
|
-
/>
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
By default, pasting a standalone external URL creates an ordinary link. Select it and choose Compact to shorten only its presentation, with no metadata request. A meaningful authored label is kept; a raw URL is shown as `hostname/path` without its query or fragment. Switching back to Plain restores the original label and exact destination. Set `autoPreviewOnPaste: true` only if standalone URL pastes should become local Compact links automatically. Pasting a URL over selected text always keeps an ordinary labeled link.
|
|
287
|
-
|
|
288
|
-
While editing, select a Plain, Compact, or Card link to open its contextual menu. From there you can edit or open the destination, or switch presentation. A Preview card is available only when the link has its own line and metadata is already stored or a resolver is configured. Refresh is available only for Preview cards with a resolver. Keyboard users can press `Alt + F10` from a selected link to open the same menu and press Escape to return to the document.
|
|
289
|
-
|
|
290
|
-
The resolver runs only when a Preview card needs metadata: after explicit Card conversion, programmatic Card insertion, a Card destination edit, or Card refresh. Compact creation, editing, automatic paste, and document reopen make no metadata request. The resolver receives an `AbortSignal`, and can return `pageTitle`, `description`, `siteName`, `faviconUrl`, `imageUrl`, and `fetchedAt`. Use `shouldPreview` to keep app-owned or otherwise unsupported destinations on the ordinary-link path.
|
|
291
|
-
|
|
292
|
-
Preview nodes use sanitized raw HTML when content is serialized as Markdown, so their metadata and presentation survive Scribe's current Markdown round trip. A caller-owned `externalEditor` must register `ExternalLinkPreview` itself.
|
|
243
|
+
## Links
|
|
244
|
+
|
|
245
|
+
Scribe uses Tiptap's Link extension for ordinary links and URL paste. Clicking an existing link
|
|
246
|
+
opens its popover with focus on the dialog, keeping the software keyboard closed. Tap
|
|
247
|
+
either field to start typing, then choose **Apply** or **Remove link**. The popover follows
|
|
248
|
+
the visible viewport when the keyboard opens, scrolling its form when space is limited.
|
|
249
|
+
The toolbar Link action still focuses the URL immediately.
|
|
250
|
+
An unchanged label preserves the link's inline formatting. Keyboard users can press `Alt + F10`
|
|
251
|
+
from a link to open the form and Escape to return to the document.
|
|
252
|
+
|
|
253
|
+
Pasting recognizable URL-only content over selected text applies a link using native Tiptap
|
|
254
|
+
behavior; ordinary text replaces the selection. Rich clipboard content follows Tiptap's parsed
|
|
255
|
+
content handling. Scribe does not fetch metadata or create Compact/Preview card presentations.
|
|
256
|
+
Automatic links and URL paste use Tiptap's native URL/protocol recognition and safety checks,
|
|
257
|
+
including email and FTP links. The manual URL form accepts HTTP(S), bare domains and
|
|
258
|
+
root-relative links. Application-owned task and document reference extensions remain separate:
|
|
259
|
+
URL paste links eligible text around selected inline atoms without marking the atoms themselves,
|
|
260
|
+
while an atom-only selection follows normal paste replacement.
|
|
261
|
+
|
|
262
|
+
### Legacy preview compatibility
|
|
263
|
+
|
|
264
|
+
Saved `externalLinkPreview` nodes still load in the interactive and headless schemas and render
|
|
265
|
+
as ordinary links using their authored `linkText` and exact `href`. Their node identity, display
|
|
266
|
+
value and metadata remain serialized in HTML, JSON and Markdown. Reading a document does not
|
|
267
|
+
convert these nodes or discard metadata. No stored favicon or preview image is requested.
|
|
268
|
+
|
|
269
|
+
The exported `ExternalLinkPreview` extension, constants, types and `externalLinkPreview` options
|
|
270
|
+
remain for compatibility. `autoPreviewOnPaste`, `resolve` and `shouldPreview` are deprecated and
|
|
271
|
+
ignored; `HTMLAttributes` still applies to the legacy wrapper. A caller-owned `externalEditor`
|
|
272
|
+
must register the compatibility extension to read existing preview nodes.
|
|
273
|
+
|
|
274
|
+
The deprecated `insertExternalLinkPreview` and `updateExternalLinkPreview` commands retain the
|
|
275
|
+
legacy node shape and attributes, displayed as ordinary links, without fetching metadata.
|
|
276
|
+
`setExternalLinkDisplay("compact" | "card")` and `refreshExternalLinkPreview` return `false`.
|
|
277
|
+
`setExternalLinkDisplay("plain")` and `convertExternalLinkPreviewToPlain` remain explicit,
|
|
278
|
+
undoable conversions to ordinary Link-marked text. There is no automatic content migration.
|
|
293
279
|
|
|
294
280
|
## Experimental Table of Contents
|
|
295
281
|
|
|
@@ -386,7 +372,7 @@ The `createScribeEditor` helper accepts the same `enableUndoRedo` option.
|
|
|
386
372
|
| `extensions` | `Extension[]` | `undefined` | You can set your own extensions for the text editor. For more information, [check the tip tap extensions docs](https://tiptap.dev/docs/editor/core-concepts/extensions) |
|
|
387
373
|
| `externalEditor` | `Editor` | `undefined` | Uses a caller-owned Tiptap editor. The caller remains responsible for its extension and plugin lifecycle, including table resizing, and for destroying it. |
|
|
388
374
|
| `enableUndoRedo` | `boolean` | `true` | Enables Scribe's built-in undo and redo history. Set it to `false` when another extension owns history. This creation-time option does not configure a caller-owned `externalEditor`. |
|
|
389
|
-
| `externalLinkPreview` | `Partial<ExternalLinkPreviewOptions>` | `undefined` |
|
|
375
|
+
| `externalLinkPreview` | `Partial<ExternalLinkPreviewOptions>` | `undefined` | Deprecated compatibility options. Only HTMLAttributes affects legacy wrappers; metadata resolution, preview policy and automatic previews are ignored. |
|
|
390
376
|
| `editorProps` | `EditorProps` | `undefined` | A tiptap-based prop to handle advanced use cases, you can read about it on their [documentation](https://tiptap.dev/docs/editor/api/editor#editorprops) |
|
|
391
377
|
| `showBarMenu` | `boolean` | `true` | Determines whether to show the text editor top menu bar or not. This menu bar shows options to format the text |
|
|
392
378
|
| `placeholderText` | `string` | `Type "/" for commands...` | Change the initial placeholder for your text editor |
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { a as e } from "./dist-SM4NoN4h.js";
|
|
2
|
+
import { getPopupMountTarget as t } from "./components/Scribe/extension/getPopupMountTarget.js";
|
|
3
|
+
import { getSelectionLinkContext as n, hideLinkBubbleMenu as r } from "./components/Menu/linkBubbleMenuPlugin.js";
|
|
4
|
+
import i from "./components/Menu/LinkEditor.js";
|
|
5
|
+
import { BlockQuoteIcon as a, BoldIcon as o, CodeBlockIcon as s, HighlightIcon as c, HorizontalLineIcon as l, ImageIcon as u, InlineCodeIcon as d, ItalicIcon as f, LinkIcon as p, OrderedListIcon as m, StrikeIcon as h, UnorderedListIcon as g } from "./icons/ToolbarIcons.js";
|
|
6
|
+
import { Box as _, Button as v, Flex as y, IconButton as b, Popover as x, Separator as S, Text as C, TextField as w } from "@radix-ui/themes";
|
|
7
|
+
import { Fragment as T, useCallback as E, useState as D } from "react";
|
|
8
|
+
import { jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
9
|
+
//#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
10
|
+
function A(e) {
|
|
11
|
+
var t, n, r = "";
|
|
12
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
13
|
+
else if (typeof e == "object") {
|
|
14
|
+
if (Array.isArray(e)) {
|
|
15
|
+
var i = e.length;
|
|
16
|
+
for (t = 0; t < i; t++) e[t] && (n = A(e[t])) && (r && (r += " "), r += n);
|
|
17
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
}
|
|
21
|
+
function j() {
|
|
22
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = A(e)) && (r && (r += " "), r += t);
|
|
23
|
+
return r;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region lib/components/Menu/BarMenu.tsx
|
|
27
|
+
var M = ({ editor: A }) => {
|
|
28
|
+
let [M, N] = D(!1), [P, F] = D(!1), [I, L] = D(""), [R, z] = D(""), B = t(A), V = e({
|
|
29
|
+
editor: A,
|
|
30
|
+
selector: ({ editor: e }) => e ? {
|
|
31
|
+
isBold: e.isActive("bold"),
|
|
32
|
+
isItalic: e.isActive("italic"),
|
|
33
|
+
isStrike: e.isActive("strike"),
|
|
34
|
+
isCode: e.isActive("code"),
|
|
35
|
+
isHighlight: e.isActive("highlight"),
|
|
36
|
+
isBulletList: e.isActive("bulletList"),
|
|
37
|
+
isOrderedList: e.isActive("orderedList"),
|
|
38
|
+
isLink: e.isActive("link"),
|
|
39
|
+
isImage: e.isActive("image"),
|
|
40
|
+
isCodeBlock: e.isActive("codeBlock"),
|
|
41
|
+
isBlockquote: e.isActive("blockquote")
|
|
42
|
+
} : null
|
|
43
|
+
}), H = E((e) => {
|
|
44
|
+
if (e) {
|
|
45
|
+
r(A);
|
|
46
|
+
let e = n(A.state)?.href ?? "";
|
|
47
|
+
L(e), F(!1);
|
|
48
|
+
}
|
|
49
|
+
N(e);
|
|
50
|
+
}, [A]), U = E((e) => {
|
|
51
|
+
if (e) {
|
|
52
|
+
r(A);
|
|
53
|
+
let e = A.getAttributes("image").src ?? "";
|
|
54
|
+
z(e), N(!1);
|
|
55
|
+
}
|
|
56
|
+
F(e);
|
|
57
|
+
}, [A]), W = E(() => {
|
|
58
|
+
let e = R.trim();
|
|
59
|
+
e && (A.chain().focus().setImage({ src: e }).run(), F(!1));
|
|
60
|
+
}, [A, R]), G = E((e) => {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
}, []), K = E(({ target: { value: e } }) => {
|
|
63
|
+
z(e);
|
|
64
|
+
}, []), q = [
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
name: "bold",
|
|
68
|
+
icon: o,
|
|
69
|
+
command: () => A.chain().focus().toggleBold().run(),
|
|
70
|
+
isActive: () => !!V?.isBold,
|
|
71
|
+
isToggle: !0,
|
|
72
|
+
label: "Bold"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "italic",
|
|
76
|
+
icon: f,
|
|
77
|
+
command: () => A.chain().focus().toggleItalic().run(),
|
|
78
|
+
isActive: () => !!V?.isItalic,
|
|
79
|
+
isToggle: !0,
|
|
80
|
+
label: "Italic"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "strike",
|
|
84
|
+
icon: h,
|
|
85
|
+
command: () => A.chain().focus().toggleStrike().run(),
|
|
86
|
+
isActive: () => !!V?.isStrike,
|
|
87
|
+
isToggle: !0,
|
|
88
|
+
label: "Strikethrough"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
[{
|
|
92
|
+
name: "inline-code",
|
|
93
|
+
icon: d,
|
|
94
|
+
command: () => A.chain().focus().toggleCode().run(),
|
|
95
|
+
isActive: () => !!V?.isCode,
|
|
96
|
+
isToggle: !0,
|
|
97
|
+
label: "Inline code"
|
|
98
|
+
}, {
|
|
99
|
+
name: "highlight",
|
|
100
|
+
icon: c,
|
|
101
|
+
command: () => A.chain().focus().toggleHighlight().run(),
|
|
102
|
+
isActive: () => !!V?.isHighlight,
|
|
103
|
+
isToggle: !0,
|
|
104
|
+
label: "Highlight"
|
|
105
|
+
}],
|
|
106
|
+
[{
|
|
107
|
+
name: "unordered-list",
|
|
108
|
+
icon: g,
|
|
109
|
+
command: () => A.chain().focus().toggleBulletList().run(),
|
|
110
|
+
isActive: () => !!V?.isBulletList,
|
|
111
|
+
isToggle: !0,
|
|
112
|
+
label: "Bulleted list"
|
|
113
|
+
}, {
|
|
114
|
+
name: "ordered-list",
|
|
115
|
+
icon: m,
|
|
116
|
+
command: () => A.chain().focus().toggleOrderedList().run(),
|
|
117
|
+
isActive: () => !!V?.isOrderedList,
|
|
118
|
+
isToggle: !0,
|
|
119
|
+
label: "Numbered list"
|
|
120
|
+
}],
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
name: "link",
|
|
124
|
+
icon: p,
|
|
125
|
+
isActive: () => !!V?.isLink,
|
|
126
|
+
label: "Link",
|
|
127
|
+
popover: "link"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "image",
|
|
131
|
+
icon: u,
|
|
132
|
+
isActive: () => !!V?.isImage,
|
|
133
|
+
disabled: !1,
|
|
134
|
+
label: "Insert image",
|
|
135
|
+
popover: "image"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "code-block",
|
|
139
|
+
icon: s,
|
|
140
|
+
command: () => A.chain().focus().toggleCodeBlock().run(),
|
|
141
|
+
isActive: () => !!V?.isCodeBlock,
|
|
142
|
+
isToggle: !0,
|
|
143
|
+
label: "Code block"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "block-quote",
|
|
147
|
+
icon: a,
|
|
148
|
+
command: () => A.chain().focus().toggleBlockquote().run(),
|
|
149
|
+
isActive: () => !!V?.isBlockquote,
|
|
150
|
+
isToggle: !0,
|
|
151
|
+
label: "Block quote"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "horizontal-line",
|
|
155
|
+
icon: l,
|
|
156
|
+
command: () => A.chain().focus().setHorizontalRule().run(),
|
|
157
|
+
isActive: () => !1,
|
|
158
|
+
label: "Horizontal rule"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
];
|
|
162
|
+
return /* @__PURE__ */ O(_, {
|
|
163
|
+
className: "scribe-toolbar",
|
|
164
|
+
role: "toolbar",
|
|
165
|
+
"aria-label": "Text formatting",
|
|
166
|
+
children: /* @__PURE__ */ O(y, {
|
|
167
|
+
align: "center",
|
|
168
|
+
gap: "3",
|
|
169
|
+
wrap: "wrap",
|
|
170
|
+
children: q.map((e, t) => /* @__PURE__ */ k(T, { children: [/* @__PURE__ */ O(y, {
|
|
171
|
+
align: "center",
|
|
172
|
+
gap: "2",
|
|
173
|
+
wrap: "wrap",
|
|
174
|
+
children: e.map((e, t) => e.popover === "link" ? /* @__PURE__ */ k(x.Root, {
|
|
175
|
+
open: M,
|
|
176
|
+
onOpenChange: H,
|
|
177
|
+
children: [/* @__PURE__ */ O(x.Trigger, { children: /* @__PURE__ */ O(b, {
|
|
178
|
+
type: "button",
|
|
179
|
+
"aria-label": e.label,
|
|
180
|
+
radius: "medium",
|
|
181
|
+
color: "gray",
|
|
182
|
+
variant: e.isActive() ? "soft" : "ghost",
|
|
183
|
+
disabled: e.disabled || !A.isEditable,
|
|
184
|
+
title: e.label,
|
|
185
|
+
onMouseDown: G,
|
|
186
|
+
className: j(e.disabled && "scribe-toolbar-button--disabled"),
|
|
187
|
+
children: /* @__PURE__ */ O(e.icon, { className: "scribe-toolbar-icon" })
|
|
188
|
+
}) }), /* @__PURE__ */ O(x.Content, {
|
|
189
|
+
"aria-label": "Link settings",
|
|
190
|
+
container: B,
|
|
191
|
+
size: "2",
|
|
192
|
+
side: "bottom",
|
|
193
|
+
align: "start",
|
|
194
|
+
style: {
|
|
195
|
+
maxWidth: "calc(100vw - 32px)",
|
|
196
|
+
width: 320
|
|
197
|
+
},
|
|
198
|
+
children: /* @__PURE__ */ O(i, {
|
|
199
|
+
editor: A,
|
|
200
|
+
existingHref: n(A.state)?.href ?? "",
|
|
201
|
+
onClose: () => N(!1),
|
|
202
|
+
onValueChange: L,
|
|
203
|
+
selectTextblockEndAfterSave: !0,
|
|
204
|
+
value: I
|
|
205
|
+
})
|
|
206
|
+
})]
|
|
207
|
+
}, `${e.name}-${t}`) : e.popover === "image" ? /* @__PURE__ */ k(x.Root, {
|
|
208
|
+
open: P,
|
|
209
|
+
onOpenChange: U,
|
|
210
|
+
children: [/* @__PURE__ */ O(x.Trigger, { children: /* @__PURE__ */ O(b, {
|
|
211
|
+
type: "button",
|
|
212
|
+
"aria-label": e.label,
|
|
213
|
+
radius: "medium",
|
|
214
|
+
color: "gray",
|
|
215
|
+
variant: e.isActive() ? "soft" : "ghost",
|
|
216
|
+
disabled: e.disabled || !A.isEditable,
|
|
217
|
+
title: e.label,
|
|
218
|
+
onMouseDown: G,
|
|
219
|
+
className: j(e.disabled && "scribe-toolbar-button--disabled"),
|
|
220
|
+
children: /* @__PURE__ */ O(e.icon, { className: "scribe-toolbar-icon" })
|
|
221
|
+
}) }), /* @__PURE__ */ O(x.Content, {
|
|
222
|
+
"aria-label": "Insert image",
|
|
223
|
+
container: B,
|
|
224
|
+
size: "2",
|
|
225
|
+
side: "bottom",
|
|
226
|
+
align: "start",
|
|
227
|
+
style: {
|
|
228
|
+
maxWidth: "calc(100vw - 32px)",
|
|
229
|
+
width: 320
|
|
230
|
+
},
|
|
231
|
+
children: /* @__PURE__ */ k(y, {
|
|
232
|
+
direction: "column",
|
|
233
|
+
gap: "4",
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ k(_, { children: [/* @__PURE__ */ O(C, {
|
|
236
|
+
as: "p",
|
|
237
|
+
size: "3",
|
|
238
|
+
weight: "medium",
|
|
239
|
+
children: "Image"
|
|
240
|
+
}), /* @__PURE__ */ O(C, {
|
|
241
|
+
as: "p",
|
|
242
|
+
size: "2",
|
|
243
|
+
color: "gray",
|
|
244
|
+
children: "Insert an image from a URL."
|
|
245
|
+
})] }),
|
|
246
|
+
/* @__PURE__ */ O("label", { children: /* @__PURE__ */ k(y, {
|
|
247
|
+
direction: "column",
|
|
248
|
+
gap: "2",
|
|
249
|
+
children: [/* @__PURE__ */ O(C, {
|
|
250
|
+
as: "span",
|
|
251
|
+
size: "2",
|
|
252
|
+
weight: "medium",
|
|
253
|
+
children: "Image URL"
|
|
254
|
+
}), /* @__PURE__ */ O(w.Root, {
|
|
255
|
+
autoFocus: !0,
|
|
256
|
+
placeholder: "https://example.com/image.png",
|
|
257
|
+
value: R,
|
|
258
|
+
onChange: K
|
|
259
|
+
})]
|
|
260
|
+
}) }),
|
|
261
|
+
/* @__PURE__ */ k(y, {
|
|
262
|
+
justify: "end",
|
|
263
|
+
gap: "2",
|
|
264
|
+
children: [/* @__PURE__ */ O(x.Close, { children: /* @__PURE__ */ O(v, {
|
|
265
|
+
type: "button",
|
|
266
|
+
variant: "soft",
|
|
267
|
+
color: "gray",
|
|
268
|
+
children: "Cancel"
|
|
269
|
+
}) }), /* @__PURE__ */ O(v, {
|
|
270
|
+
type: "button",
|
|
271
|
+
disabled: R.trim().length === 0,
|
|
272
|
+
onClick: W,
|
|
273
|
+
children: "Save"
|
|
274
|
+
})]
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})
|
|
278
|
+
})]
|
|
279
|
+
}, `${e.name}-${t}`) : /* @__PURE__ */ O(b, {
|
|
280
|
+
type: "button",
|
|
281
|
+
"aria-label": e.label,
|
|
282
|
+
"aria-pressed": e.isToggle ? e.isActive() : void 0,
|
|
283
|
+
radius: "medium",
|
|
284
|
+
color: "gray",
|
|
285
|
+
variant: e.isActive() ? "soft" : "ghost",
|
|
286
|
+
disabled: e.disabled || !A.isEditable,
|
|
287
|
+
title: e.label,
|
|
288
|
+
onMouseDown: G,
|
|
289
|
+
onClick: e.command,
|
|
290
|
+
className: j(e.disabled && "scribe-toolbar-button--disabled"),
|
|
291
|
+
children: /* @__PURE__ */ O(e.icon, { className: "scribe-toolbar-icon" })
|
|
292
|
+
}, `${e.name}-${t}`))
|
|
293
|
+
}), t === q.length - 1 ? null : /* @__PURE__ */ O(S, {
|
|
294
|
+
orientation: "vertical",
|
|
295
|
+
decorative: !0,
|
|
296
|
+
style: { height: 20 }
|
|
297
|
+
})] }, `format-group-${t}`))
|
|
298
|
+
})
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
//#endregion
|
|
302
|
+
export { j as n, M as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/BarMenu.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AACvD,OAAO,EAAe,EAAE,EAA+C,MAAM,OAAO,CAAC;AAoBrF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAaD,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"BarMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/BarMenu.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AACvD,OAAO,EAAe,EAAE,EAA+C,MAAM,OAAO,CAAC;AAoBrF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAaD,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAgV7B,CAAC;eAEa,OAAO"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as default };
|
|
1
|
+
export { t as default } from "../../BarMenu-Bm5IfWVV.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as e } from "../../dist-SM4NoN4h.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../menus-
|
|
3
|
+
import { t as n } from "../../menus-BKxcTUsl.js";
|
|
4
4
|
import { Flex as r, IconButton as i } from "@radix-ui/themes";
|
|
5
5
|
import { useCallback as a } from "react";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CALLOUT_VARIANTS as e, CALLOUT_VARIANT_LABELS as t, isCalloutVariant as n } from "../Scribe/extension/callout.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as r } from "../../dist-SM4NoN4h.js";
|
|
3
3
|
import { getPopupMountTarget as i } from "../Scribe/extension/getPopupMountTarget.js";
|
|
4
|
-
import { t as a } from "../../menus-
|
|
4
|
+
import { t as a } from "../../menus-BKxcTUsl.js";
|
|
5
5
|
import { CalloutIcon as o, RemoveCalloutIcon as s } from "../../icons/CalloutIcon.js";
|
|
6
6
|
import { calloutBubbleMenuPluginKey as c, getSelectionCalloutContext as l } from "./calloutBubbleMenuPlugin.js";
|
|
7
7
|
import { getSelectionContextualMenuOwner as u } from "./contextualMenuOwner.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/LinkBubbleMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,EAAE,EAA2E,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LinkBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/LinkBubbleMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,EAAE,EAA2E,MAAM,OAAO,CAAC;AAapG,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAoCD,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAkb3C,CAAC;eAEa,cAAc"}
|