@vonaffenfels/slate-editor 1.1.71 → 1.2.10

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.
Files changed (96) hide show
  1. package/.babelrc +43 -43
  2. package/README.md +5 -5
  3. package/componentLoader.js +93 -93
  4. package/dist/BlockEditor.css +4 -1871
  5. package/dist/BlockEditor.js +336 -3960
  6. package/dist/BlockEditor.js.LICENSE.txt +61 -0
  7. package/dist/Renderer.js +2 -2081
  8. package/dist/Renderer.js.LICENSE.txt +15 -0
  9. package/dist/fromHTML.js +1 -78
  10. package/dist/index.css +4 -1871
  11. package/dist/index.js +336 -4037
  12. package/dist/index.js.LICENSE.txt +69 -0
  13. package/dist/toHTML.js +2 -1689
  14. package/dist/toHTML.js.LICENSE.txt +23 -0
  15. package/dist/toText.js +2 -1689
  16. package/dist/toText.js.LICENSE.txt +23 -0
  17. package/package.json +2 -2
  18. package/postcss.config.js +6 -6
  19. package/scss/demo.scss +148 -148
  20. package/scss/editor.scss +17 -5
  21. package/scss/sidebarEditor.scss +185 -181
  22. package/scss/toolbar.scss +161 -161
  23. package/src/BlockEditor.js +6 -3
  24. package/src/Blocks/EmptyBlock.js +11 -11
  25. package/src/Blocks/EmptyWrapper.js +4 -4
  26. package/src/Blocks/ErrorBoundary.js +40 -40
  27. package/src/Blocks/LayoutBlock.js +274 -274
  28. package/src/Blocks/LayoutSlot.js +90 -90
  29. package/src/CollapsableMenu/CollapsableMenu.js +48 -48
  30. package/src/Context/StorybookContext.js +6 -6
  31. package/src/ElementAutocomplete.js +133 -133
  32. package/src/Loader.js +137 -137
  33. package/src/Nodes/Default.js +158 -158
  34. package/src/Nodes/Leaf.js +54 -54
  35. package/src/Nodes/Text.js +97 -97
  36. package/src/ObjectId.js +3 -3
  37. package/src/Renderer.js +73 -73
  38. package/src/Serializer/Html.js +42 -42
  39. package/src/Serializer/Serializer.js +371 -371
  40. package/src/Serializer/Text.js +17 -17
  41. package/src/Serializer/ads.js +174 -174
  42. package/src/Serializer/index.js +3 -3
  43. package/src/SidebarEditor/AssetList.js +181 -181
  44. package/src/SidebarEditor/Fields/CloudinaryContentSelect.js +89 -89
  45. package/src/SidebarEditor/Fields/ColorPicker.js +89 -89
  46. package/src/SidebarEditor/Fields/ContentfulContentSelect.js +62 -62
  47. package/src/SidebarEditor/Fields/DateTime.js +55 -55
  48. package/src/SidebarEditor/Fields/MVP.js +66 -66
  49. package/src/SidebarEditor/Fields/MultiSelect.js +13 -13
  50. package/src/SidebarEditor/Fields/RemoteMultiSelect.js +40 -40
  51. package/src/SidebarEditor/Fields/RemoteSelect.js +39 -39
  52. package/src/SidebarEditor/Fields/Select.js +47 -47
  53. package/src/SidebarEditor/Fields/StreamSelect.js +15 -15
  54. package/src/SidebarEditor/Fields/Switch.js +34 -34
  55. package/src/SidebarEditor/Fields/Textarea.js +21 -21
  56. package/src/SidebarEditor/Resizable.js +85 -85
  57. package/src/Storybook.js +151 -151
  58. package/src/Toolbar/Align.js +64 -64
  59. package/src/Toolbar/Anchor.js +94 -94
  60. package/src/Toolbar/Block.js +135 -135
  61. package/src/Toolbar/Element.js +44 -44
  62. package/src/Toolbar/Formats.js +71 -71
  63. package/src/Toolbar/Insert.js +28 -28
  64. package/src/Toolbar/Layout.js +399 -399
  65. package/src/Toolbar/Link.js +164 -164
  66. package/src/Toolbar/Toolbar.js +235 -235
  67. package/src/Tools/Margin.js +51 -51
  68. package/src/Translation/TranslationToolbarButton.js +119 -115
  69. package/src/dev/draftToSlate.json +3147 -3147
  70. package/src/dev/index.css +2 -2
  71. package/src/dev/index.html +10 -10
  72. package/src/dev/index.js +4 -4
  73. package/src/dev/sampleValue1.json +4294 -4294
  74. package/src/dev/sampleValueValid.json +410 -410
  75. package/src/dev/testComponents/TestStory.js +74 -74
  76. package/src/dev/testComponents/TestStory.stories.js +216 -216
  77. package/src/dev/testComponents/TestStory2.js +74 -74
  78. package/src/dev/testComponents/TestStory2.stories.js +197 -197
  79. package/src/dev/testComponents/TestStory3.js +74 -74
  80. package/src/dev/testComponents/TestStory3.stories.js +197 -197
  81. package/src/dev/testSampleValue.json +746 -746
  82. package/src/fromHTML.js +4 -4
  83. package/src/helper/array.js +8 -8
  84. package/src/index.js +10 -10
  85. package/src/plugins/ListItem.js +48 -48
  86. package/src/plugins/SoftBreak.js +23 -23
  87. package/src/toHTML.js +6 -6
  88. package/src/toText.js +6 -6
  89. package/src/util/reduceContentfulResponse.js +64 -64
  90. package/src/util.js +19 -19
  91. package/storyLoader.js +47 -47
  92. package/tailwind.config.js +4 -4
  93. package/webpack.config.build.js +55 -55
  94. package/webpack.config.dev.js +60 -60
  95. package/webpack.config.js +130 -130
  96. package/webpack.config.watch.js +4 -4
