Skip to content
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

Deleting <blockquote> in Editor causes Preview Error: NotFoundError - Failed to execute 'removeChild' #646

Open
skyfoliage opened this issue Jun 3, 2024 · 2 comments

Comments

@skyfoliage
Copy link

skyfoliage commented Jun 3, 2024

First, thank you for developing this highly appreciated editor!

I tried to embed SNS quote cards such as Twitter (X), Instagram, and Bluesky using <blockquote> and then <script> in the editor. The preview was able to show these cards, but when I deleted the <blockquote> tag above the <script>, an error occurred.

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

I think that when I delete the <blockquote> in the editor, it affects the DOM tree, but it does not update the Previewer's React tree accordingly.
It seems possible to address this with onChange in MDEditor, but I would like a more fundamental solution.
What is the best practice to avoid this error?

@jaywcjlove
Copy link
Member

@skyfoliage Would disabling the script tag solve the issue?

<MDEditor
  previewOptions={{
+    disallowedElements: ['script'],
  }}
/>

@skyfoliage
Copy link
Author

@jaywcjlove Thanks, I'll give it a try :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants