Add External annotation to the public API #740
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.