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

Placeholder shown when node has inline children #1457

Closed
gambolputty opened this issue Jun 12, 2021 · 0 comments
Closed

Placeholder shown when node has inline children #1457

gambolputty opened this issue Jun 12, 2021 · 0 comments
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@gambolputty
Copy link
Contributor

gambolputty commented Jun 12, 2021

Description
The placeholder extension detects a node to be empty, when in fact it has one or multiple child inline nodes.

Steps to reproduce the bug
With Placeholder extension and Mention node:

  1. Go to CodeSandbox
  2. Type "@" to open the Mention menu and select an entry from the list. Hit Backspace to remove the trailing whitespace inserted by the Suggestion utility.
  3. Blur the editor.
  4. See the placeholder being displayed behind the mention (inline-) node.

CodeSandbox
I created a CodeSandbox to help you debug the issue: CodeSandbox

Expected behavior
The placeholder should not be displayed, because the node is not empty.

Bildschirmfoto 2021-06-12 um 13 20 51

Environment?

  • operating system: MacOS
  • browser: Chrome, latest
  • mobile/desktop: Desktop
  • tiptap version: latest

Additional context / possible solution
node.childCount can be used to check, if a node has children. Maybe this should be used in here:

const isEmpty = !node.isLeaf && !node.textContent

e.g.

node.childCount === 0
@gambolputty gambolputty added Type: Bug The issue or pullrequest is related to a bug v2 labels Jun 12, 2021
@gambolputty gambolputty changed the title Placeholder shown when node has inline node children Placeholder shown when node has inline children Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant