Add a method to delete selection content

This commit is contained in:
Théo Poizat
2025-12-18 16:45:21 +01:00
committed by Dat H. Pham
parent 088b922b0e
commit 1a79445711
2 changed files with 15 additions and 0 deletions
+11
View File
@@ -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');