diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index 984eca5ed..bd1a0f810 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -867,10 +867,7 @@ class ComposerController extends BaseController } } - Future getTextOnlyContentInEditor() async { - try { - final htmlContent = await getContentInEditor(); - + String convertHtmlContentToTextContent(String htmlContent) { String textContent = htmlContent.replaceAll(RegExp(r'<[^>]*>'), ''); textContent = textContent @@ -882,6 +879,15 @@ class ComposerController extends BaseController .replaceAll(''', "'"); return textContent.trim(); + } + + Future getTextOnlyContentInEditor() async { + try { + final htmlContent = await getContentInEditor(); + + String textContent = convertHtmlContentToTextContent(htmlContent); + + return textContent; } catch (e) { logError('ComposerController::getTextOnlyContentInEditor:Exception = $e'); return ''; @@ -918,8 +924,6 @@ class ComposerController extends BaseController ); } - - void showAIScribeMenuForSelectedText(BuildContext context, {Offset? buttonPosition}) { final selection = selectedText.value; if (selection == null || selection.isEmpty) { @@ -943,7 +947,7 @@ class ComposerController extends BaseController if (textSelectionData.coordinates != null) { textSelectionCoordinates.value = Offset( textSelectionData.coordinates!.x, - textSelectionData.coordinates!.y + 6, + textSelectionData.coordinates!.y, ); } else { textSelectionCoordinates.value = null;