Closed bdbch closed 1 month ago
Latest commit: 86b1a4dfdc9384fe453e6fb40b6f8970bb730382
The changes in this PR will be included in the next version bump.
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
Name | Link |
---|---|
Latest commit | 86b1a4dfdc9384fe453e6fb40b6f8970bb730382 |
Latest deploy log | https://app.netlify.com/sites/tiptap-embed/deploys/66f55461a79cfa000872d6b3 |
Deploy Preview | https://deploy-preview-5651--tiptap-embed.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@nperez0111 tests should now work - we actually had this fix already implemented but only on an extension level for the HorizontalRule
extension. Removed it there.
Changes Overview
This PR fixes an issue that was brought up by a community member about how the
insertContent
andinsertContentAt
commands always split text nodes when the selection starts at the beginning of the text. This would always lead to the inserted content having an empty paragraph inserted above it.In the following example I'll try to point out the issue more
Let's say your cursor right now is at the start of
Hello World
and you would insert an image, the resulting HTML previously would returnAfter this fix the HTML will result to this:
When the content is inserted between existing text, it will just work as usual via splitting the paragraph/text node apart.
Implementation Approach
Before we run the actual inserting of block node content, I added a check to see if
If both requirements are met, we jump out of the node via
from =- 1
to prepend said node before the current text block.Testing Done
I added two test cases for those scenarios and both run valid + did manual tests.
Verification Steps
insertContent
demoAdditional Notes
This is a major change as it could break existing insertContent usages.
Checklist