[Bug][iOS] Typing or autocorrecting inside a mention strips it to plain text
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ios, objective-c, react-native
Hướng nghiên cứu
Start in the iOS implementation of shouldChangeTextInRange:replacementText: and read MentionStyle.remove:withDirtyRange: plus handleExistingMentions; the issue identifies these paths and getMentionParamsAt: as relevant. Check how edits inside and at the edges of a mention affect its attributes and emitted HTML. Done means typing, autocorrecting, or backspacing cannot leave visible plain text with the mention id silently lost; verify both whole mention deletion and edits beside it.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
On iOS, any edit that lands inside a mention silently strips it to plain text. The name stays on screen, the <mention> tag disappears from the emitted HTML, and the id with it — so a reader still sees what looks like a mention, while the application has lost the person it pointed to. In a messaging app that means the mentioned user is never notified, and nothing on screen says so.
This is the same model as #691, which was reported and fixed for Android. That issue states the intended behaviour, and I agree with it:
it should either stay intact or be deleted as a whole atomically
That issue also says the problem is "not reproducible on iOS", where editing "removes the whole mention range instead of leaving orphaned plain text". Reading the current source, that does not seem to be the case: MentionStyle.remove:withDirtyRange: is commented // Strip meta only and calls removeAttribute:MentionAttributeName. The attribute goes; the characters stay.
Steps to reproduce
- In an
EnrichedTextInputwithmentionIndicators={['@']}, insert a mention withsetMention('@', '@Jane Doe', { id: '42' }). - Place the caret in the middle of the name and type one character — or let iOS autocorrect the name, which hits the same path.
- Read
onChangeHtml.
Expected: the mention is untouched (the character landing beside it), or it is removed whole.
Actual: <p>@Jane Dxoe</p> — plain text, no <mention>, no id.
A backspace inside the name does the same thing: one character disappears, and the mention silently stops being one.
Where it comes from
shouldChangeTextInRange:replacementText: consults no mention at any point, so every edit is accepted; handleExistingMentions then compares each mention's stored text to what the storage now holds, and drops the attribute when they differ.
Autocorrect is the worst case: it rewrites a proper noun without the user doing anything deliberate, and there is no way to opt out for a range — autoCorrect (added in 1.2.0, thanks!) is per-input, so turning it off to protect mentions also turns it off for the whole document.
Possible fix
Hold the rule where edits arrive, in shouldChangeTextInRange:replacementText::
- the modified range intersects a mention, and the replacement is empty → remove the whole mention (plus the space
setMentionappended) and returnNO; - it intersects a mention and the replacement is not empty → return
NO.
For a collapsed caret, only strictly inside should count — on either edge the character legitimately belongs beside the mention.
One detail worth noting for whoever implements it: -attribute:atIndex:longestEffectiveRange: fills the range even when the attribute is absent, so a zero-length range is not the signal it appears to be. getMentionParamsAt: returning nil is the reliable check.
I have this running as a local patch against 1.2.0 and I am happy to open a PR if the approach suits you.
Version
react-native-enriched-html 1.2.0, React Native 0.86.3, iOS.
- Ngôn ngữ chính
- C
- Star
- 1.4k
- Fork
- 76
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của software-mansion/react-native-enriched-html
-
[iOS] Deadlock: measureContent dispatch_syncs to main while holding the shadow tree lockCó thể đã có người làm @szydlovsky đã nhận 2 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
software-mansion/react-native-enriched-html#848 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[Feature request] Vertical spacing (margins) for headings and lists in htmlStyleCó thể đã có người làm @henrikra đã nhận 13 ngày trước. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
software-mansion/react-native-enriched-html#832 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[iOS] Tags not parsed on iOS below a certain string lengthCó thể đã có người làm @hejsztynx đã nhận 22 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
software-mansion/react-native-enriched-html#811 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
software-mansion/react-native-enriched-html#810 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Support for `<raw-text-block>`Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
software-mansion/react-native-enriched-html#803 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của software-mansion/react-native-enriched-html
Issue tương tự
-
bug genc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
-
XPM values line with more than one space between numbers raises ValueErrorCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
python-pillow/Pillow#10429 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày