diff --git a/core/lib/utils/html/html_utils.dart b/core/lib/utils/html/html_utils.dart
index 00dab4b69..370137532 100644
--- a/core/lib/utils/html/html_utils.dart
+++ b/core/lib/utils/html/html_utils.dart
@@ -111,6 +111,16 @@ class HtmlUtils {
});''',
name: 'onSelectionChange');
+ static const collapseSelectionToEnd = (
+ script: '''
+ (() => {
+ const selection = window.getSelection();
+ if (selection) {
+ selection.collapseToEnd()
+ }
+ })();''',
+ name: 'collapseSelectionToEnd');
+
static recalculateEditorHeight({double? maxHeight}) => (
script: '''
const editable = document.querySelector('.note-editable');
diff --git a/lib/features/composer/presentation/widgets/web/web_editor_widget.dart b/lib/features/composer/presentation/widgets/web/web_editor_widget.dart
index 9d7127dcc..aa3f3bfc8 100644
--- a/lib/features/composer/presentation/widgets/web/web_editor_widget.dart
+++ b/lib/features/composer/presentation/widgets/web/web_editor_widget.dart
@@ -185,6 +185,10 @@ class _WebEditorState extends State with TextSelectionMixin {
name: HtmlUtils.registerSelectionChangeListener.name,
script: HtmlUtils.registerSelectionChangeListener.script,
),
+ WebScript(
+ name: HtmlUtils.collapseSelectionToEnd.name,
+ script: HtmlUtils.collapseSelectionToEnd.script,
+ ),
WebScript(
name: HtmlUtils.recalculateEditorHeight(maxHeight: maxHeight).name,
script: HtmlUtils.recalculateEditorHeight(maxHeight: maxHeight).script,