diff --git a/core/lib/utils/html/html_utils.dart b/core/lib/utils/html/html_utils.dart
index 8b6d60960..ab4d28b65 100644
--- a/core/lib/utils/html/html_utils.dart
+++ b/core/lib/utils/html/html_utils.dart
@@ -122,6 +122,17 @@ class HtmlUtils {
})();''',
name: 'collapseSelectionToEnd');
+ static const deleteSelectionContent = (
+ script: '''
+ (() => {
+ const selection = window.getSelection();
+ if (selection && selection.rangeCount > 0) {
+ const range = selection.getRangeAt(0);
+ range.deleteContents();
+ }
+ })();''',
+ name: 'deleteSelectionContent');
+
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 a0e177d0f..bd97f20f6 100644
--- a/lib/features/composer/presentation/widgets/web/web_editor_widget.dart
+++ b/lib/features/composer/presentation/widgets/web/web_editor_widget.dart
@@ -196,6 +196,10 @@ class _WebEditorState extends State with TextSelectionMixin {
name: HtmlUtils.collapseSelectionToEnd.name,
script: HtmlUtils.collapseSelectionToEnd.script,
),
+ WebScript(
+ name: HtmlUtils.deleteSelectionContent.name,
+ script: HtmlUtils.deleteSelectionContent.script,
+ ),
WebScript(
name: HtmlUtils.recalculateEditorHeight(maxHeight: maxHeight).name,
script: HtmlUtils.recalculateEditorHeight(maxHeight: maxHeight).script,