Skip to content

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

@putrafajarh

Description

@putrafajarh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions