@open-cloud-initiative/editor-x 0.0.1
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/.devcontainer/Dockerfile +13 -0
- package/.devcontainer/devcontainer.json +52 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/pages.yml +42 -0
- package/.github/workflows/publish.yml +41 -0
- package/.vscode/settings.json +7 -0
- package/LICENSE +9 -0
- package/README.md +9 -0
- package/app/_component/editor.tsx +383 -0
- package/app/layout.tsx +46 -0
- package/app/page.tsx +11 -0
- package/app/r/registry.json/route.ts +22 -0
- package/components/editorx/editor.tsx +1794 -0
- package/components/editorx/extensions/floating-menu.tsx +376 -0
- package/components/editorx/extensions/floating-toolbar.tsx +97 -0
- package/components/editorx/extensions/image-placeholder.tsx +316 -0
- package/components/editorx/extensions/image.tsx +462 -0
- package/components/editorx/extensions/search-and-replace.tsx +438 -0
- package/components/editorx/rich-text-editor.tsx +383 -0
- package/components/editorx/tiptap.css +421 -0
- package/components/editorx/toolbars/alignment.tsx +126 -0
- package/components/editorx/toolbars/blockquote.tsx +47 -0
- package/components/editorx/toolbars/bold.tsx +48 -0
- package/components/editorx/toolbars/bullet-list.tsx +48 -0
- package/components/editorx/toolbars/code-block.tsx +47 -0
- package/components/editorx/toolbars/code.tsx +43 -0
- package/components/editorx/toolbars/color-and-highlight.tsx +215 -0
- package/components/editorx/toolbars/editor-toolbar.tsx +77 -0
- package/components/editorx/toolbars/hard-break.tsx +46 -0
- package/components/editorx/toolbars/headings.tsx +97 -0
- package/components/editorx/toolbars/horizontal-rule.tsx +42 -0
- package/components/editorx/toolbars/image-placeholder-toolbar.tsx +47 -0
- package/components/editorx/toolbars/italic.tsx +48 -0
- package/components/editorx/toolbars/link.tsx +130 -0
- package/components/editorx/toolbars/mobile-toolbar-group.tsx +76 -0
- package/components/editorx/toolbars/ordered-list.tsx +47 -0
- package/components/editorx/toolbars/redo.tsx +44 -0
- package/components/editorx/toolbars/strikethrough.tsx +48 -0
- package/components/editorx/toolbars/toolbar-provider.tsx +29 -0
- package/components/editorx/toolbars/underline.tsx +48 -0
- package/components/editorx/toolbars/undo.tsx +43 -0
- package/components/layout/theme-switcher.tsx +26 -0
- package/components/main-nav.tsx +24 -0
- package/components/mobile-nav.tsx +46 -0
- package/components/open-in-v0-button.tsx +38 -0
- package/components/page-header.tsx +30 -0
- package/components/site-footer.tsx +41 -0
- package/components/site-header.tsx +32 -0
- package/components/theme-provider.tsx +8 -0
- package/components/ui/button.tsx +57 -0
- package/components/ui/checkbox.tsx +30 -0
- package/components/ui/collapsible.tsx +11 -0
- package/components/ui/command.tsx +148 -0
- package/components/ui/dialog.tsx +122 -0
- package/components/ui/drawer.tsx +118 -0
- package/components/ui/dropdown-menu.tsx +201 -0
- package/components/ui/input.tsx +22 -0
- package/components/ui/label.tsx +26 -0
- package/components/ui/popover.tsx +33 -0
- package/components/ui/resizable.tsx +40 -0
- package/components/ui/scroll-area.tsx +42 -0
- package/components/ui/separator.tsx +31 -0
- package/components/ui/sheet.tsx +140 -0
- package/components/ui/sidebar.tsx +763 -0
- package/components/ui/skeleton.tsx +15 -0
- package/components/ui/spinner.tsx +29 -0
- package/components/ui/tabs.tsx +55 -0
- package/components/ui/toggle-group.tsx +61 -0
- package/components/ui/toggle.tsx +45 -0
- package/components/ui/tooltip.tsx +32 -0
- package/components.json +21 -0
- package/config/site.ts +15 -0
- package/eslint.config.mjs +20 -0
- package/hooks/use-character-limit.ts +28 -0
- package/hooks/use-copy-to-clipboard.ts +16 -0
- package/hooks/use-debounce.ts +17 -0
- package/hooks/use-image-upload.ts +97 -0
- package/hooks/use-media-querry.ts +18 -0
- package/hooks/use-mobile.tsx +19 -0
- package/images/editor.png +0 -0
- package/lib/content.ts +39 -0
- package/lib/cookie-client.ts +19 -0
- package/lib/localstorage-client.ts +19 -0
- package/lib/package.ts +144 -0
- package/lib/preferences-config.ts +72 -0
- package/lib/preferences-storage.ts +20 -0
- package/lib/theme-utils.ts +12 -0
- package/lib/theme.ts +50 -0
- package/lib/tiptap-utils.ts +45 -0
- package/lib/utils.ts +11 -0
- package/next-env.d.ts +6 -0
- package/next.config.mjs +11 -0
- package/package.json +92 -0
- package/postcss.config.mjs +8 -0
- package/prettier.config.mjs +15 -0
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/next.svg +1 -0
- package/public/og.webp +0 -0
- package/public/r/editor-x.json +85 -0
- package/public/r/registry.json +93 -0
- package/public/site.webmanifest +19 -0
- package/public/vercel.svg +1 -0
- package/public/window.svg +1 -0
- package/registry/editor/components/editor.tsx +1794 -0
- package/registry/editor/components/extensions/floating-menu.tsx +376 -0
- package/registry/editor/components/extensions/floating-toolbar.tsx +97 -0
- package/registry/editor/components/extensions/image-placeholder.tsx +316 -0
- package/registry/editor/components/extensions/image.tsx +462 -0
- package/registry/editor/components/extensions/search-and-replace.tsx +438 -0
- package/registry/editor/components/rich-text-editor.tsx +383 -0
- package/registry/editor/components/tiptap.css +421 -0
- package/registry/editor/components/toolbars/alignment.tsx +126 -0
- package/registry/editor/components/toolbars/blockquote.tsx +47 -0
- package/registry/editor/components/toolbars/bold.tsx +48 -0
- package/registry/editor/components/toolbars/bullet-list.tsx +48 -0
- package/registry/editor/components/toolbars/code-block.tsx +47 -0
- package/registry/editor/components/toolbars/code.tsx +43 -0
- package/registry/editor/components/toolbars/color-and-highlight.tsx +215 -0
- package/registry/editor/components/toolbars/editor-toolbar.tsx +77 -0
- package/registry/editor/components/toolbars/hard-break.tsx +46 -0
- package/registry/editor/components/toolbars/headings.tsx +97 -0
- package/registry/editor/components/toolbars/horizontal-rule.tsx +42 -0
- package/registry/editor/components/toolbars/image-placeholder-toolbar.tsx +47 -0
- package/registry/editor/components/toolbars/italic.tsx +48 -0
- package/registry/editor/components/toolbars/link.tsx +130 -0
- package/registry/editor/components/toolbars/mobile-toolbar-group.tsx +76 -0
- package/registry/editor/components/toolbars/ordered-list.tsx +47 -0
- package/registry/editor/components/toolbars/redo.tsx +44 -0
- package/registry/editor/components/toolbars/strikethrough.tsx +48 -0
- package/registry/editor/components/toolbars/toolbar-provider.tsx +29 -0
- package/registry/editor/components/toolbars/underline.tsx +48 -0
- package/registry/editor/components/toolbars/undo.tsx +43 -0
- package/registry/editor/components/ui/button.tsx +57 -0
- package/registry/editor/components/ui/checkbox.tsx +30 -0
- package/registry/editor/components/ui/collapsible.tsx +11 -0
- package/registry/editor/components/ui/command.tsx +148 -0
- package/registry/editor/components/ui/dialog.tsx +122 -0
- package/registry/editor/components/ui/drawer.tsx +118 -0
- package/registry/editor/components/ui/dropdown-menu.tsx +201 -0
- package/registry/editor/components/ui/input.tsx +22 -0
- package/registry/editor/components/ui/label.tsx +26 -0
- package/registry/editor/components/ui/popover.tsx +33 -0
- package/registry/editor/components/ui/resizable.tsx +40 -0
- package/registry/editor/components/ui/scroll-area.tsx +42 -0
- package/registry/editor/components/ui/separator.tsx +31 -0
- package/registry/editor/components/ui/sheet.tsx +140 -0
- package/registry/editor/components/ui/sidebar.tsx +763 -0
- package/registry/editor/components/ui/skeleton.tsx +15 -0
- package/registry/editor/components/ui/spinner.tsx +29 -0
- package/registry/editor/components/ui/tabs.tsx +55 -0
- package/registry/editor/components/ui/toggle-group.tsx +61 -0
- package/registry/editor/components/ui/toggle.tsx +45 -0
- package/registry/editor/components/ui/tooltip.tsx +32 -0
- package/registry/editor/hooks/use-character-limit.ts +28 -0
- package/registry/editor/hooks/use-copy-to-clipboard.ts +16 -0
- package/registry/editor/hooks/use-debounce.ts +17 -0
- package/registry/editor/hooks/use-image-upload.ts +97 -0
- package/registry/editor/hooks/use-media-querry.ts +18 -0
- package/registry/editor/hooks/use-mobile.tsx +19 -0
- package/registry/editor/lib/content.ts +39 -0
- package/registry/editor/lib/cookie-client.ts +19 -0
- package/registry/editor/lib/localstorage-client.ts +19 -0
- package/registry/editor/lib/package.ts +144 -0
- package/registry/editor/lib/preferences-config.ts +72 -0
- package/registry/editor/lib/preferences-storage.ts +20 -0
- package/registry/editor/lib/theme-utils.ts +12 -0
- package/registry/editor/lib/theme.ts +50 -0
- package/registry/editor/lib/tiptap-utils.ts +45 -0
- package/registry/editor/lib/utils.ts +11 -0
- package/registry/editor/page.tsx +9 -0
- package/registry.json +93 -0
- package/reset.d.ts +1 -0
- package/scripts/generate-theme-presets.ts +128 -0
- package/scripts/postCreateCommand.sh +0 -0
- package/scripts/theme-boot.tsx +105 -0
- package/server/server-actions.ts +27 -0
- package/stores/preferences/preferences-provider.tsx +55 -0
- package/stores/preferences/preferences-store.ts +23 -0
- package/styles/globals.css +288 -0
- package/styles/presets/brutalist.css +89 -0
- package/styles/presets/soft-pop.css +89 -0
- package/styles/presets/tangerine.css +89 -0
- package/tsconfig.json +50 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import type { Editor, JSONContent } from '@/components/editorx/editor'
|
|
4
|
+
import {
|
|
5
|
+
EditorBubbleMenu,
|
|
6
|
+
EditorCharacterCount,
|
|
7
|
+
EditorClearFormatting,
|
|
8
|
+
EditorFormatBold,
|
|
9
|
+
EditorFormatCode,
|
|
10
|
+
EditorFormatItalic,
|
|
11
|
+
EditorFormatStrike,
|
|
12
|
+
EditorFormatSubscript,
|
|
13
|
+
EditorFormatSuperscript,
|
|
14
|
+
EditorFormatUnderline,
|
|
15
|
+
EditorLinkSelector,
|
|
16
|
+
EditorNodeBulletList,
|
|
17
|
+
EditorNodeCode,
|
|
18
|
+
EditorNodeHeading1,
|
|
19
|
+
EditorNodeHeading2,
|
|
20
|
+
EditorNodeHeading3,
|
|
21
|
+
EditorNodeOrderedList,
|
|
22
|
+
EditorNodeQuote,
|
|
23
|
+
EditorNodeTaskList,
|
|
24
|
+
EditorNodeText,
|
|
25
|
+
EditorProvider,
|
|
26
|
+
EditorSelector,
|
|
27
|
+
EditorTableColumnAfter,
|
|
28
|
+
EditorTableColumnBefore,
|
|
29
|
+
EditorTableColumnDelete,
|
|
30
|
+
EditorTableColumnMenu,
|
|
31
|
+
EditorTableDelete,
|
|
32
|
+
EditorTableFix,
|
|
33
|
+
EditorTableGlobalMenu,
|
|
34
|
+
EditorTableHeaderColumnToggle,
|
|
35
|
+
EditorTableHeaderRowToggle,
|
|
36
|
+
EditorTableMenu,
|
|
37
|
+
EditorTableMergeCells,
|
|
38
|
+
EditorTableRowAfter,
|
|
39
|
+
EditorTableRowBefore,
|
|
40
|
+
EditorTableRowDelete,
|
|
41
|
+
EditorTableRowMenu,
|
|
42
|
+
EditorTableSplitCell,
|
|
43
|
+
} from '@/components/editorx/editor'
|
|
44
|
+
import { EditorToolbar } from '@/components/editorx/toolbars/editor-toolbar'
|
|
45
|
+
import Highlight from '@tiptap/extension-highlight'
|
|
46
|
+
import { useState } from 'react'
|
|
47
|
+
|
|
48
|
+
export default function ExampleEditor() {
|
|
49
|
+
const [content, setContent] = useState<JSONContent>({
|
|
50
|
+
type: 'doc',
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: 'heading',
|
|
54
|
+
attrs: { level: 1 },
|
|
55
|
+
content: [{ type: 'text', text: 'Heading 1' }],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'heading',
|
|
59
|
+
attrs: { level: 2 },
|
|
60
|
+
content: [{ type: 'text', text: 'Heading 2' }],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'heading',
|
|
64
|
+
attrs: { level: 3 },
|
|
65
|
+
content: [{ type: 'text', text: 'Heading 3' }],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'heading',
|
|
69
|
+
attrs: { level: 4 },
|
|
70
|
+
content: [{ type: 'text', text: 'Heading 4' }],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'heading',
|
|
74
|
+
attrs: { level: 5 },
|
|
75
|
+
content: [{ type: 'text', text: 'Heading 5' }],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'heading',
|
|
79
|
+
attrs: { level: 6 },
|
|
80
|
+
content: [{ type: 'text', text: 'Heading 6' }],
|
|
81
|
+
},
|
|
82
|
+
{ type: 'paragraph' },
|
|
83
|
+
{ type: 'paragraph', content: [{ type: 'text', text: 'Hello, world.' }] },
|
|
84
|
+
{ type: 'paragraph' },
|
|
85
|
+
{
|
|
86
|
+
type: 'taskList',
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: 'taskItem',
|
|
90
|
+
attrs: { checked: false },
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'paragraph',
|
|
94
|
+
content: [{ type: 'text', text: 'This is a todo list' }],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'taskItem',
|
|
100
|
+
attrs: { checked: false },
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: 'paragraph',
|
|
104
|
+
content: [{ type: 'text', text: 'With two items' }],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{ type: 'paragraph' },
|
|
111
|
+
{
|
|
112
|
+
type: 'bulletList',
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: 'listItem',
|
|
116
|
+
content: [
|
|
117
|
+
{
|
|
118
|
+
type: 'paragraph',
|
|
119
|
+
content: [{ type: 'text', text: 'This is an unordered list' }],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'bulletList',
|
|
123
|
+
content: [
|
|
124
|
+
{
|
|
125
|
+
type: 'listItem',
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: 'paragraph',
|
|
129
|
+
content: [{ type: 'text', text: 'With a nested item' }],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{ type: 'paragraph' },
|
|
140
|
+
{
|
|
141
|
+
type: 'orderedList',
|
|
142
|
+
attrs: { start: 1 },
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: 'listItem',
|
|
146
|
+
content: [
|
|
147
|
+
{
|
|
148
|
+
type: 'paragraph',
|
|
149
|
+
content: [{ type: 'text', text: 'This is an ordered list' }],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'listItem',
|
|
155
|
+
content: [
|
|
156
|
+
{
|
|
157
|
+
type: 'paragraph',
|
|
158
|
+
content: [{ type: 'text', text: 'With two items' }],
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
{ type: 'paragraph' },
|
|
165
|
+
{
|
|
166
|
+
type: 'blockquote',
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: 'paragraph',
|
|
170
|
+
content: [
|
|
171
|
+
{
|
|
172
|
+
type: 'text',
|
|
173
|
+
text: 'This is a quote, probably by someone famous.',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
{ type: 'paragraph' },
|
|
180
|
+
{
|
|
181
|
+
type: 'paragraph',
|
|
182
|
+
content: [
|
|
183
|
+
{ type: 'text', text: 'This is some ' },
|
|
184
|
+
{ type: 'text', marks: [{ type: 'code' }], text: 'inline code' },
|
|
185
|
+
{ type: 'text', text: ', while this is a code block:' },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
{ type: 'paragraph' },
|
|
189
|
+
{
|
|
190
|
+
type: 'codeBlock',
|
|
191
|
+
attrs: { language: null },
|
|
192
|
+
content: [
|
|
193
|
+
{
|
|
194
|
+
type: 'text',
|
|
195
|
+
text: "function x () {\\n console.log('hello, world.');\\n}",
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
{ type: 'paragraph' },
|
|
200
|
+
{
|
|
201
|
+
type: 'paragraph',
|
|
202
|
+
content: [
|
|
203
|
+
{
|
|
204
|
+
type: 'text',
|
|
205
|
+
text: 'You can also create complex tables, like so:',
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'table',
|
|
211
|
+
content: [
|
|
212
|
+
{
|
|
213
|
+
type: 'tableRow',
|
|
214
|
+
content: [
|
|
215
|
+
{
|
|
216
|
+
type: 'tableHeader',
|
|
217
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
218
|
+
content: [
|
|
219
|
+
{
|
|
220
|
+
type: 'paragraph',
|
|
221
|
+
content: [{ type: 'text', text: 'Here’s a column' }],
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: 'tableHeader',
|
|
227
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
228
|
+
content: [
|
|
229
|
+
{
|
|
230
|
+
type: 'paragraph',
|
|
231
|
+
content: [{ type: 'text', text: 'Another column' }],
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: 'tableHeader',
|
|
237
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: 'paragraph',
|
|
241
|
+
content: [{ type: 'text', text: 'Yet another' }],
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: 'tableRow',
|
|
249
|
+
content: [
|
|
250
|
+
{
|
|
251
|
+
type: 'tableCell',
|
|
252
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
253
|
+
content: [
|
|
254
|
+
{
|
|
255
|
+
type: 'paragraph',
|
|
256
|
+
content: [{ type: 'text', text: 'Cell 1A' }],
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
type: 'tableCell',
|
|
262
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
263
|
+
content: [
|
|
264
|
+
{
|
|
265
|
+
type: 'paragraph',
|
|
266
|
+
content: [{ type: 'text', text: 'Cell 2A' }],
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
type: 'tableCell',
|
|
272
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
273
|
+
content: [
|
|
274
|
+
{
|
|
275
|
+
type: 'paragraph',
|
|
276
|
+
content: [{ type: 'text', text: 'Cell 3A' }],
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: 'tableRow',
|
|
284
|
+
content: [
|
|
285
|
+
{
|
|
286
|
+
type: 'tableCell',
|
|
287
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: 'paragraph',
|
|
291
|
+
content: [{ type: 'text', text: 'Cell 1B' }],
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
type: 'tableCell',
|
|
297
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
298
|
+
content: [
|
|
299
|
+
{
|
|
300
|
+
type: 'paragraph',
|
|
301
|
+
content: [{ type: 'text', text: 'Cell 2B' }],
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
type: 'tableCell',
|
|
307
|
+
attrs: { colspan: 1, rowspan: 1, colwidth: null },
|
|
308
|
+
content: [
|
|
309
|
+
{
|
|
310
|
+
type: 'paragraph',
|
|
311
|
+
content: [{ type: 'text', text: 'Cell 3B' }],
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
})
|
|
321
|
+
const handleUpdate = ({ editor }: { editor: Editor }) => {
|
|
322
|
+
const json = editor.getJSON()
|
|
323
|
+
setContent(json)
|
|
324
|
+
console.log(JSON.stringify(json))
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return (
|
|
328
|
+
<EditorProvider
|
|
329
|
+
className="h-full w-full overflow-y-auto rounded-lg border bg-background p-4"
|
|
330
|
+
content={content}
|
|
331
|
+
onUpdate={handleUpdate}
|
|
332
|
+
placeholder="Start typing..."
|
|
333
|
+
extensions={[Highlight]}
|
|
334
|
+
slotBefore={<EditorToolbar />}
|
|
335
|
+
>
|
|
336
|
+
<EditorBubbleMenu>
|
|
337
|
+
<EditorSelector title="Text">
|
|
338
|
+
<EditorNodeText />
|
|
339
|
+
<EditorNodeHeading1 />
|
|
340
|
+
<EditorNodeHeading2 />
|
|
341
|
+
<EditorNodeHeading3 />
|
|
342
|
+
<EditorNodeBulletList />
|
|
343
|
+
<EditorNodeOrderedList />
|
|
344
|
+
<EditorNodeTaskList />
|
|
345
|
+
<EditorNodeQuote />
|
|
346
|
+
<EditorNodeCode />
|
|
347
|
+
</EditorSelector>
|
|
348
|
+
<EditorSelector title="Format">
|
|
349
|
+
<EditorFormatBold />
|
|
350
|
+
<EditorFormatItalic />
|
|
351
|
+
<EditorFormatUnderline />
|
|
352
|
+
<EditorFormatStrike />
|
|
353
|
+
<EditorFormatCode />
|
|
354
|
+
<EditorFormatSuperscript />
|
|
355
|
+
<EditorFormatSubscript />
|
|
356
|
+
</EditorSelector>
|
|
357
|
+
<EditorLinkSelector />
|
|
358
|
+
<EditorClearFormatting />
|
|
359
|
+
</EditorBubbleMenu>
|
|
360
|
+
<EditorTableMenu>
|
|
361
|
+
<EditorTableColumnMenu>
|
|
362
|
+
<EditorTableColumnBefore />
|
|
363
|
+
<EditorTableColumnAfter />
|
|
364
|
+
<EditorTableColumnDelete />
|
|
365
|
+
</EditorTableColumnMenu>
|
|
366
|
+
<EditorTableRowMenu>
|
|
367
|
+
<EditorTableRowBefore />
|
|
368
|
+
<EditorTableRowAfter />
|
|
369
|
+
<EditorTableRowDelete />
|
|
370
|
+
</EditorTableRowMenu>
|
|
371
|
+
<EditorTableGlobalMenu>
|
|
372
|
+
<EditorTableHeaderColumnToggle />
|
|
373
|
+
<EditorTableHeaderRowToggle />
|
|
374
|
+
<EditorTableDelete />
|
|
375
|
+
<EditorTableMergeCells />
|
|
376
|
+
<EditorTableSplitCell />
|
|
377
|
+
<EditorTableFix />
|
|
378
|
+
</EditorTableGlobalMenu>
|
|
379
|
+
</EditorTableMenu>
|
|
380
|
+
<EditorCharacterCount.Words>Words: </EditorCharacterCount.Words>
|
|
381
|
+
</EditorProvider>
|
|
382
|
+
)
|
|
383
|
+
}
|