Skip to content
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

Merged
merged 3 commits into from
May 6, 2024
Merged

fix:replace_text #781

merged 3 commits into from
May 6, 2024

Conversation

q200892907
Copy link
Contributor

fix AppFlowy-IO/AppFlowy#5189

2024-04-25.13.55.39.mov

@LucasXu0
Copy link
Collaborator

@q200892907 Your change is incorrect. It will cause the input text to lose its format.

@q200892907
Copy link
Contributor Author

@LucasXu0 I understand what it means. I will modify the code later and add a blacklist to handle the format.

@q200892907
Copy link
Contributor Author

q200892907 commented Apr 26, 2024

 inlineAttributesBlacklist.addAll([
      InlineMathEquationKeys.formula,
    ]); 

Add blacklist to solve text input problem

2024-04-26.17.13.25.mov

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.74%. Comparing base (5d4f236) to head (17bee87).
Report is 9 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@@ -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) {
Copy link
Collaborator

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.

@LucasXu0 LucasXu0 merged commit 18425e2 into AppFlowy-IO:main May 6, 2024
10 of 12 checks passed
@q200892907 q200892907 deleted the fix-replace_text branch May 6, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Chinese input after InlineMathEquation
2 participants