[SuperEditor][SuperReader] - Add queries for attributions and attributed spans at the document level #2363
Labels
area_super_reader
Related to SuperReader
area_supereditor
Pertains to SuperEditor
bounty_junior
time: 5
It's tedious to try to query attribution data at the document level. Given a selection, you have to obtain all nodes for that selection. Then, you need to remove non-text nodes. Then you need to handle possible partial selection in the first node and last node. And then you need to query each text node for its own attributions and attribution ranges.
At the document level the user should be able to:
When checking for attributions in a selection, the user should be able to specify whether the existence of non-text content in that selection voids the check, or whether the non-text content is ignored.
When reporting spans we'll need a new data structure. That data structure needs to hold a node ID, along with a set of attribution spans.
An example of where this is useful: The user wants to toggle a font color for the current selection. The toggle behavior should remove the font color, if the entire selection already has the given font color. Otherwise, if none of the selection has the font color, or only part of the selection has the font color, then the font color should be applied.
The above example is fairly straight forward when working with a single
AttributedText
. But doing this at the document level runs into the issues above.The text was updated successfully, but these errors were encountered: