@clevertask/scribe 0.1.7 → 0.1.9
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 +5 -4
- package/dist/{BarMenu-DC-S5Ggq.js → BarMenu-BG_w4DVo.js} +53 -25
- 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/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +64 -50
- package/dist/components/Menu/LinkEditor.js +4 -4
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +11 -5
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +1 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +4 -2
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.js +6 -2
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +14 -6
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +948 -943
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/tableOfContents.js +2 -2
- package/dist/components/Scribe/index.d.ts +2 -0
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +182 -80
- package/dist/{dist-BQjH-i-q.js → dist-BMKyBtRa.js} +112 -105
- package/dist/{dist-DT3iiwSr.js → dist-BgEySLwo.js} +9 -8
- package/dist/{dist-CnXCIcnl.js → dist-FrapLVQu.js} +16 -9
- package/dist/{extension-CZOsheCI.js → extension-BVGWENts.js} +1306 -1300
- package/dist/{extension-link-DZID_SYl.js → extension-link-CMRfHUc5.js} +5 -5
- package/dist/{floating-ui.dom-rih69525.js → floating-ui.dom-CmJ6iBdh.js} +4 -5
- package/dist/{html-to-markdown-CrNOkSye.js → html-to-markdown-Cta7-ssO.js} +3 -2
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-DEczPfuq.js → markdown-to-html-DwSNqq2i.js} +8 -6
- package/dist/{menus-CrKTaPWU.js → menus-D9OsP28c.js} +8 -8
- package/dist/{purify.es-DF9CW1cl.js → purify.es-CFiLaBu1.js} +1 -1
- package/dist/{slashCommand-B7CRIaKG.js → slashCommand-B6Iz1i0d.js} +5 -8
- package/dist/{tables-CjOC70rm.js → tables-CXpUVKdw.js} +9 -7
- package/dist/{tippy.esm-D9LL2xiE.js → tippy.esm-DOXqN1Qm.js} +2 -7
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +49 -34
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ npm install @clevertask/scribe
|
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
45
|
import "@radix-ui/themes/styles.css";
|
|
46
|
-
import "@clevertask/scribe/
|
|
46
|
+
import "@clevertask/scribe/styles.css";
|
|
47
47
|
import { Theme } from "@radix-ui/themes";
|
|
48
48
|
import { Scribe, ScribeRef } from "@clevertask/scribe";
|
|
49
49
|
|
|
@@ -67,7 +67,7 @@ function App() {
|
|
|
67
67
|
|
|
68
68
|
```tsx
|
|
69
69
|
import "@radix-ui/themes/styles.css";
|
|
70
|
-
import "@clevertask/scribe/
|
|
70
|
+
import "@clevertask/scribe/styles.css";
|
|
71
71
|
import { Theme } from "@radix-ui/themes";
|
|
72
72
|
import { Scribe, ScribeOnChangeContents } from "@clevertask/scribe";
|
|
73
73
|
|
|
@@ -93,7 +93,7 @@ function App() {
|
|
|
93
93
|
|
|
94
94
|
```tsx
|
|
95
95
|
import "@radix-ui/themes/styles.css";
|
|
96
|
-
import "@clevertask/scribe/
|
|
96
|
+
import "@clevertask/scribe/styles.css";
|
|
97
97
|
import { Theme } from "@radix-ui/themes";
|
|
98
98
|
import { Scribe } from "@clevertask/scribe";
|
|
99
99
|
|
|
@@ -148,7 +148,7 @@ The table of contents currently tracks default TipTap heading nodes only. Each i
|
|
|
148
148
|
|
|
149
149
|
## Math Expressions
|
|
150
150
|
|
|
151
|
-
Scribe's default UI is styled with Radix Themes components. Load `@radix-ui/themes/styles.css` once in your app alongside `@clevertask/scribe/
|
|
151
|
+
Scribe's default UI is styled with Radix Themes components. Load `@radix-ui/themes/styles.css` once in your app alongside `@clevertask/scribe/styles.css`, and render Scribe somewhere inside a Radix `<Theme>`.
|
|
152
152
|
|
|
153
153
|
Scribe ships with `@tiptap/extension-mathematics`. The extension renders math when it receives math nodes in the HTML:
|
|
154
154
|
|
|
@@ -182,6 +182,7 @@ If your content arrives as HTML (for example from a server), use the helper belo
|
|
|
182
182
|
| Prop | Type | Default | Description |
|
|
183
183
|
| ------------------------- | ------------------------------------------------------------------ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
184
184
|
| `content` | `string` | `undefined` | The initial content of the editor. Controlled updates through this prop are deprecated; prefer `ScribeRef.setContent` for programmatic updates after mount. |
|
|
185
|
+
| `ariaLabel` | `string` | `Rich text editor` | Sets the accessible name for the rich-text editing surface. Use a unique label when a page contains more than one editor. |
|
|
185
186
|
| `onContentChange` | `(content: ScribeOnChangeContents) => void;` | `undefined` | A callback function triggered whenever the editor's content changes. It receives an object containing the current content in various formats (`jsonContent`, `htmlContent`, `markdownContent`). Internal table-of-contents metadata updates are ignored. |
|
|
186
187
|
| `editable` | `boolean` | `true` | Controls whether the editor is editable. |
|
|
187
188
|
| `autoFocus` | `boolean` | `false` | Controls whether the editor should automatically focus when mounted. |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e } from "./dist-
|
|
1
|
+
import { a as e } from "./dist-BgEySLwo.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "./components/Scribe/extension/getPopupMountTarget.js";
|
|
3
3
|
import n from "./components/Menu/LinkEditor.js";
|
|
4
4
|
import { hideLinkBubbleMenu as r } from "./components/Menu/linkBubbleMenuPlugin.js";
|
|
@@ -55,60 +55,73 @@ var j = ({ editor: k }) => {
|
|
|
55
55
|
}, [k]), U = T(() => {
|
|
56
56
|
let e = L.trim();
|
|
57
57
|
e && (k.chain().focus().setImage({ src: e }).run(), P(!1));
|
|
58
|
-
}, [k, L]), W = T((e
|
|
59
|
-
e.preventDefault(), t();
|
|
60
|
-
}, []), G = T((e) => {
|
|
58
|
+
}, [k, L]), W = T((e) => {
|
|
61
59
|
e.preventDefault();
|
|
62
|
-
}, []),
|
|
60
|
+
}, []), G = T(({ target: { value: e } }) => {
|
|
63
61
|
R(e);
|
|
64
|
-
}, []),
|
|
62
|
+
}, []), K = [
|
|
65
63
|
[
|
|
66
64
|
{
|
|
67
65
|
name: "bold",
|
|
68
66
|
icon: a,
|
|
69
67
|
command: () => k.chain().focus().toggleBold().run(),
|
|
70
|
-
isActive: () => !!B?.isBold
|
|
68
|
+
isActive: () => !!B?.isBold,
|
|
69
|
+
isToggle: !0,
|
|
70
|
+
label: "Bold"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
name: "italic",
|
|
74
74
|
icon: d,
|
|
75
75
|
command: () => k.chain().focus().toggleItalic().run(),
|
|
76
|
-
isActive: () => !!B?.isItalic
|
|
76
|
+
isActive: () => !!B?.isItalic,
|
|
77
|
+
isToggle: !0,
|
|
78
|
+
label: "Italic"
|
|
77
79
|
},
|
|
78
80
|
{
|
|
79
81
|
name: "strike",
|
|
80
82
|
icon: m,
|
|
81
83
|
command: () => k.chain().focus().toggleStrike().run(),
|
|
82
|
-
isActive: () => !!B?.isStrike
|
|
84
|
+
isActive: () => !!B?.isStrike,
|
|
85
|
+
isToggle: !0,
|
|
86
|
+
label: "Strikethrough"
|
|
83
87
|
}
|
|
84
88
|
],
|
|
85
89
|
[{
|
|
86
90
|
name: "inline-code",
|
|
87
91
|
icon: u,
|
|
88
92
|
command: () => k.chain().focus().toggleCode().run(),
|
|
89
|
-
isActive: () => !!B?.isCode
|
|
93
|
+
isActive: () => !!B?.isCode,
|
|
94
|
+
isToggle: !0,
|
|
95
|
+
label: "Inline code"
|
|
90
96
|
}, {
|
|
91
97
|
name: "highlight",
|
|
92
98
|
icon: s,
|
|
93
99
|
command: () => k.chain().focus().toggleHighlight().run(),
|
|
94
|
-
isActive: () => !!B?.isHighlight
|
|
100
|
+
isActive: () => !!B?.isHighlight,
|
|
101
|
+
isToggle: !0,
|
|
102
|
+
label: "Highlight"
|
|
95
103
|
}],
|
|
96
104
|
[{
|
|
97
105
|
name: "unordered-list",
|
|
98
106
|
icon: h,
|
|
99
107
|
command: () => k.chain().focus().toggleBulletList().run(),
|
|
100
|
-
isActive: () => !!B?.isBulletList
|
|
108
|
+
isActive: () => !!B?.isBulletList,
|
|
109
|
+
isToggle: !0,
|
|
110
|
+
label: "Bulleted list"
|
|
101
111
|
}, {
|
|
102
112
|
name: "ordered-list",
|
|
103
113
|
icon: p,
|
|
104
114
|
command: () => k.chain().focus().toggleOrderedList().run(),
|
|
105
|
-
isActive: () => !!B?.isOrderedList
|
|
115
|
+
isActive: () => !!B?.isOrderedList,
|
|
116
|
+
isToggle: !0,
|
|
117
|
+
label: "Numbered list"
|
|
106
118
|
}],
|
|
107
119
|
[
|
|
108
120
|
{
|
|
109
121
|
name: "link",
|
|
110
122
|
icon: f,
|
|
111
123
|
isActive: () => !!B?.isLink,
|
|
124
|
+
label: "Link",
|
|
112
125
|
popover: "link"
|
|
113
126
|
},
|
|
114
127
|
{
|
|
@@ -116,35 +129,43 @@ var j = ({ editor: k }) => {
|
|
|
116
129
|
icon: l,
|
|
117
130
|
isActive: () => !!B?.isImage,
|
|
118
131
|
disabled: !1,
|
|
132
|
+
label: "Insert image",
|
|
119
133
|
popover: "image"
|
|
120
134
|
},
|
|
121
135
|
{
|
|
122
136
|
name: "code-block",
|
|
123
137
|
icon: o,
|
|
124
138
|
command: () => k.chain().focus().toggleCodeBlock().run(),
|
|
125
|
-
isActive: () => !!B?.isCodeBlock
|
|
139
|
+
isActive: () => !!B?.isCodeBlock,
|
|
140
|
+
isToggle: !0,
|
|
141
|
+
label: "Code block"
|
|
126
142
|
},
|
|
127
143
|
{
|
|
128
144
|
name: "block-quote",
|
|
129
145
|
icon: i,
|
|
130
146
|
command: () => k.chain().focus().toggleBlockquote().run(),
|
|
131
|
-
isActive: () => !!B?.isBlockquote
|
|
147
|
+
isActive: () => !!B?.isBlockquote,
|
|
148
|
+
isToggle: !0,
|
|
149
|
+
label: "Block quote"
|
|
132
150
|
},
|
|
133
151
|
{
|
|
134
152
|
name: "horizontal-line",
|
|
135
153
|
icon: c,
|
|
136
154
|
command: () => k.chain().focus().setHorizontalRule().run(),
|
|
137
|
-
isActive: () => !1
|
|
155
|
+
isActive: () => !1,
|
|
156
|
+
label: "Horizontal rule"
|
|
138
157
|
}
|
|
139
158
|
]
|
|
140
159
|
];
|
|
141
160
|
return /* @__PURE__ */ D(g, {
|
|
142
161
|
className: "scribe-toolbar",
|
|
162
|
+
role: "toolbar",
|
|
163
|
+
"aria-label": "Text formatting",
|
|
143
164
|
children: /* @__PURE__ */ D(v, {
|
|
144
165
|
align: "center",
|
|
145
166
|
gap: "3",
|
|
146
167
|
wrap: "wrap",
|
|
147
|
-
children:
|
|
168
|
+
children: K.map((e, t) => /* @__PURE__ */ O(w, { children: [/* @__PURE__ */ D(v, {
|
|
148
169
|
align: "center",
|
|
149
170
|
gap: "2",
|
|
150
171
|
wrap: "wrap",
|
|
@@ -153,15 +174,17 @@ var j = ({ editor: k }) => {
|
|
|
153
174
|
onOpenChange: V,
|
|
154
175
|
children: [/* @__PURE__ */ D(b.Trigger, { children: /* @__PURE__ */ D(y, {
|
|
155
176
|
type: "button",
|
|
177
|
+
"aria-label": e.label,
|
|
156
178
|
radius: "medium",
|
|
157
179
|
color: "gray",
|
|
158
180
|
variant: e.isActive() ? "soft" : "ghost",
|
|
159
181
|
disabled: e.disabled || !k.isEditable,
|
|
160
|
-
title: e.
|
|
161
|
-
onMouseDown:
|
|
182
|
+
title: e.label,
|
|
183
|
+
onMouseDown: W,
|
|
162
184
|
className: A(e.disabled && "scribe-toolbar-button--disabled"),
|
|
163
185
|
children: /* @__PURE__ */ D(e.icon, { className: "scribe-toolbar-icon" })
|
|
164
186
|
}) }), /* @__PURE__ */ D(b.Content, {
|
|
187
|
+
"aria-label": "Link settings",
|
|
165
188
|
container: z,
|
|
166
189
|
size: "2",
|
|
167
190
|
side: "bottom",
|
|
@@ -184,15 +207,17 @@ var j = ({ editor: k }) => {
|
|
|
184
207
|
onOpenChange: H,
|
|
185
208
|
children: [/* @__PURE__ */ D(b.Trigger, { children: /* @__PURE__ */ D(y, {
|
|
186
209
|
type: "button",
|
|
210
|
+
"aria-label": e.label,
|
|
187
211
|
radius: "medium",
|
|
188
212
|
color: "gray",
|
|
189
213
|
variant: e.isActive() ? "soft" : "ghost",
|
|
190
214
|
disabled: e.disabled || !k.isEditable,
|
|
191
|
-
title: e.
|
|
192
|
-
onMouseDown:
|
|
215
|
+
title: e.label,
|
|
216
|
+
onMouseDown: W,
|
|
193
217
|
className: A(e.disabled && "scribe-toolbar-button--disabled"),
|
|
194
218
|
children: /* @__PURE__ */ D(e.icon, { className: "scribe-toolbar-icon" })
|
|
195
219
|
}) }), /* @__PURE__ */ D(b.Content, {
|
|
220
|
+
"aria-label": "Insert image",
|
|
196
221
|
container: z,
|
|
197
222
|
size: "2",
|
|
198
223
|
side: "bottom",
|
|
@@ -228,7 +253,7 @@ var j = ({ editor: k }) => {
|
|
|
228
253
|
autoFocus: !0,
|
|
229
254
|
placeholder: "https://example.com/image.png",
|
|
230
255
|
value: L,
|
|
231
|
-
onChange:
|
|
256
|
+
onChange: G
|
|
232
257
|
})]
|
|
233
258
|
}) }),
|
|
234
259
|
/* @__PURE__ */ O(v, {
|
|
@@ -251,16 +276,19 @@ var j = ({ editor: k }) => {
|
|
|
251
276
|
})]
|
|
252
277
|
}, `${e.name}-${t}`) : /* @__PURE__ */ D(y, {
|
|
253
278
|
type: "button",
|
|
279
|
+
"aria-label": e.label,
|
|
280
|
+
"aria-pressed": e.isToggle ? e.isActive() : void 0,
|
|
254
281
|
radius: "medium",
|
|
255
282
|
color: "gray",
|
|
256
283
|
variant: e.isActive() ? "soft" : "ghost",
|
|
257
284
|
disabled: e.disabled || !k.isEditable,
|
|
258
|
-
title: e.
|
|
259
|
-
onMouseDown:
|
|
285
|
+
title: e.label,
|
|
286
|
+
onMouseDown: W,
|
|
287
|
+
onClick: e.command,
|
|
260
288
|
className: A(e.disabled && "scribe-toolbar-button--disabled"),
|
|
261
289
|
children: /* @__PURE__ */ D(e.icon, { className: "scribe-toolbar-icon" })
|
|
262
290
|
}, `${e.name}-${t}`))
|
|
263
|
-
}), t ===
|
|
291
|
+
}), t === K.length - 1 ? null : /* @__PURE__ */ D(x, {
|
|
264
292
|
orientation: "vertical",
|
|
265
293
|
decorative: !0,
|
|
266
294
|
style: { height: 20 }
|