diff --git a/core/lib/utils/string_convert.dart b/core/lib/utils/string_convert.dart
index fefedf069..a959aeacb 100644
--- a/core/lib/utils/string_convert.dart
+++ b/core/lib/utils/string_convert.dart
@@ -214,4 +214,10 @@ class StringConvert {
return textContent.trim();
}
+
+ static String convertTextContentToHtmlContent(String textContent) {
+ final htmlContent = textContent.replaceAll('\n', '
');
+
+ return '
$htmlContent
';
+ }
}
\ No newline at end of file
diff --git a/lib/features/composer/presentation/extensions/ai_scribe/handle_ai_scribe_in_composer_extension.dart b/lib/features/composer/presentation/extensions/ai_scribe/handle_ai_scribe_in_composer_extension.dart
index 048cc3421..cb58a33dc 100644
--- a/lib/features/composer/presentation/extensions/ai_scribe/handle_ai_scribe_in_composer_extension.dart
+++ b/lib/features/composer/presentation/extensions/ai_scribe/handle_ai_scribe_in_composer_extension.dart
@@ -29,10 +29,15 @@ extension HandleAiScribeInComposerExtension on ComposerController {
}
}
- void insertTextInEditor(String text) {
- final htmlContent = text.replaceAll('\n', '
');
+ void insertTextInEditor(String text) async {
+ final htmlContent = StringConvert.convertTextContentToHtmlContent(text);
if (PlatformInfo.isWeb) {
+ await richTextWebController?.editorController.evaluateJavascriptWeb(
+ HtmlUtils.deleteSelectionContent.name,
+ hasReturnValue: false,
+ );
+
richTextWebController?.editorController.insertHtml(htmlContent);
} else {
richTextMobileTabletController?.htmlEditorApi?.insertHtml(htmlContent);