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

Attempt to update to CodeMirror 6 #2566

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Attempt to update to CodeMirror 6 #2566

wants to merge 1 commit into from

Conversation

dae
Copy link
Member

@dae dae commented Jul 1, 2023

CodeMirror 6's API has changed dramatically, so we'll need to rework our adaptor to work with it. With these work-in-progress changes, the text in the HTML editor updates when editing with the standard editor and vice-versa. But there is still work to do:

  • The various config options need to be converted to the new Extension-based way of providing options.
  • The remaining .on() events need to be handled somehow - only the change event has currently been reworked.
  • The way changes are synced between the two editors may need rethinking. Currently, a change in one will be sent to the other, and if the other alters the representation, that results in the change being sent back again. This has led to the editor hanging in the past when neither side could reach agreement. After updating to CodeMirror 6, when you attempt to type a < in CodeMirror, it sends the bare < to the WYSIWYG editor, and the WYSIWYG editor sends back a &lt instead - presumably because the DOM is assuming that's what a bare < symbol was intended to be. We may need some way to ignore any incoming changes when we write out a change, or make the process one-way, with whichever editor is currently in focus taking precedence.

Any help would be appreciated!

@dae dae added web frontend Involves Anki's HTML/CSS/TypeScript/Svelte code help wanted labels Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted web frontend Involves Anki's HTML/CSS/TypeScript/Svelte code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant