-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix emptyTextBlock detection to handle leaf nodes too #5838
base: develop
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: bdc3eef The changes in this PR will be included in the next version bump. This PR includes changesets to release 54 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I wonder if this fix is still valid #4444 |
Your check is similar, but I think that one covers more cases (like a node specifying a way to render to text) |
Do we need to be that specific in that case though? I thought about it and I couldn't find a reason why a node should be considered empty even when it has any child nodes. Do you have any thing in mind that would cause a node to have child content but still should be considered empty for the floating menu? |
Changes Overview
This pull request includes a small but significant change to the
FloatingMenuView
class in thepackages/extension-floating-menu/src/floating-menu-plugin.ts
file. The change ensures that theisEmptyTextBlock
condition also checks if the parent node has no children (childCount === 0
).This fixes a bug (see #4327) causing leaf nodes not to be counted as content of a node. It also deprecates the PR #4444
Changes in
FloatingMenuView
:isEmptyTextBlock
condition to include a check forchildCount === 0
to ensure the block is truly empty.Checklist
Related Issues
renderText
does not propagate toNodeSpec.leafText
andextension-floating-menu
usesNode.textContent
which usesNodeSpec.leafText
#4327