matrix-org / matrix-rich-text-editor

Matrix Rich Text Editor
https://matrix-org.github.io/matrix-rich-text-editor/
Apache License 2.0
92 stars 23 forks source link

MentionDisplayHelper to allow to inject context to properly display mentions in RTE #840

Closed Velin92 closed 12 months ago

Velin92 commented 12 months ago

Since the NSTextAttachmentProvider can only see the text view, and the pill might require a context that holds various data and helpful functions to make the pill render correctly, this is just a markdown protocol that can be injected as a weak var to get such context.

For example on Element X this context could be the room context, useful to get all the informations of the already fetched members, and the image provider.

The using application will already know what type the context is and just type unwrap it.

Also added a flushPills function on the textview

codecov-commenter commented 12 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (827ae99) 89.94% compared to head (6ace558) 89.91%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #840 +/- ## ========================================== - Coverage 89.94% 89.91% -0.03% ========================================== Files 114 82 -32 Lines 16306 14767 -1539 Branches 620 0 -620 ========================================== - Hits 14666 13278 -1388 + Misses 1617 1489 -128 + Partials 23 0 -23 ``` | [Flag](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | Coverage Δ | | |---|---|---| | [uitests](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `?` | | | [uitests-ios](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `?` | | | [unittests](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `89.91% <ø> (+1.24%)` | :arrow_up: | | [unittests-ios](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `?` | | | [unittests-rust](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `89.91% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org#carryforward-flags-in-the-pull-request-comment) to find out more. [see 32 files with indirect coverage changes](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/840/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Velin92 commented 12 months ago

SGTM

I might improve it tomorrow, since I was able to run it locally in El-X at the end

sonarcloud[bot] commented 12 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information