WIP Feat: VirtualSpan #166
Closed
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.
Relations:
Changelog
toCharacterRangemethod. Exposed asSelection#getTextRange.VirtualSpanA class that helps with handling partials in text, which have a visual representation but are not considered part of the actual document. It turned out to be independent of a running Editable instance, that's why I made it part of a new
contribnamespace.Its first use case would be comments in documents.
It exposes two kind of methods:
The idea is to use the first set of methods to attach and remove virtual spans to the DOM and the second set to guarantee data consistency on a model level.
The main motivation behind not having those virtual spans have the
ui-unwrapdirective and consequentially being removed and reapplied on every update (as I tried here #164) is that those virtual spans somewhat have to live in each components markup. They are expected to behave like any other inline tag (eg<strong>) and treating them as some extraneous entity felt like preventing editable from being editable while reimplementing its core features for the most parts.It's a little unorthodox, but it's playing to the general strengths of this lib in a way that no other solution could (at least those I was able to come up with). And it's very contained and can easily be added/removed when needed.
Known issues
Pull Request Checklist