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

[Bug] Switching between light mode and dark mode in playground overwrites source markdown #23

Open
2 tasks done
pugtooth opened this issue Aug 27, 2023 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@pugtooth
Copy link

pugtooth commented Aug 27, 2023

Initial checklist

  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything (or linked relevant results below)

Affected packages and versions

Milkdown Playgroundv7.3.0

Link to runnable example

No response

Steps to reproduce

Type anything into the editor, switch between light modes, and the source text will be reset to default text.

Expected behavior

You keep your text (sorry for lame response, but I feel like this is a given)

Actual behavior

The preview will not be effected, but the source text will be reset to the default text.

Runtime

Chrome

OS

Linux

Build and bundle tools

No response

@pugtooth pugtooth added the bug Something isn't working label Aug 27, 2023
@Saul-Mirone Saul-Mirone transferred this issue from Milkdown/milkdown Aug 27, 2023
@sindras
Copy link

sindras commented Oct 13, 2024

That's very likely caused by the useLayoutEffect's dependency towards darkMode changes.

Whenever the value change, the useLayoutEffect callback is triggered, so it will call the crepe.destroy() first, and then re-creating a new editor with the original default content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants