Skip to content

Commit 42ee423

Browse files
Updated the missing APIs in RTE UG
1 parent 01b8dfc commit 42ee423

File tree

2 files changed

+267
-42
lines changed

2 files changed

+267
-42
lines changed

MAUI/Rich-Text-Editor/Basic-Features.md

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -90,97 +90,121 @@ richTextEditor.Placeholder = "Type Here...";
9090

9191
## Events
9292

93-
### TextChanged Event
93+
### FormatChanged Event
9494

95-
The `TextChanged` event is fired whenever the content in the editor is changed. The event arguments provide the old and new HTML content.
95+
The `FormatChanged` event is Occurs when the formatting status changes. This is useful for implementing contextual formatting options.
9696

9797
{% tabs %}
9898

9999
{% highlight xaml %}
100100

101-
<rte:SfRichTextEditor TextChanged="OnTextChanged" />
101+
<rte:SfRichTextEditor FormatChanged="OnFormatChanged" />
102102

103103
{% endhighlight %}
104104

105105
{% highlight c# %}
106106

107-
private void OnTextChanged(object sender, RichTextEditorTextChangedEventArgs e)
107+
private void OnFormatChanged(object sender, RichTextEditorFormatChangedEventArgs e)
108108
{
109-
string oldHtml = e.OldValue;
110-
string newHtml = e.NewValue;
111-
// Logic to execute when the Text changes.
109+
// Handle when format changed
112110
}
113111

114112
{% endhighlight %}
115113

116114
{% endtabs %}
117115

118-
### FormatChanged Event
116+
### HyperlinkClicked Event
119117

120-
The `FormatChanged` event is Occurs when the formatting status changes. This is useful for implementing contextual formatting options.
118+
The `HyperlinkClicked` event is fired when a user taps on a hyperlink within the content. The event arguments contain the URL and the text of the Clicked link.
121119

122120
{% tabs %}
123121

124122
{% highlight xaml %}
125123

126-
<rte:SfRichTextEditor FormatChanged="OnFormatChanged" />
124+
<rte:SfRichTextEditor HyperlinkClicked="OnHyperlinkClicked"/>
127125

128126
{% endhighlight %}
129127

130128
{% highlight c# %}
131129

132-
private void OnFormatChanged(object sender, RichTextEditorFormatChangedEventArgs e)
130+
SfRichTextEditor richTextEditor = new SfRichTextEditor();
131+
richTextEditor.Text = "<p>Visit the <a href='https://www.syncfusion.com'>Syncfusion</a> website.</p>";
132+
richTextEditorHyperlinkClicked += OnHyperlinkClicked
133+
134+
135+
private void OnHyperlinkClicked(object sender, RichTextEditorHyperlinkClickedEventArgs e)
133136
{
134-
// Logic to execute when the Format changes.
137+
string url = e.URL;
138+
string text = e.DisplayText;
139+
// Handle when hyperlink clicked
135140
}
136141

137142
{% endhighlight %}
138143

139144
{% endtabs %}
140145

141-
### HyperlinkClicked Event
146+
### TextChanged Event
142147

143-
The `HyperlinkClicked` event is fired when a user taps on a hyperlink within the content. The event arguments contain the URL and the text of the Clicked link.
148+
The `TextChanged` event is fired whenever the content in the editor is changed. The event arguments provide the old and new HTML content.
144149

145150
{% tabs %}
146151

147152
{% highlight xaml %}
148153

149-
<rte:SfRichTextEditor HyperlinkClicked="OnHyperlinkClicked"/>
154+
<rte:SfRichTextEditor TextChanged="OnTextChanged" />
150155

151156
{% endhighlight %}
152157

153158
{% highlight c# %}
154159

155-
SfRichTextEditor richTextEditor = new SfRichTextEditor();
156-
richTextEditor.Text = "<p>Visit the <a href='https://www.syncfusion.com'>Syncfusion</a> website.</p>";
157-
richTextEditorHyperlinkClicked += OnHyperlinkClicked
158-
159-
160-
private void OnHyperlinkClicked(object sender, RichTextEditorHyperlinkClickedEventArgs e)
160+
private void OnTextChanged(object sender, RichTextEditorTextChangedEventArgs e)
161161
{
162-
string url = e.URL;
163-
string text = e.DisplayText;
164-
// You can handle the navigation here, for example:
162+
string oldHtml = e.OldValue;
163+
string newHtml = e.NewValue;
164+
// Handle when Text changed
165165
}
166166

167167
{% endhighlight %}
168168

169169
{% endtabs %}
170170

171-
## Focus Management
172171

173-
You can programmatically set or remove focus from the editor control using the `Focus()` and `Unfocus()` methods.
172+
### Focused Event
173+
174+
The `Focused` event occurs when the Rich Text Editor receives input focus.
174175

175176
{% tabs %}
176177

177-
{% highlight C# %}
178+
{% highlight xaml %}
179+
<rte:SfRichTextEditor Focused="OnEditorFocused" />
180+
{% endhighlight %}
181+
182+
{% highlight c# %}
183+
richTextEditor.Focused += OnEditorFocused;
184+
185+
private void OnEditorFocused(object sender, EventArgs e)
186+
{
187+
// Handle when editor focused
188+
}
189+
{% endhighlight %}
190+
{% endtabs %}
178191

179-
// To set focus on the Rich Text Editor
180-
richTextEditor.Focus();
192+
### Unfocused Event
181193

182-
// To remove focus from the Rich Text Editor
183-
richTextEditor.Unfocus();
194+
The `Unfocused` event occurs when the Rich Text Editor loses input focus.
195+
196+
{% tabs %}
184197

198+
{% highlight xaml %}
199+
<rte:SfRichTextEditor Unfocused="OnEditorUnfocused" />
200+
{% endhighlight %}
201+
202+
{% highlight c# %}
203+
richTextEditor.Unfocused += OnEditorUnfocused;
204+
205+
private void OnEditorUnfocused(object sender, EventArgs e)
206+
{
207+
// Handle when editor loses focus
208+
}
185209
{% endhighlight %}
186210
{% endtabs %}

0 commit comments

Comments
 (0)