@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.
- package/README.md +30 -47
- package/dist/BarMenu-Bban-B3t.js +302 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +107 -119
- 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 +152 -153
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +1 -1
- 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 +5 -5
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
- 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 -45
- 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 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/table-layout.js +1 -1
- 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 +3 -3
- package/dist/{dist-xjmWZ-oh.js → dist-DGEcUiqG.js} +650 -686
- package/dist/{dist-Dk0fXvrc.js → dist-TKt66Yz8.js} +2 -2
- package/dist/{dist-BiognBi4.js → dist-ZGDUiMX8.js} +189 -376
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BU2USLV1.js → extension-I7Ocj_D_.js} +2 -2
- package/dist/extension-link-Cb1UO6hv.js +939 -0
- package/dist/main.css +0 -141
- package/dist/{menus-BDXjZsFU.js → menus-BrQTLTFL.js} +17 -17
- package/dist/{schema-extensions-DyCk1Goa.js → schema-extensions-CzDKrIf8.js} +1616 -1489
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{table-layout-BoDS50DR.js → table-layout-Dt7KmVp_.js} +174 -123
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +51 -51
- package/dist/BarMenu-BGWT4Oyk.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-DmM_EJTn.js +0 -909
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,39 @@ 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
|
-
##
|
|
243
|
+
## Links
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
Scribe uses Tiptap's Link extension for ordinary links and URL paste. Use the toolbar or click an
|
|
246
|
+
existing link to edit **Text to display** and **URL**, then choose **Apply** or **Remove link**.
|
|
247
|
+
An unchanged label preserves the link's inline formatting. Keyboard users can press `Alt + F10`
|
|
248
|
+
from a link to open the form and Escape to return to the document.
|
|
247
249
|
|
|
248
|
-
|
|
250
|
+
Pasting recognizable URL-only content over selected text applies a link using native Tiptap
|
|
251
|
+
behavior; ordinary text replaces the selection. Rich clipboard content follows Tiptap's parsed
|
|
252
|
+
content handling. Scribe does not fetch metadata or create Compact/Preview card presentations.
|
|
253
|
+
Automatic links and URL paste use Tiptap's native URL/protocol recognition and safety checks,
|
|
254
|
+
including email and FTP links. The manual URL form accepts HTTP(S), bare domains and
|
|
255
|
+
root-relative links. Application-owned task and document reference extensions remain separate:
|
|
256
|
+
URL paste links eligible text around selected inline atoms without marking the atoms themselves,
|
|
257
|
+
while an atom-only selection follows normal paste replacement.
|
|
249
258
|
|
|
250
|
-
|
|
259
|
+
### Legacy preview compatibility
|
|
251
260
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
function DocumentEditor() {
|
|
257
|
-
const resolveLinkPreview = useCallback<ExternalLinkPreviewResolver>(async (href, { signal }) => {
|
|
258
|
-
const response = await fetch(`/api/link-previews?url=${encodeURIComponent(href)}`, {
|
|
259
|
-
credentials: "include",
|
|
260
|
-
signal,
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
if (!response.ok) {
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return response.json();
|
|
268
|
-
}, []);
|
|
269
|
-
const shouldPreview = useCallback((href: string) => {
|
|
270
|
-
return new URL(href).origin !== window.location.origin;
|
|
271
|
-
}, []);
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<Scribe
|
|
275
|
-
externalLinkPreview={{
|
|
276
|
-
resolve: resolveLinkPreview,
|
|
277
|
-
shouldPreview,
|
|
278
|
-
// Defaults to false. When enabled, standalone pastes become local Compact links.
|
|
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.
|
|
261
|
+
Saved `externalLinkPreview` nodes still load in the interactive and headless schemas and render
|
|
262
|
+
as ordinary links using their authored `linkText` and exact `href`. Their node identity, display
|
|
263
|
+
value and metadata remain serialized in HTML, JSON and Markdown. Reading a document does not
|
|
264
|
+
convert these nodes or discard metadata. No stored favicon or preview image is requested.
|
|
289
265
|
|
|
290
|
-
The
|
|
266
|
+
The exported `ExternalLinkPreview` extension, constants, types and `externalLinkPreview` options
|
|
267
|
+
remain for compatibility. `autoPreviewOnPaste`, `resolve` and `shouldPreview` are deprecated and
|
|
268
|
+
ignored; `HTMLAttributes` still applies to the legacy wrapper. A caller-owned `externalEditor`
|
|
269
|
+
must register the compatibility extension to read existing preview nodes.
|
|
291
270
|
|
|
292
|
-
|
|
271
|
+
The deprecated `insertExternalLinkPreview` and `updateExternalLinkPreview` commands retain the
|
|
272
|
+
legacy node shape and attributes, displayed as ordinary links, without fetching metadata.
|
|
273
|
+
`setExternalLinkDisplay("compact" | "card")` and `refreshExternalLinkPreview` return `false`.
|
|
274
|
+
`setExternalLinkDisplay("plain")` and `convertExternalLinkPreviewToPlain` remain explicit,
|
|
275
|
+
undoable conversions to ordinary Link-marked text. There is no automatic content migration.
|
|
293
276
|
|
|
294
277
|
## Experimental Table of Contents
|
|
295
278
|
|
|
@@ -386,7 +369,7 @@ The `createScribeEditor` helper accepts the same `enableUndoRedo` option.
|
|
|
386
369
|
| `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
370
|
| `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
371
|
| `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` |
|
|
372
|
+
| `externalLinkPreview` | `Partial<ExternalLinkPreviewOptions>` | `undefined` | Deprecated compatibility options. Only HTMLAttributes affects legacy wrappers; metadata resolution, preview policy and automatic previews are ignored. |
|
|
390
373
|
| `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
374
|
| `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
375
|
| `placeholderText` | `string` | `Type "/" for commands...` | Change the initial placeholder for your text editor |
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { a as e } from "./dist-ZGDUiMX8.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 };
|