-
-
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
Conversation
🦋 Changeset detectedLatest commit: dce2bf0 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? |
No worries, sometimes I may sound a bit to annoyed/harsh but I was just curious about the differences. I'll try your diff and report back. Pretty sure this should also work as the mention will still be counted as a child node of the paragraph parent increasing the childCount to 1. I'm also fine parsing the text content via the node schema if needed. |
If yours works, then I'd go with the simpler one which is yours |
bdc3eef
to
dce2bf0
Compare
@tiptap/core
@tiptap/extension-bold
@tiptap/extension-blockquote
@tiptap/extension-bubble-menu
@tiptap/extension-character-count
@tiptap/extension-bullet-list
@tiptap/extension-code
@tiptap/extension-code-block
@tiptap/extension-code-block-lowlight
@tiptap/extension-collaboration
@tiptap/extension-collaboration-cursor
@tiptap/extension-color
@tiptap/extension-document
@tiptap/extension-dropcursor
@tiptap/extension-floating-menu
@tiptap/extension-focus
@tiptap/extension-font-family
@tiptap/extension-gapcursor
@tiptap/extension-hard-break
@tiptap/extension-heading
@tiptap/extension-highlight
@tiptap/extension-history
@tiptap/extension-horizontal-rule
@tiptap/extension-image
@tiptap/extension-italic
@tiptap/extension-link
@tiptap/extension-list-item
@tiptap/extension-list-keymap
@tiptap/extension-mention
@tiptap/extension-ordered-list
@tiptap/extension-paragraph
@tiptap/extension-placeholder
@tiptap/extension-strike
@tiptap/extension-subscript
@tiptap/extension-superscript
@tiptap/extension-table
@tiptap/extension-table-cell
@tiptap/extension-table-header
@tiptap/extension-table-row
@tiptap/extension-task-item
@tiptap/extension-task-list
@tiptap/extension-text-align
@tiptap/extension-text
@tiptap/extension-text-style
@tiptap/extension-typography
@tiptap/extension-underline
@tiptap/extension-youtube
@tiptap/html
@tiptap/react
@tiptap/pm
@tiptap/starter-kit
@tiptap/suggestion
@tiptap/vue-2
@tiptap/vue-3
commit: |
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