Skip to content

Allow editing of text after coding of text #61

Description

@jdittrich
  • Story: I want to be able to correct spelling or transcription mistakes in my texts
  • Current behavior: Files can not be unlocked after coding, they can only be deleted
  • Expected behavior: I can unlock texts and edit them (similar to texts in e.g. AtlasTI)
  • Reproduction:
    • Load a text
    • Apply a code
    • Try to edit the text

Activity

  1. alessandrobelli commented on Aug 2, 2024

    @alessandrobelli
    Contributor

    This is definitely something we want to add, but it adds layers of complexity.
    For example, the codes are identified by the start and end position in a text, and their length. While the length change is easy, if the text is altered in a considerable way, this can easily become a problem.

    TLDR; It's on our schedule, but it won't be available anytime soon.

    Unfortunately for now, the workflow has to include a strong review of the text before coding starts...

  2. jdittrich commented on Aug 2, 2024

    @jdittrich
    Author

    While the length change is easy, if the text is altered in a considerable way

    Yes – the method I found to deal with text changes is:

    • Have the text changes in the form as objects with the properties length:int> and operation-type (which are: "retain", "delete", "add") – this is what many modern editors produce (I think I used quill 1)
    • Represent the annotate ranges of of text as boundaries, i.e. an objects with the properties boundary position index:int, boundary type (which are: "start", "end") and annotation id (that usually needs a temporary conversion)
    • For each change go though all boundaries and see if they need to be moved. A boundary is moved, if its position index is > than the position-index of the change. Deletions lower all boundary indices, additions raise them (now, nested loops are not great for performance, but the operations itself are simple)
    • …what I did not implement is cleaning up collapsed boundaries i.e. ones where their containing text has been entirely deleted.
    • convert back into the native format of representing annotation ranges.

    Which does not mean this is easy to do, just some example of how it can be approached.

  3. jankapunkt commented on Nov 19, 2024

    @jankapunkt
    Member

    @kadewe the aforementioned comment by @jdittrich is an example of why we now use quill to manage the state of selections as controlled state as opposed to manual add/insert/update/remove elements.

    The clear advantage is that quill supports concurrent editing using a delta format, which will soon allow us to make selections of text, then edit the text and have the selections automatically update.

    However, there is one more level of complexity that @jdittrich missed out here, that is - we have to additionally compute overlaps of selections, because quill and any other editor will not automatically create an overlap, because it's actually their job to NOT overlap but override. Think about how google docs would work if the algorithm (operational transformation) would actually support overlapping editing, instead of overriding... This is why "merge" of concurrent edits is simply a controlled way of deciding which edit is the correct last state of truth overriding prior edits.

    Summarizing this:

    • from version 1.0 we use quill to control the state of the text and the selections
    • with quill we can support multiple plugins for visualizing selections, the default (and currently only supported one) is highlighted background
    • overlapping of selections has to be computed manually and has to be added until 1.0
    • additional deltas from post-selection editing of the source should be implemented but not for 1.0
    • performance might be affected on large documents with lots of selections by multiple users, this is to be researched aftr 1.0 release in order to find performance optimizations
  4. jdittrich commented on Nov 19, 2024

    @jdittrich
    Author

    we have to additionally compute overlaps of selections

    As far as I am concerned, if you move all the boundaries, you also move the overlapping sections. In the solution I mentioned above, I never store or process overlapping sections directly: (notation as propertyName:)

    1. store the selections as: id:, from:, to: – since these are the domain object users operate on
    2. Derive boundary points from 1.: (belongTo:, type:<"start"|"end">, position:) which can be used for recalculating boundardy positions and for generating overlaps.
      3.The overlaps are only created as a view-model and entirely derived from existing data.: The text is subdivided into sections by the boundary points, each section has 0 or more highlights. The sections can also have 0 or more formatting options (which thus can be preserved (Usually you would first get the formatted ranges from the editor, then further chop them up for the highlighting – or you store both in your data model)

    (I have a demo (incedentally also based on quill, if I remember correctly) of this which might be easier to understand than my abstract description)

  5. jankapunkt commented on Nov 19, 2024

    @jankapunkt
    Member

    @jdittrich overlapping selections might not be part of your usecase but since collaborative coding will be a crucial part of the upcoming releases we have to cover visualization of overlapping codes. Yes, the overlappings are only part of the view-model but they have to be actively computed each time a selection gets added/removed/moved, because the selection itself does not know which other selections are crossed.

    A demo would be very useful, can you link it here?

  6. jdittrich commented on Nov 19, 2024

    @jdittrich
    Author

    overlapping selections might not be part of your usecase

    They are! (I derived them, rather than represent them directly)

    Yes, the overlappings are only part of the view-model but they have to be actively computed each time a selection gets added/removed/moved, because the selection itself does not know which other selections are crossed.

    Yes.

    A demo would be very useful, can you link it here?

    I could send code, I think, I do not have an online demo for it.

  7. jankapunkt commented on Nov 20, 2024

    @jankapunkt
    Member

    @jdittrich I could create a demo repository and invite you and we build this together until it's a proof of concept. We could then merge it into openqda, making you our first external collaborator 🚀

  8. pinned this issue on Nov 20, 2024
  9. jankapunkt commented on Nov 20, 2024

    @jankapunkt
    Member

    @jdittrich here is the repo: https://github.com/openqda/editor-dev let me know if I can invite you :-)

  10. jdittrich commented on Nov 20, 2024

    @jdittrich
    Author

    thanks – yes, please invite me (the account that I use here is right)

  11. jankapunkt commented on Nov 20, 2024

    @jankapunkt
    Member

    @jdittrich done, let's continue discussion there and come back here later

  12. added this to the Release 1.1 milestone on Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpartially resolved in python portUse when covered in python port but not considered as resolved there yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions