Skip to content
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

Add isEmpty() method to check for empty Tiptap content #51

Open
putrafajarh opened this issue Sep 23, 2024 · 1 comment
Open

Add isEmpty() method to check for empty Tiptap content #51

putrafajarh opened this issue Sep 23, 2024 · 1 comment

Comments

@putrafajarh
Copy link

Background

Currently, there's no straightforward way to check if the content of a Tiptap editor is empty. This can be particularly useful for form validation or preventing submission of empty content.

Proposed Solution

Implement an isEmpty() method for Tiptap that returns a boolean value indicating whether the editor's content is empty or not.

Expected Behavior

  • Return true if the editor contains only empty paragraphs or whitespace
  • Return false if the editor contains any meaningful content (text, images, etc.)

Use Case

This method would be helpful in scenarios such as:

  • Validating form submissions to ensure non-empty content
  • Disabling submit buttons when the editor is empty
  • Checking if a user has actually entered any content before saving
@putrafajarh
Copy link
Author

FYI, there is editor.isEmpty on tiptapjs

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

No branches or pull requests

1 participant