Skip to content

Conversation

paulftw
Copy link
Contributor

@paulftw paulftw commented Jul 5, 2025

Consider an example:
an app has table of content (ToC) and an editor. Clicking on a table of content item selects and scrolls into view the clicked section.
moving cursor to another section with arrow keys highlights corresponding ToC item.
This requires sending selection changes to CM6 and listening for selection changes.
When ToC is clicked the app triggers an update, and immediately receives the onChange with the same update.
Distinguishing between changes triggered by user and by app itself can be done on the app side, but it's a lot of unnecessary complex logic.

Or, if the app had access to the External annotation it could simply tell useCodeMirror to ignore the change.

This is the motivation behind this PR.

@jaywcjlove jaywcjlove merged commit 51125ec into uiwjs:master Jul 5, 2025
jaywcjlove added a commit that referenced this pull request Jul 5, 2025
@jaywcjlove
Copy link
Member

@paulftw Thanks for the clear explanation and example — that makes perfect sense.
Totally agree that having access to the External annotation would simplify the logic a lot.
Appreciate your work on this PR!

github-actions bot pushed a commit that referenced this pull request Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants