You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide explains how to integrate a full-featured AI writing assistant into the Blazor Rich Text Editor using Azure OpenAI (via Semantic Kernel). The implementation supports **Rephrase**, **Correct Grammar**, **Summarize**, **Elaborate**, and **Translate** with live preview, dynamic tone/language controls, skeleton loading, and safe, undoable content replacement.
234
234
235
-
## How the Custom Toolbar is Rendered
235
+
###How the Custom Toolbar is Rendered
236
236
237
237
The toolbar uses [RichTextEditorCustomToolbarItems](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.RichTextEditorCustomToolbarItems.html) to inject a custom item named AI.
238
238
@@ -278,11 +278,11 @@ An additional `SfButton` for **Rephrase** is provided for quick access.
278
278
{% endhighlight %}
279
279
{% endtabs %}
280
280
281
-
## AI Assistant Dialog – Layout and Dynamic Controls
281
+
###AI Assistant Dialog – Layout and Dynamic Controls
282
282
283
283
The AI Assistant dialog provides a responsive, user-friendly interface for interacting with AI-generated content. It is designed as a modal dialog that overlays the editor and ensures proper z-index stacking for seamless integration.
284
284
285
-
### Dialog Structure
285
+
####Dialog Structure
286
286
287
287
The dialog is divided into two main rows:
288
288
@@ -436,7 +436,7 @@ The dialog is divided into two main rows:
436
436
{% endhighlight %}
437
437
{% endtabs %}
438
438
439
-
## Opening the AI Dialog and Preserving Selection
439
+
###Opening the AI Dialog and Preserving Selection
440
440
441
441
The `DialogueOpen()` method opens the AI dialog when an action is selected and prepares the editor for processing. It first uses `GetSelectedHtmlAsync()` to capture the highlighted content with its formatting. If no text is selected, a toast message alerts the user to select content before proceeding.
## Replacing AI Result Back into the Editor (with Undo Support)
567
+
###Replacing AI Result Back into the Editor (with Undo Support)
568
568
569
569
Once the AI-generated content is ready, it needs to be inserted exactly where the user originally selected text, without disturbing the rest of the document. This is achieved using the [ExecuteCommandAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.SfRichTextEditor.html#Syncfusion_Blazor_RichTextEditor_SfRichTextEditor_ExecuteCommandAsync_Syncfusion_Blazor_RichTextEditor_CommandName_System_String_Syncfusion_Blazor_RichTextEditor_ExecuteCommandOption_) method with the `InsertHTML` command. The `Undo` option is enabled to allow users to revert changes if needed.
0 commit comments