Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix orderedList truncated after the codeBlock is deleted in the order… #4388

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wang1xiang
Copy link

@wang1xiang wang1xiang commented Aug 28, 2023

Please describe your changes

fix orderedList truncated after the codeBlock is deleted in the orderedList.

How did you accomplish your changes

Currently using clearNodes to delete the code block when the code block is empty. However, when the code block is in an ordered list, deleting this code block causes the ordered list to be truncated.

In order to solve this problem, we can additionally process the ordered list in the delete event, instead of deleting the code block through clearNodes, delete it through deleteNode.

How have you tested your changes

Yes. As the code change is very small, I verified it by applying the same change to my local node_modules folder.

How can we verify your changes

To reproduce the problem, just insert a block code in the ordered list, then type a Backspace and you should see the exception, the ordered list is truncated.

After applying this change, the issue was fixed.

Remarks

[add any additional remarks here]

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

[add a link to the related issues here]

@netlify
Copy link

netlify bot commented Aug 28, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 36a6660
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64ec04f7b935ee0008793c79
😎 Deploy Preview https://deploy-preview-4388--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -138,6 +138,12 @@ export const CodeBlock = Node.create<CodeBlockOptions>({
}

if (isAtStart || !$anchor.parent.textContent.length) {
if (this.editor.isActive('orderedList'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using defined extensions here to solve this is the wrong way because this issue will appear in other types of nodes too I guess.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are right. It's because I haven't thought about it comprehensively enough.

I'm currently modifying it like this in the project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll think about this for some time. The solution should work for all kind of wrapping nodes if possible.

@nperez0111 nperez0111 added the Info: Invalid The issue or pullrequest is invalid label Jul 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Info: Invalid The issue or pullrequest is invalid
Projects
No open projects
Status: Triage open
Development

Successfully merging this pull request may close these issues.

3 participants