-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:replace_text #781
fix:replace_text #781
Conversation
@q200892907 Your change is incorrect. It will cause the input text to lose its format. |
@LucasXu0 I understand what it means. I will modify the code later and add a blacklist to handle the format. |
Add blacklist to solve text input problem 2024-04-26.17.13.25.mov |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #781 +/- ##
==========================================
- Coverage 75.32% 74.74% -0.59%
==========================================
Files 300 300
Lines 14032 14162 +130
==========================================
+ Hits 10570 10585 +15
- Misses 3462 3577 +115 ☔ View full report in Codecov by Sentry. |
@@ -346,6 +349,12 @@ extension TextTransaction on Transaction { | |||
var newAttributes = attributes; | |||
if (index != 0 && attributes == null) { | |||
newAttributes = delta.slice(max(index - 1, 0), index).first.attributes; | |||
if (newAttributes != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sliceAttributes
instead of delta.slice(max(index - 1, 0), index).first.attributes
will be sufficient.
The sliceAttributes
function will only slice the keys in AppFlowyRichTextKeys.supportSliced
, which is a whitelist containing the attributes supported for slicing.
fix AppFlowy-IO/AppFlowy#5189
2024-04-25.13.55.39.mov