easy-email-editor icon indicating copy to clipboard operation
easy-email-editor copied to clipboard

Getting NotFoundError: Failed to execute 'removeChild' on 'Node' on Nextjs app directory

Open itstaranarora opened this issue 1 year ago • 6 comments

I'm getting the following error when trying to use this package inside the Next.js app directory:

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

Link to Sandbox: https://codesandbox.io/p/devbox/quirky-field-5wk4ws?workspaceId=b7a6640e-f073-4ff0-96e4-9ea3e941c70e

image

itstaranarora avatar Sep 10 '24 10:09 itstaranarora

@m-Ryan @hulinNeil @mikicho can you please help here?

abhijeetahuja avatar Sep 10 '24 11:09 abhijeetahuja

@n-ryan any updates on this? we have been getting the same error?

abhijeetahuja avatar Sep 10 '24 14:09 abhijeetahuja

@hulinNeil can you please help?

abhijeet-toptal avatar Sep 11 '24 10:09 abhijeet-toptal

We need this feature to work, it works in the pro mode though

abhijeet-toptal avatar Sep 11 '24 10:09 abhijeet-toptal

same issue here

rossanodr avatar Oct 03 '24 14:10 rossanodr

Actually fix is quite simple if the library is still under maintaines. Developers should replace

<RenderReactNode
  selector={'0'}
  node={doc.documentElement}
  index={0}
/>

with

<RenderReactNode
  selector={'0'}
  node={doc.body.children[0] as HTMLElement}
  index={0}
/>

Both in HtmlStringToReactNodes.tsx and HtmlStringToPreviewReactNodes.tsx.

That not only will make it work correctly as it will not produce html tag inside of root html tag but also will allow to use the editor in nextjs app router.

msereniti avatar Oct 17 '24 18:10 msereniti