Skip to content

fix(445): render default block on empty editor #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gloaysa
Copy link
Contributor

@gloaysa gloaysa commented Apr 21, 2025

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked my code and corrected any misspellings

Video showing the fix

Screen.Recording.2025-04-21.at.10.18.10.mov

Copy link

vercel bot commented Apr 21, 2025

@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.

@@ -59,6 +59,13 @@ const Editor = ({
return () => document.removeEventListener('keydown', onKeyDown);
}, [editor.path, isReadOnly]);

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

@gloaysa gloaysa Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Can't override the default style paddingBottom on the editor itself with the style prop.
2 participants