Skip to content

Commit 7ab8bd0

Browse files
github-actions[bot]Tsvetomir-Hrdimodi
authored
Merge Tsvetomir-Hr-patch-1-2738 into production (#2741)
* chore: polish kb * Update knowledge-base/editor-get-selection.md Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com> --------- Co-authored-by: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent da8ee99 commit 7ab8bd0

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

knowledge-base/editor-get-selection.md

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
title: Get the content of the Editor selected by the user
3-
description: How to get the content of the Editor selected by the user
3+
description: Learn how to retrieve the selected text from the Telerik Editor using JavaScript to apply custom formatting dynamically.
44
type: how-to
55
page_title: Get the user selection in the Editor
66
slug: editor-kb-get-selection
7-
position:
8-
tags:
7+
tags: blazor, editor, selection
98
res_type: kb
109
---
1110

@@ -53,23 +52,22 @@ If you want to use it on the .NET (Blazor) side, you need to:
5352
5453
@inject IJSRuntime js
5554
56-
<TelerikEditor Tools="@Tools" @bind-Value="@TheEditorContent" EditMode="@EditorEditMode.Iframe">
55+
<TelerikEditor Tools="@Tools" @bind-Value="@TheEditorContent" EditMode="@EditorEditMode.Div">
5756
<EditorCustomTools>
5857
<EditorCustomTool Name="GetSelectedText">
5958
<TelerikButton OnClick="@GetSelectedText">Get selected text</TelerikButton>
6059
</EditorCustomTool>
6160
</EditorCustomTools>
6261
</TelerikEditor>
6362
64-
6563
Selected text: @SelectedText
6664
6765
@code {
68-
string TheEditorContent { get; set; } = "<h1>Lorem ipsum</h1><p>Dolor sit amet.</p>";
69-
List<IEditorTool> Tools { get; set; }
70-
public string SelectedText { get; set; }
66+
private string TheEditorContent { get; set; } = "<h1>Lorem ipsum</h1><p>Dolor sit amet.</p>";
67+
private List<IEditorTool> Tools { get; set; }
68+
private string SelectedText { get; set; }
7169
72-
async Task GetSelectedText()
70+
private async Task GetSelectedText()
7371
{
7472
SelectedText = await js.InvokeAsync<string>("getSelectedText");
7573
}
@@ -120,15 +118,14 @@ If you want to use it on the .NET (Blazor) side, you need to:
120118
</EditorCustomTools>
121119
</TelerikEditor>
122120
123-
124121
Selected text: @SelectedText
125122
126123
@code {
127-
string TheEditorContent { get; set; } = "<h1>Lorem ipsum</h1><p>Dolor sit amet.</p>";
128-
List<IEditorTool> Tools { get; set; }
129-
public string SelectedText { get; set; }
124+
private string TheEditorContent { get; set; } = "<h1>Lorem ipsum</h1><p>Dolor sit amet.</p>";
125+
private List<IEditorTool> Tools { get; set; }
126+
private string SelectedText { get; set; }
130127
131-
async Task GetSelectedText()
128+
private async Task GetSelectedText()
132129
{
133130
SelectedText = await js.InvokeAsync<string>("getSelectedText");
134131
}

0 commit comments

Comments
 (0)