Skip to content

[iOS]Fix for Character Spacing Not Updating Correctly in Editor for Dynamically Added Text#25347

Merged
jfversluis merged 26 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-17782
Jan 31, 2025
Merged

[iOS]Fix for Character Spacing Not Updating Correctly in Editor for Dynamically Added Text#25347
jfversluis merged 26 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-17782

Conversation

@devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Oct 17, 2024

Root Cause

The text was initially loaded with CharacterSpacing and then mapped as AttributedText for the native UITextView text. However, when characters were dynamically added in the editor field, the current text mapped as the simple text without considering the CharacterSpacing for the native AttributedText for the UITextView, which caused the issue.

Description of Change

We are recreating the character mapping whenever the text changes with CharacterSpacing Value. This approach resolves the issue and ensures the functionality works as intended

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #17782

Output Screenshot

Before After
MAC
Mac.Before.Fix.mp4
MAC
Mac.After.Fix.mp4
iOS
iOS.Before.fix.1.mov
iOS
iOS.After.Fix.1.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 17, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title Fix New text in the Editor character spacing test sometimes uses the previous spacing Fix for Character Spacing Not Updating Correctly in Editor for Dynamically Added Text Oct 17, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title Fix for Character Spacing Not Updating Correctly in Editor for Dynamically Added Text [iOS]Fix for Character Spacing Not Updating Correctly in Editor for Dynamically Added Text Oct 17, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review October 21, 2024 14:36
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner October 21, 2024 14:36
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Platform.TextExtensions.UpdateText(handler.PlatformView, editor);

// Any text changes in the editor field require recalculating the CharacterSpacing by regenerating the attributed string to properly apply the spacing and override the current text formatting.
if (editor.CharacterSpacing > 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can invalidate CharacterSpacing just doing:

handler?.UpdateValue(nameof(CharacterSpacing));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I've updated the code as per your recommendation, using handler?.UpdateValue(nameof(CharacterSpacing));

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@devanathan-vaithiyanathan
Copy link
Contributor Author

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@devanathan-vaithiyanathan
Copy link
Contributor Author

/rebase

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@devanathan-vaithiyanathan
Copy link
Contributor Author

/rebase

@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 6, 2024
@rmarinho
Copy link
Member

rmarinho commented Dec 6, 2024

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@samhouts samhouts requested a review from Copilot December 19, 2024 19:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/Controls/tests/TestCases.HostApp/Issues/Issue17782.xaml: Language not supported

…sLayout is set for Tablet but not on mobile devices (dotnet#26152)"

This reverts commit 0ddc794.
…msLayout is set for Tablet but not on mobile devices (dotnet#26152)"

This reverts commit 4b9074c.
@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz self-requested a review January 31, 2025 10:20
@jfversluis jfversluis merged commit 664caaf into dotnet:main Jan 31, 2025
104 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-editor Editor community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ManualMauiTests] New text in the Editor character spacing test sometimes uses the previous spacing

8 participants