Commit cefbb70
feat: Default image blocks (#331)
* Made formatting toolbar buttons not show if they are not applicable
* Made formatting toolbar placement change based on text alignment
* Improved typing for blocks without inline content and made them selectable
* Updated default blocks with new typing
* Added image block (React implementation)
* Added image upload and caption formatting toolbar buttons
* Added image slash menu item
* Temporarily updated `App.tsx` to show image block
* Added placeholder `alt` attribute to image
* Added `destroy` function so vanilla custom blocks can clean ip between renders
* Added vanilla image block
* Added Uppy deps
* Updated `ReplaceImageButton.tsx`
* Small fix in `BlockColorsButton.tsx`
* Typing fix for hyperlink toolbar components
* Created reusable components for link & caption components
* Fixed import issue
* Made image selection border also include caption
* Added comment
* Added new hooks to clean up code
* Updated exports
* Changed image replacing from Uppy to custom UI and removed `replacing` prop
* Fixed z-index for UI elements
* Changed image `width` prop to be in px
* Removed Uppy dependency
* Reverted `App.tsx`
* Removed React image block implementation
* Fixed exports
* Fixed image block imports
* Small fixes to tests
* Changed image replacement to use image specific toolbar
* Made image toolbar open immediately after inserting an image using the slash menu
* Fixed replace image button having persistent `open` state
* `ImageToolbarPositioner.tsx` cleanup
* Made image toolbar design more similar to Notion
* Cleaned up block typing
* Implemented PR feedback
* Removed redundant z-index style from `ColorStyleButton`
* Made props able to be any primitive type and cleaned up test snapshots
* Extracted image styles to CSS
* Refactored `DefaultImageToolbar`
* Added editor option for consumers to handle image uploads
* Small `FormattingToolbarPositioner` refactor
* Fixed image slash menu item bug
* Changed image toolbar to use tabs and fixed dark theme
* Renamed image `src` prop to `url`
* Changed how image width is constrained to editor width
* Updated default color names
* Added loading overlay to the image toolbar while an image is being uploaded
* Fixed heading in block tyupe dropdown
* small fixes (#346)
* small fixes
* Updated `uploadFile` JSDoc
* Extracted example file upload function to new file removed it as a default
---------
Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
* Small hook fix
* Added image docs
* Updated unit test snapshots
* Added image e2e tests
* Added error handling for image uploads
* Renamed example image upload handler
* Added example image upload handler to docs home page
* Small fixes
* Added test snapshots/screenshots
* Improved e2e test reliability
---------
Co-authored-by: Yousef <yousefdardiry@gmail.com>1 parent 5dd663c commit cefbb70
File tree
181 files changed
+3348
-3123
lines changed- examples/editor/src
- packages
- core/src
- api
- blockManipulation
- __snapshots__
- formatConversions
- __snapshots__
- nodeConversions
- __snapshots__
- extensions
- BackgroundColor
- Blocks
- api
- nodes
- BlockContent
- HeadingBlockContent
- ImageBlockContent
- ListItemBlockContent
- BulletListItemBlockContent
- NumberedListItemBlockContent
- ParagraphBlockContent
- ImageToolbar
- SlashMenu
- TextColor
- react/src
- FormattingToolbar/components
- DefaultButtons
- DefaultDropdowns
- HyperlinkToolbar
- EditHyperlinkMenu/components
- components
- EditHyperlinkMenu/components
- ImageToolbar/components
- SideMenu/components
- DragHandleMenu/DefaultButtons
- SlashMenu
- components
- hooks
- website/docs
- .vitepress
- theme/components/Examples/BlockNote
- docs
- examples
- public/img/screenshots
- tests
- end-to-end
- copypaste/copypaste.test.ts-snapshots
- dragdrop/dragdrop.test.ts-snapshots
- draghandle/draghandle.test.ts-snapshots
- images
- images.test.ts-snapshots
- indentation/indentation.test.ts-snapshots
- keyboardhandlers/keyboardhandlers.test.ts-snapshots
- theming
- theming.test.ts-snapshots
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
181 files changed
+3348
-3123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
| |||
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
154 | 165 | | |
155 | 166 | | |
156 | 167 | | |
| |||
178 | 189 | | |
179 | 190 | | |
180 | 191 | | |
| 192 | + | |
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
| |||
195 | 207 | | |
196 | 208 | | |
197 | 209 | | |
| 210 | + | |
198 | 211 | | |
199 | 212 | | |
200 | 213 | | |
201 | 214 | | |
202 | 215 | | |
203 | 216 | | |
204 | 217 | | |
| 218 | + | |
| 219 | + | |
205 | 220 | | |
206 | 221 | | |
207 | 222 | | |
| |||
468 | 483 | | |
469 | 484 | | |
470 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
471 | 492 | | |
472 | 493 | | |
473 | 494 | | |
| |||
481 | 502 | | |
482 | 503 | | |
483 | 504 | | |
| 505 | + | |
| 506 | + | |
484 | 507 | | |
485 | 508 | | |
486 | | - | |
| 509 | + | |
| 510 | + | |
487 | 511 | | |
488 | 512 | | |
489 | 513 | | |
| |||
Lines changed: 21 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
459 | | - | |
| 459 | + | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | | - | |
| 479 | + | |
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
| 534 | + | |
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
| 551 | + | |
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| |||
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
571 | | - | |
| 571 | + | |
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
588 | | - | |
| 588 | + | |
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| |||
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
| |||
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | | - | |
| 37 | + | |
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
47 | | - | |
| 44 | + | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | | - | |
| 53 | + | |
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | | - | |
| 60 | + | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
| |||
123 | 120 | | |
124 | 121 | | |
125 | 122 | | |
126 | | - | |
| 123 | + | |
127 | 124 | | |
128 | 125 | | |
129 | 126 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
0 commit comments