@@ -1,400 +1,400 @@
1
- import {useSlate} from "slate-react";
2
- import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
3
- import React from "react";
4
- import {Transforms} from "slate";
5
- import classNames from "classnames";
6
-
7
-
8
- export const InsertGridButton = () => {
9
- return <span
10
- className={
11
- classNames({"toolbar-btn-expand": true})
12
- }
13
- >
14
- <div className="toolbar-btn-expand-inner">
15
- <span className="toolbar-btn">Grid hinzufügen</span>
16
- <InsertLayoutButton insert={{
17
- "type": "layout",
18
- "children": [
19
- {
20
- "type": "layout-slot",
21
- "attributes": {"name": "grid-1"},
22
- "children": [
23
- {
24
- "type": "paragraph",
25
- "children": [
26
- {"text": ""},
27
- ],
28
- },
29
- ],
30
- },
31
- {
32
- "type": "layout-slot",
33
- "attributes": {"name": "grid-2"},
34
- "children": [
35
- {
36
- "type": "paragraph",
37
- "children": [
38
- {"text": ""},
39
- ],
40
- },
41
- ],
42
- },
43
- ],
44
- }}>
45
- <span>1 | 2</span>
46
- </InsertLayoutButton>
47
- <InsertLayoutButton insert={{
48
- "type": "layout",
49
- "children": [
50
- {
51
- "type": "layout-slot",
52
- "attributes": {"name": "grid-2"},
53
- "children": [
54
- {
55
- "type": "paragraph",
56
- "children": [
57
- {"text": ""},
58
- ],
59
- },
60
- ],
61
- },
62
- {
63
- "type": "layout-slot",
64
- "attributes": {"name": "grid-1"},
65
- "children": [
66
- {
67
- "type": "paragraph",
68
- "children": [
69
- {"text": ""},
70
- ],
71
- },
72
- ],
73
- },
74
- ],
75
- }}>
76
- <span>2 | 1</span>
77
- </InsertLayoutButton>
78
- <InsertLayoutButton insert={{
79
- "type": "layout",
80
- "children": [
81
- {
82
- "type": "layout-slot",
83
- "attributes": {"name": "grid-half"},
84
- "children": [
85
- {
86
- "type": "paragraph",
87
- "children": [
88
- {"text": ""},
89
- ],
90
- },
91
- ],
92
- },
93
- {
94
- "type": "layout-slot",
95
- "attributes": {"name": "grid-half"},
96
- "children": [
97
- {
98
- "type": "paragraph",
99
- "children": [
100
- {"text": ""},
101
- ],
102
- },
103
- ],
104
- },
105
- ],
106
- }}>
107
- <span>1 | 1 </span>
108
- </InsertLayoutButton>
109
- <InsertLayoutButton insert={{
110
- "type": "layout",
111
- "children": [
112
- {
113
- "type": "layout-slot",
114
- "attributes": {"name": "grid-1"},
115
- "children": [
116
- {
117
- "type": "paragraph",
118
- "children": [
119
- {"text": ""},
120
- ],
121
- },
122
- ],
123
- },
124
- {
125
- "type": "layout-slot",
126
- "attributes": {"name": "grid-1"},
127
- "children": [
128
- {
129
- "type": "paragraph",
130
- "children": [
131
- {"text": ""},
132
- ],
133
- },
134
- ],
135
- },
136
- {
137
- "type": "layout-slot",
138
- "attributes": {"name": "grid-1"},
139
- "children": [
140
- {
141
- "type": "paragraph",
142
- "children": [
143
- {"text": ""},
144
- ],
145
- },
146
- ],
147
- },
148
- ],
149
- }}>
150
- <span>1 | 1 | 1</span>
151
- </InsertLayoutButton>
152
- <InsertLayoutButton insert={{
153
- "type": "layout",
154
- "children": [
155
- {
156
- "type": "layout-slot",
157
- "attributes": {"name": "grid-1"},
158
- "children": [
159
- {
160
- "type": "paragraph",
161
- "children": [
162
- {"text": ""},
163
- ],
164
- },
165
- ],
166
- },
167
- {
168
- "type": "layout-slot",
169
- "attributes": {"name": "grid-1"},
170
- "children": [
171
- {
172
- "type": "paragraph",
173
- "children": [
174
- {"text": ""},
175
- ],
176
- },
177
- ],
178
- },
179
- {
180
- "type": "layout-slot",
181
- "attributes": {"name": "grid-1"},
182
- "children": [
183
- {
184
- "type": "paragraph",
185
- "children": [
186
- {"text": ""},
187
- ],
188
- },
189
- ],
190
- },
191
- {
192
- "type": "layout-slot",
193
- "attributes": {"name": "grid-1"},
194
- "children": [
195
- {
196
- "type": "paragraph",
197
- "children": [
198
- {"text": ""},
199
- ],
200
- },
201
- ],
202
- },
203
- ],
204
- }}>
205
- <span>1 | 1 | 1 | 1</span>
206
- </InsertLayoutButton>
207
- <InsertLayoutButton insert={{
208
- "type": "layout",
209
- "children": [
210
- {
211
- "type": "layout-slot",
212
- "attributes": {"name": "grid-1"},
213
- "children": [
214
- {
215
- "type": "paragraph",
216
- "children": [
217
- {"text": ""},
218
- ],
219
- },
220
- ],
221
- },
222
- {
223
- "type": "layout-slot",
224
- "attributes": {"name": "grid-1"},
225
- "children": [
226
- {
227
- "type": "paragraph",
228
- "children": [
229
- {"text": ""},
230
- ],
231
- },
232
- ],
233
- },
234
- {
235
- "type": "layout-slot",
236
- "attributes": {"name": "grid-1"},
237
- "children": [
238
- {
239
- "type": "paragraph",
240
- "children": [
241
- {"text": ""},
242
- ],
243
- },
244
- ],
245
- },
246
- {
247
- "type": "layout-slot",
248
- "attributes": {"name": "grid-1"},
249
- "children": [
250
- {
251
- "type": "paragraph",
252
- "children": [
253
- {"text": ""},
254
- ],
255
- },
256
- ],
257
- },
258
- {
259
- "type": "layout-slot",
260
- "attributes": {"name": "grid-1"},
261
- "children": [
262
- {
263
- "type": "paragraph",
264
- "children": [
265
- {"text": ""},
266
- ],
267
- },
268
- ],
269
- },
270
- ],
271
- }}>
272
- <span>1 | 1 | 1 | 1 | 1</span>
273
- </InsertLayoutButton>
274
- <InsertLayoutButton insert={{
275
- "type": "layout",
276
- "children": [
277
- {
278
- "type": "layout-slot",
279
- "attributes": {"name": "grid-auto"},
280
- "children": [
281
- {
282
- "type": "paragraph",
283
- "children": [
284
- {"text": ""},
285
- ],
286
- },
287
- ],
288
- },
289
- {
290
- "type": "layout-slot",
291
- "attributes": {"name": "grid-fill"},
292
- "children": [
293
- {
294
- "type": "paragraph",
295
- "children": [
296
- {"text": ""},
297
- ],
298
- },
299
- ],
300
- },
301
- ],
302
- }}>
303
- <span>auto | fill</span>
304
- </InsertLayoutButton>
305
- <InsertLayoutButton insert={{
306
- "type": "layout",
307
- "children": [
308
- {
309
- "type": "layout-slot",
310
- "attributes": {"name": "grid-fill"},
311
- "children": [
312
- {
313
- "type": "paragraph",
314
- "children": [
315
- {"text": ""},
316
- ],
317
- },
318
- ],
319
- },
320
- {
321
- "type": "layout-slot",
322
- "attributes": {"name": "grid-auto"},
323
- "children": [
324
- {
325
- "type": "paragraph",
326
- "children": [
327
- {"text": ""},
328
- ],
329
- },
330
- ],
331
- },
332
- ],
333
- }}>
334
- <span>fill | auto</span>
335
- </InsertLayoutButton>
336
- <InsertLayoutButton insert={{
337
- "type": "layout",
338
- "children": [
339
- {
340
- "type": "layout-slot",
341
- "attributes": {"name": "grid-auto"},
342
- "children": [
343
- {
344
- "type": "paragraph",
345
- "children": [
346
- {"text": ""},
347
- ],
348
- },
349
- ],
350
- },
351
- {
352
- "type": "layout-slot",
353
- "attributes": {"name": "grid-fill"},
354
- "children": [
355
- {
356
- "type": "paragraph",
357
- "children": [
358
- {"text": ""},
359
- ],
360
- },
361
- ],
362
- },
363
- {
364
- "type": "layout-slot",
365
- "attributes": {"name": "grid-auto"},
366
- "children": [
367
- {
368
- "type": "paragraph",
369
- "children": [
370
- {"text": ""},
371
- ],
372
- },
373
- ],
374
- },
375
- ],
376
- }}>
377
- <span>auto | fill | auto</span>
378
- </InsertLayoutButton>
379
- </div>
380
- </span>;
381
- };
382
-
383
- export const InsertLayoutButton = ({
384
- insert,
385
- icon,
386
- children,
387
- }) => {
388
- const editor = useSlate();
389
- const onClick = (event) => {
390
- event.preventDefault();
391
- Transforms.insertNodes(editor, [insert]);
392
- };
393
-
394
- return (
395
- <span onMouseDown={onClick} className="toolbar-btn">
396
- {!!icon && <FontAwesomeIcon icon={icon} />}
397
- {children}
398
- </span>
399
- );
1
+ import {useSlate} from "slate-react";
2
+ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
3
+ import React from "react";
4
+ import {Transforms} from "slate";
5
+ import classNames from "classnames";
6
+
7
+
8
+ export const InsertGridButton = () => {
9
+ return <span
10
+ className={
11
+ classNames({"toolbar-btn-expand": true})
12
+ }
13
+ >
14
+ <div className="toolbar-btn-expand-inner">
15
+ <span className="toolbar-btn">Grid hinzufügen</span>
16
+ <InsertLayoutButton insert={{
17
+ "type": "layout",
18
+ "children": [
19
+ {
20
+ "type": "layout-slot",
21
+ "attributes": {"name": "grid-1"},
22
+ "children": [
23
+ {
24
+ "type": "paragraph",
25
+ "children": [
26
+ {"text": ""},
27
+ ],
28
+ },
29
+ ],
30
+ },
31
+ {
32
+ "type": "layout-slot",
33
+ "attributes": {"name": "grid-2"},
34
+ "children": [
35
+ {
36
+ "type": "paragraph",
37
+ "children": [
38
+ {"text": ""},
39
+ ],
40
+ },
41
+ ],
42
+ },
43
+ ],
44
+ }}>
45
+ <span>1 | 2</span>
46
+ </InsertLayoutButton>
47
+ <InsertLayoutButton insert={{
48
+ "type": "layout",
49
+ "children": [
50
+ {
51
+ "type": "layout-slot",
52
+ "attributes": {"name": "grid-2"},
53
+ "children": [
54
+ {
55
+ "type": "paragraph",
56
+ "children": [
57
+ {"text": ""},
58
+ ],
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ "type": "layout-slot",
64
+ "attributes": {"name": "grid-1"},
65
+ "children": [
66
+ {
67
+ "type": "paragraph",
68
+ "children": [
69
+ {"text": ""},
70
+ ],
71
+ },
72
+ ],
73
+ },
74
+ ],
75
+ }}>
76
+ <span>2 | 1</span>
77
+ </InsertLayoutButton>
78
+ <InsertLayoutButton insert={{
79
+ "type": "layout",
80
+ "children": [
81
+ {
82
+ "type": "layout-slot",
83
+ "attributes": {"name": "grid-half"},
84
+ "children": [
85
+ {
86
+ "type": "paragraph",
87
+ "children": [
88
+ {"text": ""},
89
+ ],
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ "type": "layout-slot",
95
+ "attributes": {"name": "grid-half"},
96
+ "children": [
97
+ {
98
+ "type": "paragraph",
99
+ "children": [
100
+ {"text": ""},
101
+ ],
102
+ },
103
+ ],
104
+ },
105
+ ],
106
+ }}>
107
+ <span>1 | 1 </span>
108
+ </InsertLayoutButton>
109
+ <InsertLayoutButton insert={{
110
+ "type": "layout",
111
+ "children": [
112
+ {
113
+ "type": "layout-slot",
114
+ "attributes": {"name": "grid-1"},
115
+ "children": [
116
+ {
117
+ "type": "paragraph",
118
+ "children": [
119
+ {"text": ""},
120
+ ],
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ "type": "layout-slot",
126
+ "attributes": {"name": "grid-1"},
127
+ "children": [
128
+ {
129
+ "type": "paragraph",
130
+ "children": [
131
+ {"text": ""},
132
+ ],
133
+ },
134
+ ],
135
+ },
136
+ {
137
+ "type": "layout-slot",
138
+ "attributes": {"name": "grid-1"},
139
+ "children": [
140
+ {
141
+ "type": "paragraph",
142
+ "children": [
143
+ {"text": ""},
144
+ ],
145
+ },
146
+ ],
147
+ },
148
+ ],
149
+ }}>
150
+ <span>1 | 1 | 1</span>
151
+ </InsertLayoutButton>
152
+ <InsertLayoutButton insert={{
153
+ "type": "layout",
154
+ "children": [
155
+ {
156
+ "type": "layout-slot",
157
+ "attributes": {"name": "grid-1"},
158
+ "children": [
159
+ {
160
+ "type": "paragraph",
161
+ "children": [
162
+ {"text": ""},
163
+ ],
164
+ },
165
+ ],
166
+ },
167
+ {
168
+ "type": "layout-slot",
169
+ "attributes": {"name": "grid-1"},
170
+ "children": [
171
+ {
172
+ "type": "paragraph",
173
+ "children": [
174
+ {"text": ""},
175
+ ],
176
+ },
177
+ ],
178
+ },
179
+ {
180
+ "type": "layout-slot",
181
+ "attributes": {"name": "grid-1"},
182
+ "children": [
183
+ {
184
+ "type": "paragraph",
185
+ "children": [
186
+ {"text": ""},
187
+ ],
188
+ },
189
+ ],
190
+ },
191
+ {
192
+ "type": "layout-slot",
193
+ "attributes": {"name": "grid-1"},
194
+ "children": [
195
+ {
196
+ "type": "paragraph",
197
+ "children": [
198
+ {"text": ""},
199
+ ],
200
+ },
201
+ ],
202
+ },
203
+ ],
204
+ }}>
205
+ <span>1 | 1 | 1 | 1</span>
206
+ </InsertLayoutButton>
207
+ <InsertLayoutButton insert={{
208
+ "type": "layout",
209
+ "children": [
210
+ {
211
+ "type": "layout-slot",
212
+ "attributes": {"name": "grid-1"},
213
+ "children": [
214
+ {
215
+ "type": "paragraph",
216
+ "children": [
217
+ {"text": ""},
218
+ ],
219
+ },
220
+ ],
221
+ },
222
+ {
223
+ "type": "layout-slot",
224
+ "attributes": {"name": "grid-1"},
225
+ "children": [
226
+ {
227
+ "type": "paragraph",
228
+ "children": [
229
+ {"text": ""},
230
+ ],
231
+ },
232
+ ],
233
+ },
234
+ {
235
+ "type": "layout-slot",
236
+ "attributes": {"name": "grid-1"},
237
+ "children": [
238
+ {
239
+ "type": "paragraph",
240
+ "children": [
241
+ {"text": ""},
242
+ ],
243
+ },
244
+ ],
245
+ },
246
+ {
247
+ "type": "layout-slot",
248
+ "attributes": {"name": "grid-1"},
249
+ "children": [
250
+ {
251
+ "type": "paragraph",
252
+ "children": [
253
+ {"text": ""},
254
+ ],
255
+ },
256
+ ],
257
+ },
258
+ {
259
+ "type": "layout-slot",
260
+ "attributes": {"name": "grid-1"},
261
+ "children": [
262
+ {
263
+ "type": "paragraph",
264
+ "children": [
265
+ {"text": ""},
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ ],
271
+ }}>
272
+ <span>1 | 1 | 1 | 1 | 1</span>
273
+ </InsertLayoutButton>
274
+ <InsertLayoutButton insert={{
275
+ "type": "layout",
276
+ "children": [
277
+ {
278
+ "type": "layout-slot",
279
+ "attributes": {"name": "grid-auto"},
280
+ "children": [
281
+ {
282
+ "type": "paragraph",
283
+ "children": [
284
+ {"text": ""},
285
+ ],
286
+ },
287
+ ],
288
+ },
289
+ {
290
+ "type": "layout-slot",
291
+ "attributes": {"name": "grid-fill"},
292
+ "children": [
293
+ {
294
+ "type": "paragraph",
295
+ "children": [
296
+ {"text": ""},
297
+ ],
298
+ },
299
+ ],
300
+ },
301
+ ],
302
+ }}>
303
+ <span>auto | fill</span>
304
+ </InsertLayoutButton>
305
+ <InsertLayoutButton insert={{
306
+ "type": "layout",
307
+ "children": [
308
+ {
309
+ "type": "layout-slot",
310
+ "attributes": {"name": "grid-fill"},
311
+ "children": [
312
+ {
313
+ "type": "paragraph",
314
+ "children": [
315
+ {"text": ""},
316
+ ],
317
+ },
318
+ ],
319
+ },
320
+ {
321
+ "type": "layout-slot",
322
+ "attributes": {"name": "grid-auto"},
323
+ "children": [
324
+ {
325
+ "type": "paragraph",
326
+ "children": [
327
+ {"text": ""},
328
+ ],
329
+ },
330
+ ],
331
+ },
332
+ ],
333
+ }}>
334
+ <span>fill | auto</span>
335
+ </InsertLayoutButton>
336
+ <InsertLayoutButton insert={{
337
+ "type": "layout",
338
+ "children": [
339
+ {
340
+ "type": "layout-slot",
341
+ "attributes": {"name": "grid-auto"},
342
+ "children": [
343
+ {
344
+ "type": "paragraph",
345
+ "children": [
346
+ {"text": ""},
347
+ ],
348
+ },
349
+ ],
350
+ },
351
+ {
352
+ "type": "layout-slot",
353
+ "attributes": {"name": "grid-fill"},
354
+ "children": [
355
+ {
356
+ "type": "paragraph",
357
+ "children": [
358
+ {"text": ""},
359
+ ],
360
+ },
361
+ ],
362
+ },
363
+ {
364
+ "type": "layout-slot",
365
+ "attributes": {"name": "grid-auto"},
366
+ "children": [
367
+ {
368
+ "type": "paragraph",
369
+ "children": [
370
+ {"text": ""},
371
+ ],
372
+ },
373
+ ],
374
+ },
375
+ ],
376
+ }}>
377
+ <span>auto | fill | auto</span>
378
+ </InsertLayoutButton>
379
+ </div>
380
+ </span>;
381
+ };
382
+
383
+ export const InsertLayoutButton = ({
384
+ insert,
385
+ icon,
386
+ children,
387
+ }) => {
388
+ const editor = useSlate();
389
+ const onClick = (event) => {
390
+ event.preventDefault();
391
+ Transforms.insertNodes(editor, [insert]);
392
+ };
393
+
394
+ return (
395
+ <span onMouseDown={onClick} className="toolbar-btn">
396
+ {!!icon && <FontAwesomeIcon icon={icon} />}
397
+ {children}
398
+ </span>
399
+ );
400
400
  };