Skip to content

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

Merged
jfversluis merged 26 commits into
dotnet: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 into
dotnet:mainfrom
devanathan-vaithiyanathan:fix-17782

Conversation

@devanathan-vaithiyanathan

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

Copy link
Copy Markdown
Contributor

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 Oct 17, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title 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
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor Author

/rebase

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor Author

/rebase

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor Author

/rebase

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

rmarinho commented Dec 6, 2024

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@samhouts
samhouts requested a review from Copilot December 19, 2024 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

/rebase

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
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
@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

8 participants