mdx-editor / editor

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

Don't trim initial markdown #597

Closed rkok closed 1 month ago

rkok commented 1 month ago

When using diffSourcePlugin with viewmode=source, this trim() would cause MDXEditor's onChange to fire immediately. This in turn would dirty the field when used in combination with a form wrapper like react-hook-form.

I think the initial markdown does not need to be trimmed; the user should be free to initialize the editor with trailing or leading newlines as they see fit, the editor should not care.

petyosi commented 1 month ago

Merging this would be a breaking change. Happy to accept an optional prop to disable the trim

rkok commented 1 month ago

Hi @petyosi, prop is now added :+1:

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 3.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: