diff --git a/CHANGELOG.md b/CHANGELOG.md index 094eee38..40e96aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [7.1.11] +- Add inserting indents for lines of list if text is selected + # [7.1.10] - Image embedding tweaks - Add MediaButton which is intened to superseed the ImageButton and VideoButton. Only image selection is working. diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index b8218f8b..4cbf4193 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -675,17 +675,16 @@ class RawEditorState extends EditorState if (event is! RawKeyDownEvent) { return KeyEventResult.ignored; } + // Handle indenting blocks when pressing the tab key. + if (event.logicalKey == LogicalKeyboardKey.tab) { + return _handleTabKey(event); + } // Don't handle key if there is an active selection. if (controller.selection.baseOffset != controller.selection.extentOffset) { return KeyEventResult.ignored; } - // Handle indenting blocks when pressing the tab key. - if (event.logicalKey == LogicalKeyboardKey.tab) { - return _handleTabKey(event); - } - // Handle inserting lists when space is pressed following // a list initiating phrase. if (event.logicalKey == LogicalKeyboardKey.space) { @@ -736,6 +735,19 @@ class RawEditorState extends EditorState return KeyEventResult.handled; } + if (controller.selection.baseOffset != controller.selection.extentOffset) { + if (child.node == null || child.node!.parent == null) { + return KeyEventResult.handled; + } + final parentBlock = child.node!.parent!; + if (parentBlock.style.containsKey(Attribute.ol.key) || + parentBlock.style.containsKey(Attribute.ul.key) || + parentBlock.style.containsKey(Attribute.checked.key)) { + controller.indentSelection(!event.isShiftPressed); + } + return KeyEventResult.handled; + } + if (child.node == null) { return insertTabCharacter(); } diff --git a/pubspec.yaml b/pubspec.yaml index 24e9ed14..7d497da1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 7.1.10 +version: 7.1.11 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill