Skip to content

Conversation

josdejong
Copy link
Owner

@josdejong josdejong commented Feb 13, 2025

To achieve this, we first have to implement two helper functions to convert from a text position to a JSONSelection and vice versa: function findTextLocation already exists, and this PR implements a new function findSelectionFromTextLocation.

TODO:

  • work out findSelectionFromTextLocation in detail: it must return KeySelection, ValueSelection, AfterSelection, InsideSelection, and MultiSelection
  • write unit tests
  • in TextMode.svelte, extend the function applyExternalSelection with handling the case when externalSelection is a JSONSelection. Use findTextLocation there.
  • In TreeMode and TableMode extend the function applyExternalSelection to handle the case when externalSelection is a JSONSelection. Use findSelectionFromTextLocation there.
  • Test the performance in case of large documents. If needed, restrict maintaining the selection to small enough documents.
  • Create and export utility functions to convert from JSONSelection to TextSelection

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.

1 participant