-
-
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
Tweak getTextBetween
to prepend blockSeparator
to block node even if block node doesn't have any children
#5055
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
getTextBetween
to prepend blockSeparator
to block node even if block node doesn't have any children
getTextBetween
to prepend blockSeparator
to block node even if block node doesn't have any children getTextBetween
to prepend blockSeparator
to block node even if block node doesn't have any children
@bdbch @svenadlung +1 on this one E.g. in the screenshots between line 2 and 5 there are 2 paragraphs (line breaks), but
|
@knitevision1 if this PR gets merged, you (and I) will be able to achieve the desired result with |
@bdbch could you take a look at this PR when you get a moment? Looking at reactions in this PR, it looks like I'm not the only one who wants this change. |
Thanks @bdbch! |
When will this get released? So happy with this change, it's made dealing with whitespaced text content so annoying |
@itzcull it's released 🎉 |
Please describe your changes
Currently
getTextBetween
function doesn't prependblockSeparator
to block nodes without children.This PR updates it to prepend
blockSeparator
to block nodes in any case (even if block node doesn't have any children).How did you accomplish your changes
I have tweaked the implementation to not depend on child nodes of blocks when deciding whether
blockSeparator
should be prepended.How have you tested your changes
I used preview link generated by Netlify bot below.
How can we verify your changes
Use preview link generated by Netlify bot below.
Remarks
Below are before/after examples.
Without empty paragraph
Before:
'Hello!'+BLOCK_SEPARATOR+'How are you?'
After:
'Hello!'+BLOCK_SEPARATOR+'How are you?'
With empty paragraphs
Before:
'Hello!'+BLOCK_SEPARATOR+'How are you?'
After:
'Hello!'+BLOCK_SEPARATOR+BLOCK_SEPARATOR+'How are you?'
(it's breaking change, but I consider it a bugfix)Checklist
Related issues
N/A