Skip to content

Add Post#hasContent #335

@rlivsey

Description

@rlivsey

Currently Post#isBlank is false if it has a section, even if there's no content in that section.

I'm currently doing this to check if a post has blank content:

 function editorPostIsBlank(editor) {
  const post = editor.post;
  if (post.isBlank) {
    return true;
  }

  const sections = post.sections;
  if (sections.isEmpty) {
    return true;
  }

  if (sections.length === 1 && sections.head.isBlank) {
    return true;
  }

  return false;
}

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