GetSelectionAsync() return lower letters
hi.
I want to get the selected string while preserving case.
but method return always lower cases.
Am I using the method incorrectly, or is there another method that does what I want?
Thank you.
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
VJ
Vinitha Jeyakumar
Syncfusion Team
February 20, 2025 06:16 AM UTC
Hi Pandango,
We did not encounter any issues, as you reported, while using the GetSelectionAsync function to retrieve the selected text from the Editor. It correctly retrieves both uppercase and lowercase letters without any problems. We have also prepared a video illustration and sample for your reference,
If still issue persists, share us with the issue replicating code snippet, exact issue replication steps and your Syncfusion package version details to validate further.
Regards,
Vinitha
Attachment: SampleVideo_2e290d6d.zip
PA
Pandango
February 20, 2025 11:11 AM UTC
I was wrong, GetSelectionAsync gets the correct case.
But when I set the id in the code below, it is set to all lowercase in the HTML.
string selectedValue = await this.RteObj.GetSelectionAsync();
await this.RteObj.ExecuteCommandAsync(CommandName.FormatBlock, $“h2 id=‘{selectedValue}’”);
I've googled the problem and some places say it's a quirk of HTML and some places say to manipulate the DOM with Javascript to fix it, but I'm believe RTE has options of its own.
Incidentally, what I ultimately want is for the selected text to have its own content as its own id.
Thank you.
VJ
Vinitha Jeyakumar
Syncfusion Team
February 21, 2025 11:08 AM UTC
Hi Pandango,
Your requirement to have own content as its own id for the selected text can be achieved by using the Jsinterop like below,
Code snippet:
RichTextEditorFeatures.razor
|
Host.cshtml
|
Sample attached below,
Regards,
Vinitha
Attachment: RTE_Server_new_13c91846.zip
Marked as answer
PA
Pandango
February 21, 2025 04:17 PM UTC
It's work! Thank you! you are my hero
VJ
Vinitha Jeyakumar
Syncfusion Team
February 24, 2025 05:43 AM UTC
Hi Pandango,
You are welcome.
Regards,
Vinitha
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
PA Pandango
- Feb 19, 2025 07:59 AM UTC
- Feb 24, 2025 05:43 AM UTC