@maily-to/core 2.0.0-beta.7 → 2.0.0-beta.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/dist/blocks/index.cjs +8 -1
- package/dist/blocks/index.d.cts +1 -38
- package/dist/blocks/index.d.mts +14 -6
- package/dist/blocks/index.d.mts.map +1 -1
- package/dist/blocks/index.mjs +2 -2
- package/dist/extensions/index.cjs +266 -286
- package/dist/extensions/index.d.cts +1 -379
- package/dist/extensions/index.d.mts +127 -224
- package/dist/extensions/index.d.mts.map +1 -1
- package/dist/extensions/index.mjs +238 -271
- package/dist/index.cjs +8826 -11828
- package/dist/index.d.cts +1 -165
- package/dist/index.d.mts +701 -121
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8460 -11567
- package/dist/{slash-command-BmWRVPbv.d.mts → slash-command-BrwA1bHs.d.mts} +10 -11
- package/dist/slash-command-BrwA1bHs.d.mts.map +1 -0
- package/dist/theme-D1CI7_8s.d.mts +70 -0
- package/dist/theme-D1CI7_8s.d.mts.map +1 -0
- package/dist/typography-BdOKvXfQ.mjs +911 -0
- package/dist/typography-D-VnwOSw.cjs +970 -0
- package/dist/typography-DW7VApAR.cjs +1072 -0
- package/dist/use-maily-editor-Atvy2kSO.cjs +3993 -0
- package/dist/use-maily-editor-CByaDhmT.cjs +4955 -0
- package/dist/use-maily-editor-idL0RNsG.mjs +4504 -0
- package/package.json +82 -74
- package/readme.md +169 -128
- package/src/styles/index.css +2537 -0
- package/dist/blocks/index.d.cts.map +0 -1
- package/dist/chunk-CfYAbeIz.mjs +0 -13
- package/dist/extensions/index.d.cts.map +0 -1
- package/dist/extensions/index.mjs.map +0 -1
- package/dist/index.css +0 -2312
- package/dist/index.d.cts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/slash-command-BmWRVPbv.d.mts.map +0 -1
- package/dist/slash-command-CK0-1FwR.d.cts +0 -39
- package/dist/slash-command-CK0-1FwR.d.cts.map +0 -1
- package/dist/spacer-DBtsr3hu.cjs +0 -5768
- package/dist/spacer-DzZWX-wB.mjs +0 -5456
- package/dist/spacer-DzZWX-wB.mjs.map +0 -1
- package/dist/typography-CWL13acR.cjs +0 -400
- package/dist/typography-DhrUe809.mjs +0 -282
- package/dist/typography-DhrUe809.mjs.map +0 -1
- package/dist/variable-C9S9ZoHv.d.cts +0 -108
- package/dist/variable-C9S9ZoHv.d.cts.map +0 -1
- package/dist/variable-DVwGrg2a.d.mts +0 -108
- package/dist/variable-DVwGrg2a.d.mts.map +0 -1
package/readme.md
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
[](https://maily.to)
|
|
6
2
|
|
|
7
3
|
<p align="center">
|
|
8
4
|
<a href="https://github.com/arikchakma/maily.to/blob/main/LICENSE">
|
|
@@ -24,14 +20,15 @@ pnpm add -D @tiptap/core
|
|
|
24
20
|
|
|
25
21
|
### Quick Start
|
|
26
22
|
|
|
27
|
-
The editor uses a **compound component** pattern — compose `Editor.Root`,
|
|
23
|
+
The editor uses a **compound component** pattern — compose `Editor.Root`,
|
|
24
|
+
`Editor.Frame`, and `Editor.Content` to build your layout.
|
|
28
25
|
|
|
29
26
|
```tsx
|
|
30
27
|
import '@maily-to/core/style.css';
|
|
31
28
|
|
|
32
29
|
import { useState } from 'react';
|
|
33
30
|
import { Editor } from '@maily-to/core';
|
|
34
|
-
import type { Editor as TiptapEditor
|
|
31
|
+
import type { Editor as TiptapEditor } from '@tiptap/core';
|
|
35
32
|
|
|
36
33
|
function App() {
|
|
37
34
|
const [editor, setEditor] = useState<TiptapEditor>();
|
|
@@ -44,6 +41,8 @@ function App() {
|
|
|
44
41
|
>
|
|
45
42
|
<Editor.Frame>
|
|
46
43
|
<Editor.Content />
|
|
44
|
+
<Editor.BubbleMenus />
|
|
45
|
+
<Editor.DragContextHandle />
|
|
47
46
|
</Editor.Frame>
|
|
48
47
|
</Editor.Root>
|
|
49
48
|
);
|
|
@@ -52,39 +51,47 @@ function App() {
|
|
|
52
51
|
|
|
53
52
|
#### Editor Components
|
|
54
53
|
|
|
55
|
-
| Component
|
|
56
|
-
|
|
|
57
|
-
| `Editor.Root`
|
|
58
|
-
| `Editor.
|
|
59
|
-
| `Editor.
|
|
60
|
-
| `Editor.
|
|
61
|
-
| `Editor.
|
|
62
|
-
|
|
63
|
-
`Editor.Frame` is shorthand for nesting `Body` and `Container`. Use the individual pieces when you need more control:
|
|
54
|
+
| Component | Description |
|
|
55
|
+
| -------------------------- | ---------------------------------------------------------------------- |
|
|
56
|
+
| `Editor.Root` | Top-level provider. Accepts content, extensions, and editor callbacks. |
|
|
57
|
+
| `Editor.Frame` | Renders the document's body and container shells. |
|
|
58
|
+
| `Editor.Content` | Renders the Tiptap editor. |
|
|
59
|
+
| `Editor.BubbleMenus` | Renders every node and text bubble menu. |
|
|
60
|
+
| `Editor.DragContextHandle` | Renders the drag handle and its context menu. |
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<Editor.Container>
|
|
69
|
-
<Editor.Content />
|
|
70
|
-
</Editor.Container>
|
|
71
|
-
</Editor.Body>
|
|
72
|
-
</Editor.Root>
|
|
73
|
-
```
|
|
62
|
+
`Editor.Content` renders only the editor. Compose `Editor.BubbleMenus` and
|
|
63
|
+
`Editor.DragContextHandle` beside it to get Maily's chrome, and leave them out
|
|
64
|
+
for a bare canvas.
|
|
74
65
|
|
|
75
|
-
####
|
|
66
|
+
#### Reading the document
|
|
76
67
|
|
|
77
|
-
|
|
68
|
+
Pass a `ref` to `Editor.Root` to reach the editor and its content from outside.
|
|
78
69
|
|
|
79
70
|
```tsx
|
|
80
|
-
import {
|
|
71
|
+
import { useRef } from 'react';
|
|
72
|
+
import { Editor } from '@maily-to/core';
|
|
73
|
+
|
|
74
|
+
function App() {
|
|
75
|
+
const editorRef = useRef<Editor.Root.Handle>(null);
|
|
76
|
+
|
|
77
|
+
const save = () => {
|
|
78
|
+
const json = editorRef.current?.getJSON();
|
|
79
|
+
// ...
|
|
80
|
+
};
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
const { textDirection, setTextDirection, theme } = useEditorRootContext();
|
|
84
|
-
// ...
|
|
82
|
+
return <Editor.Root ref={editorRef}>{/* ... */}</Editor.Root>;
|
|
85
83
|
}
|
|
86
84
|
```
|
|
87
85
|
|
|
86
|
+
`Editor.Root.Props` types the props in the same way.
|
|
87
|
+
|
|
88
|
+
| Method | Returns |
|
|
89
|
+
| --------------- | -------------------------------- |
|
|
90
|
+
| `getEditor` | The underlying Tiptap `Editor` |
|
|
91
|
+
| `getJSON` | The document as a `DocumentNode` |
|
|
92
|
+
| `getEditorHTML` | The editor's HTML |
|
|
93
|
+
| `getText` | The document's plain text |
|
|
94
|
+
|
|
88
95
|
### Toolbar
|
|
89
96
|
|
|
90
97
|
A composable toolbar with pre-built action buttons:
|
|
@@ -98,6 +105,7 @@ import { Editor, Toolbar } from '@maily-to/core';
|
|
|
98
105
|
</Toolbar.Root>
|
|
99
106
|
<Editor.Frame>
|
|
100
107
|
<Editor.Content />
|
|
108
|
+
<Editor.BubbleMenus />
|
|
101
109
|
</Editor.Frame>
|
|
102
110
|
</Editor.Root>;
|
|
103
111
|
```
|
|
@@ -134,18 +142,25 @@ Or pick individual buttons:
|
|
|
134
142
|
|
|
135
143
|
### Slash Commands
|
|
136
144
|
|
|
137
|
-
Slash commands let you interact with the editor by typing `/` followed by a
|
|
145
|
+
Slash commands let you interact with the editor by typing `/` followed by a
|
|
146
|
+
command name. Commands are organized into groups with a `title` and a `commands`
|
|
147
|
+
array.
|
|
138
148
|
|
|
139
149
|
#### Basic Example
|
|
140
150
|
|
|
141
151
|
```tsx
|
|
142
|
-
import {
|
|
152
|
+
import { heading1, text } from '@maily-to/core/blocks';
|
|
143
153
|
import { SlashCommandExtension } from '@maily-to/core/extensions';
|
|
144
154
|
|
|
145
155
|
<Editor.Root
|
|
146
156
|
extensions={[
|
|
147
157
|
SlashCommandExtension.configure({
|
|
148
|
-
commands: [
|
|
158
|
+
commands: [
|
|
159
|
+
{
|
|
160
|
+
title: 'Blocks',
|
|
161
|
+
commands: [text, heading1],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
149
164
|
}),
|
|
150
165
|
]}
|
|
151
166
|
>
|
|
@@ -153,23 +168,33 @@ import { SlashCommandExtension } from '@maily-to/core/extensions';
|
|
|
153
168
|
</Editor.Root>;
|
|
154
169
|
```
|
|
155
170
|
|
|
171
|
+
`commands` takes groups, not blocks — every block belongs to a group with a
|
|
172
|
+
`title`. `DEFAULT_SLASH_COMMANDS` is the set the editor ships with, so extend it
|
|
173
|
+
rather than restate it when you only want to add one group.
|
|
174
|
+
|
|
156
175
|
> The order of the groups and commands determines how they are displayed in the editor.
|
|
157
176
|
|
|
158
177
|
#### Available Blocks
|
|
159
178
|
|
|
160
179
|
Import pre-built blocks from `@maily-to/core/blocks`:
|
|
161
180
|
|
|
162
|
-
**Typography:** `text`, `heading1`, `heading2`, `heading3`, `blockquote`, `
|
|
181
|
+
**Typography:** `text`, `heading1`, `heading2`, `heading3`, `blockquote`, `hardBreak`, `clearLine`
|
|
163
182
|
|
|
164
|
-
**Layout:** `spacer`, `divider`, `section`, `columns`, `repeat`, `htmlCodeBlock`
|
|
183
|
+
**Layout:** `spacer`, `divider`, `section`, `columns`, `repeat`, `table`, `htmlCodeBlock`
|
|
165
184
|
|
|
166
185
|
**Content:** `button`, `image`, `inlineImage`, `linkCard`, `bulletList`, `orderedList`
|
|
167
186
|
|
|
187
|
+
**Headers:** `headerLogoWithCoverImage`, `headerLogoWithTextHorizontal`, `headerLogoWithTextVertical`
|
|
188
|
+
|
|
189
|
+
**Footers:** `footer`, `footerCommunityFeedbackCta`, `footerCompanySignature`, `footerCopyrightText`
|
|
190
|
+
|
|
168
191
|
#### Grouped Commands with Subcommands
|
|
169
192
|
|
|
170
|
-
|
|
193
|
+
An item with an `id` and a `commands` array becomes a nested menu. Typing
|
|
194
|
+
`/headers.` then shows its subcommands.
|
|
171
195
|
|
|
172
196
|
```tsx
|
|
197
|
+
import { heading1, heading2, heading3 } from '@maily-to/core/blocks';
|
|
173
198
|
import { SlashCommandExtension } from '@maily-to/core/extensions';
|
|
174
199
|
|
|
175
200
|
<Editor.Root
|
|
@@ -177,20 +202,13 @@ import { SlashCommandExtension } from '@maily-to/core/extensions';
|
|
|
177
202
|
SlashCommandExtension.configure({
|
|
178
203
|
commands: [
|
|
179
204
|
{
|
|
180
|
-
title: '
|
|
181
|
-
id: 'headers',
|
|
182
|
-
searchTerms: ['header', 'title'],
|
|
205
|
+
title: 'Blocks',
|
|
183
206
|
commands: [
|
|
184
207
|
{
|
|
185
|
-
title: '
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
.chain()
|
|
190
|
-
.deleteRange(range)
|
|
191
|
-
.setHeading({ level: 1 })
|
|
192
|
-
.run();
|
|
193
|
-
},
|
|
208
|
+
title: 'Headers',
|
|
209
|
+
id: 'headers',
|
|
210
|
+
searchTerms: ['header', 'title'],
|
|
211
|
+
commands: [heading1, heading2, heading3],
|
|
194
212
|
},
|
|
195
213
|
],
|
|
196
214
|
},
|
|
@@ -202,25 +220,51 @@ import { SlashCommandExtension } from '@maily-to/core/extensions';
|
|
|
202
220
|
</Editor.Root>;
|
|
203
221
|
```
|
|
204
222
|
|
|
223
|
+
The `id` and the nesting live on the **item**, not on the group — a group only
|
|
224
|
+
carries a `title` and its `commands`.
|
|
225
|
+
|
|
205
226
|
> Currently supports one level of depth for subcommands.
|
|
206
227
|
|
|
207
|
-
####
|
|
228
|
+
#### Writing a Block
|
|
229
|
+
|
|
230
|
+
A block is an item with a `title`, `searchTerms`, and a `command` that runs
|
|
231
|
+
against the editor and the typed range.
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
{
|
|
235
|
+
title: 'Custom Block',
|
|
236
|
+
searchTerms: ['custom'],
|
|
237
|
+
command: ({ editor, range }) => {
|
|
238
|
+
editor.chain().deleteRange(range).run();
|
|
239
|
+
},
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### Controlling How a Block Appears
|
|
208
244
|
|
|
209
|
-
|
|
245
|
+
`render` decides whether an item shows and what its row looks like. Return
|
|
246
|
+
`null` to hide it, `true` for the default row, or JSX to replace the row.
|
|
210
247
|
|
|
211
248
|
```tsx
|
|
212
249
|
{
|
|
213
250
|
title: 'Custom Block',
|
|
214
251
|
searchTerms: ['custom'],
|
|
252
|
+
command: ({ editor, range }) => {
|
|
253
|
+
editor.chain().deleteRange(range).run();
|
|
254
|
+
},
|
|
215
255
|
render: (editor) => {
|
|
216
|
-
return
|
|
256
|
+
return editor.isActive('section') ? null : true;
|
|
217
257
|
},
|
|
218
258
|
}
|
|
219
259
|
```
|
|
220
260
|
|
|
261
|
+
Add `preview` to show a preview beside the row, and `description` or `icon` to
|
|
262
|
+
fill out the default one.
|
|
263
|
+
|
|
221
264
|
### Variables
|
|
222
265
|
|
|
223
|
-
Variables are dynamic placeholders
|
|
266
|
+
Variables are dynamic placeholders that get replaced at render time. Typing `{{`
|
|
267
|
+
opens the variable picker.
|
|
224
268
|
|
|
225
269
|
#### Array of Variables
|
|
226
270
|
|
|
@@ -233,7 +277,7 @@ import { VariableExtension } from '@maily-to/core/extensions';
|
|
|
233
277
|
variables: [
|
|
234
278
|
{ id: 'currentDate' },
|
|
235
279
|
{ id: 'currentTime', required: false },
|
|
236
|
-
{ id: 'first_name', required: false,
|
|
280
|
+
{ id: 'first_name', required: false, isDefaultEditable: false },
|
|
237
281
|
],
|
|
238
282
|
}),
|
|
239
283
|
]}
|
|
@@ -242,7 +286,9 @@ import { VariableExtension } from '@maily-to/core/extensions';
|
|
|
242
286
|
</Editor.Root>;
|
|
243
287
|
```
|
|
244
288
|
|
|
245
|
-
When passing an array, Maily handles query filtering automatically. A dynamic
|
|
289
|
+
When passing an array, Maily handles query filtering automatically. A dynamic
|
|
290
|
+
entry is appended when no exact match exists, allowing users to create variables
|
|
291
|
+
on the fly.
|
|
246
292
|
|
|
247
293
|
#### Function-based Variables
|
|
248
294
|
|
|
@@ -259,14 +305,15 @@ VariableExtension.configure({
|
|
|
259
305
|
|
|
260
306
|
### Extensions
|
|
261
307
|
|
|
262
|
-
Extensions extend the editor's functionality.
|
|
308
|
+
Extensions extend the editor's functionality. Maily's own extensions are
|
|
309
|
+
included by default — use the `extensions` prop to configure them, to override
|
|
310
|
+
one, or to add an opt-in extension.
|
|
263
311
|
|
|
264
312
|
```tsx
|
|
265
313
|
import {
|
|
266
|
-
VariableExtension,
|
|
267
314
|
ImageUploadExtension,
|
|
268
|
-
|
|
269
|
-
|
|
315
|
+
LinkCardExtension,
|
|
316
|
+
VariableExtension,
|
|
270
317
|
} from '@maily-to/core/extensions';
|
|
271
318
|
|
|
272
319
|
<Editor.Root
|
|
@@ -278,12 +325,15 @@ import {
|
|
|
278
325
|
return url;
|
|
279
326
|
},
|
|
280
327
|
}),
|
|
328
|
+
LinkCardExtension,
|
|
281
329
|
]}
|
|
282
330
|
>
|
|
283
331
|
...
|
|
284
332
|
</Editor.Root>
|
|
285
333
|
```
|
|
286
334
|
|
|
335
|
+
`LinkCardExtension` is opt-in — add it to get the link card node.
|
|
336
|
+
|
|
287
337
|
#### Image Upload
|
|
288
338
|
|
|
289
339
|
Handle file drops and pastes with the `ImageUploadExtension`:
|
|
@@ -307,100 +357,91 @@ ImageUploadExtension.configure({
|
|
|
307
357
|
|
|
308
358
|
Supports `image/jpeg`, `image/png`, `image/gif`, `image/webp`, and `image/svg+xml`.
|
|
309
359
|
|
|
310
|
-
#### AI Actions
|
|
360
|
+
#### AI Actions and Inline Suggestions
|
|
311
361
|
|
|
312
|
-
|
|
362
|
+
AI transformations and ghost-text autocomplete ship inside this package. The
|
|
363
|
+
text bubble menu renders `AIActionsDropdown` when the AI actions extension is
|
|
364
|
+
present. See [extension-ai-actions](../extension-ai-actions) and
|
|
365
|
+
[extension-inline-suggestion](../extension-inline-suggestion).
|
|
366
|
+
|
|
367
|
+
### Theming
|
|
368
|
+
|
|
369
|
+
A document carries its own appearance. `ThemeExtension` writes a theme into the
|
|
370
|
+
document's `theme` attribute, and every node's `style` attribute is what the
|
|
371
|
+
renderer reads — so `@maily-to/render` applies no theme of its own and the email
|
|
372
|
+
matches the canvas.
|
|
313
373
|
|
|
314
374
|
```tsx
|
|
315
|
-
import {
|
|
316
|
-
import
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
375
|
+
import { BASIC_NODE_THEME } from '@maily-to/shared';
|
|
376
|
+
import { ThemeExtension } from '@maily-to/core/extensions';
|
|
377
|
+
|
|
378
|
+
<Editor.Root
|
|
379
|
+
extensions={[ThemeExtension.configure({ theme: BASIC_NODE_THEME })]}
|
|
380
|
+
>
|
|
381
|
+
...
|
|
382
|
+
</Editor.Root>;
|
|
320
383
|
```
|
|
321
384
|
|
|
322
|
-
|
|
385
|
+
`BASIC_NODE_THEME` is a plain starter theme. Omit `ThemeExtension`
|
|
386
|
+
entirely for an unthemed document — the editor stays fully usable and applies no
|
|
387
|
+
Maily appearance.
|
|
323
388
|
|
|
324
|
-
|
|
389
|
+
A theme is a `NodeThemeOptions` map from node type to an inline style:
|
|
325
390
|
|
|
326
|
-
```
|
|
327
|
-
import {
|
|
328
|
-
|
|
391
|
+
```ts
|
|
392
|
+
import type { NodeThemeOptions } from '@maily-to/shared';
|
|
393
|
+
|
|
394
|
+
const theme: NodeThemeOptions = {
|
|
395
|
+
body: { backgroundColor: '#ffffff', padding: '24px' },
|
|
396
|
+
container: { backgroundColor: '#f9fafb', maxWidth: '600px' },
|
|
397
|
+
button: { backgroundColor: '#4f46e5', color: '#ffffff' },
|
|
398
|
+
link: { color: '#2563eb' },
|
|
399
|
+
paragraph: { fontSize: '15px', lineHeight: '24px' },
|
|
400
|
+
};
|
|
329
401
|
```
|
|
330
402
|
|
|
331
|
-
|
|
403
|
+
#### Editing the theme
|
|
332
404
|
|
|
333
|
-
|
|
405
|
+
`ThemeSettings` gives writers a panel for the theme the document holds. Each
|
|
406
|
+
part edits one group of declarations.
|
|
334
407
|
|
|
335
408
|
```tsx
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
paddingTop: 16,
|
|
345
|
-
paddingRight: 16,
|
|
346
|
-
paddingBottom: 16,
|
|
347
|
-
paddingLeft: 16,
|
|
348
|
-
},
|
|
349
|
-
body: {
|
|
350
|
-
backgroundColor: '#ffffff',
|
|
351
|
-
paddingTop: 24,
|
|
352
|
-
paddingRight: 24,
|
|
353
|
-
paddingBottom: 24,
|
|
354
|
-
paddingLeft: 24,
|
|
355
|
-
},
|
|
356
|
-
button: {
|
|
357
|
-
backgroundColor: '#4f46e5',
|
|
358
|
-
color: '#ffffff',
|
|
359
|
-
},
|
|
360
|
-
link: {
|
|
361
|
-
color: '#2563eb',
|
|
362
|
-
},
|
|
363
|
-
font: {
|
|
364
|
-
fontFamily: 'Inter',
|
|
365
|
-
fallbackFontFamily: 'sans-serif',
|
|
366
|
-
webFont: {
|
|
367
|
-
format: 'woff2',
|
|
368
|
-
url: 'https://cdn.usemaily.com/fonts/v0/inter.woff2',
|
|
369
|
-
},
|
|
370
|
-
},
|
|
371
|
-
}}
|
|
372
|
-
>
|
|
373
|
-
...
|
|
374
|
-
</Editor.Root>
|
|
409
|
+
import { ThemeSettings } from '@maily-to/core';
|
|
410
|
+
|
|
411
|
+
<ThemeSettings.Root>
|
|
412
|
+
<ThemeSettings.Font />
|
|
413
|
+
<ThemeSettings.Layout />
|
|
414
|
+
<ThemeSettings.Button />
|
|
415
|
+
<ThemeSettings.Text />
|
|
416
|
+
</ThemeSettings.Root>;
|
|
375
417
|
```
|
|
376
418
|
|
|
419
|
+
The `setNodeTheme`, `updateNodeTheme`, and `updateShellTheme` commands do the
|
|
420
|
+
same work from your own UI.
|
|
421
|
+
|
|
377
422
|
## Text Direction
|
|
378
423
|
|
|
379
|
-
The editor supports LTR and RTL text directions.
|
|
424
|
+
The editor supports LTR and RTL text directions. Set the initial direction with
|
|
425
|
+
the `textDirection` prop on `Editor.Root`:
|
|
380
426
|
|
|
381
427
|
```tsx
|
|
382
|
-
|
|
383
|
-
<Editor.Root defaultTextDirection="ltr">
|
|
384
|
-
|
|
385
|
-
// Controlled
|
|
386
|
-
<Editor.Root
|
|
387
|
-
textDirection={direction}
|
|
388
|
-
onTextDirectionChange={setDirection}
|
|
389
|
-
>
|
|
428
|
+
<Editor.Root textDirection="rtl">
|
|
390
429
|
```
|
|
391
430
|
|
|
392
431
|
Use `Toolbar.Direction` to let users toggle direction from the toolbar.
|
|
393
432
|
|
|
394
433
|
## Entry Points
|
|
395
434
|
|
|
396
|
-
| Import path | Contents
|
|
397
|
-
| --------------------------- |
|
|
398
|
-
| `@maily-to/core` | `Editor`, `Toolbar`, `
|
|
399
|
-
| `@maily-to/core/blocks` | Pre-built slash command block items and types
|
|
400
|
-
| `@maily-to/core/extensions` | All Tiptap extensions and their option/storage types
|
|
401
|
-
| `@maily-to/core/style.css` |
|
|
435
|
+
| Import path | Contents |
|
|
436
|
+
| --------------------------- | -------------------------------------------------------------------------------------------- |
|
|
437
|
+
| `@maily-to/core` | `Editor`, `Toolbar`, `ThemeSettings`, bubble menus, headless UI primitives, hooks, and types |
|
|
438
|
+
| `@maily-to/core/blocks` | Pre-built slash command block items and types |
|
|
439
|
+
| `@maily-to/core/extensions` | All Tiptap extensions and their option/storage types |
|
|
440
|
+
| `@maily-to/core/style.css` | Optional stylesheet — the editor works without it and carries no Maily visual styles |
|
|
402
441
|
|
|
403
|
-
See the [@maily-to/render](../render) package for converting editor content to
|
|
442
|
+
See the [@maily-to/render](../render) package for converting editor content to
|
|
443
|
+
HTML email templates, and [@maily-to/migration](../migration) for loading v1
|
|
444
|
+
documents.
|
|
404
445
|
|
|
405
446
|
### Sponsors
|
|
406
447
|
|