mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.63k stars 131 forks source link

[BUG] onChange does not fire with next.js >= 14.2 #419

Closed MISTCLICK closed 3 months ago

MISTCLICK commented 3 months ago

Describe the bug After updating next.js to version 14.2 and later trying 14.2.1 the onChange function does not fire when the editor input changes. With next.js 14.1.4 the onChange function fires just fine.

Reproduction I am unfortunately unable to use codesandbox since any attempt to use it results in a complete system crash on my PC.

To Reproduce

  1. Create an empty next.js app using create-next-app with next.js ^14.2
  2. Follow the steps outlined in the docs to create a text editor (using headings, links, quotes and markdownShortcuts plugins).
  3. Create an onChange function (e.g. console.log)
  4. Make changes to the editor and observe no logs in the console

Expected behavior It is expected for the onChange function to fire every time that a change is made to the text editor.

Screenshots N/A

Desktop (please complete the following information):

Additional context N/A

jonow commented 3 months ago

I am having the same issue. It was working for me a few days ago, so I think it must be related to the recent update.

petyosi commented 3 months ago

Confirming that. Next.js 14.2.0 did something that altered Lexical's behavior. I contacted the Lexical team, with a reproduction here: https://github.com/mdx-editor/lexical-issue

Additional details - this is a problem only in dev mode.

petyosi commented 3 months ago

Opened an issue here: https://github.com/vercel/next.js/issues/64486

github-actions[bot] commented 3 months ago

:tada: This issue has been resolved in version 2.20.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

petyosi commented 3 months ago

Updated the MDXEditor package to work around the change, now it works in https://github.com/mdx-editor/mdx-editor-in-next/commit/f5d2c7fecf413918442c4c11e975dac4f15b1ce0.

MISTCLICK commented 3 months ago

Thank you for the prompt reaction and resolution of this issue! <3

imesse commented 1 month ago

I'm still facing the issue in Next 14.2.4, with mdx editor v: "3.6.1".

Screenshot 2024-06-25 at 16 32 03