josdejong / josdejong/jsoneditor
Maintain selection on `update` in code and text mode
Open
feature
- Dominant language
- JavaScript
- Stars
- 12.3k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Since version `v5.20.0`, JSONEditor contains new methods `update` and `updateText` which keep the current state of the editor when in modes `tree`, `form`, and `view`. These methods work for `text` and `code` too, but there the caret position is lost when updating the contents of the editor.
It would be great if the caret position could be maintained too. Ace editor has support for updating with a text diff, that will be really useful. I think we'll need a text diff library to determine which parts are changed, so we can calculate how much the old selection needs to move up or down to match the same contents.
Contributor guide
Assessment
This issue has not been assessed yet.