fix(445): render default block on empty editor#494
Conversation
|
@gloaysa is attempting to deploy a commit to the dargo's projects Team on Vercel. A member of the Team first needs to authorize it. |
| return () => document.removeEventListener('keydown', onKeyDown); | ||
| }, [editor.path, isReadOnly]); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
I'm not sure if it's good idea to manage the editor value inside the core package.
I think the manipulation of the value should be completely on the user's side
There was a problem hiding this comment.
I see your point and makes sense. On the other hand, the user might not be aware of the tooling needed to build an empty block and just expect that when the editor is empty, it will display the placeholder (currently it only displays a blank space).
My current solution is also flawed, now that I think about it, since buildBlockData uses a Paragraph, and maybe the current editor doesn't have the Paragraph plugin installed.
Maybe add documentation explaining this is the expected behaviour and how to solve it? (is the reason behind #494 )
Description
On first render, if the editor is empty adds a default block.
If paddingBottom is not null or undefined, we use the value provided in styles (no longer making it a mandatory number that modifies CSSProperties interface and what is expected).
Fixes #452 #445
Type of change
Please tick the relevant option.
Checklist:
Video showing the fix
Screen.Recording.2025-04-21.at.10.18.10.mov