fix inserting tab character in lists (#1171)

pull/1177/head
bohdanudreambit 2 years ago committed by GitHub
parent 351bcb95c8
commit 871b413544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      lib/src/widgets/raw_editor.dart

@ -665,18 +665,22 @@ class RawEditorState extends EditorState
return insertTabCharacter(); return insertTabCharacter();
} }
if (node.isNotEmpty && (node.first as leaf.Text).value.isNotEmpty) {
return insertTabCharacter();
}
final parentBlock = parent; final parentBlock = parent;
if (parentBlock.style.containsKey(Attribute.ol.key) || if (parentBlock.style.containsKey(Attribute.ol.key) ||
parentBlock.style.containsKey(Attribute.ul.key) || parentBlock.style.containsKey(Attribute.ul.key) ||
parentBlock.style.containsKey(Attribute.checked.key)) { parentBlock.style.containsKey(Attribute.checked.key)) {
if (node.isNotEmpty && (node.first as leaf.Text).value.isNotEmpty
&& controller.selection.base.offset > node.documentOffset) {
return insertTabCharacter();
}
controller.indentSelection(!event.isShiftPressed); controller.indentSelection(!event.isShiftPressed);
return KeyEventResult.handled; return KeyEventResult.handled;
} }
if (node.isNotEmpty && (node.first as leaf.Text).value.isNotEmpty) {
return insertTabCharacter();
}
return insertTabCharacter(); return insertTabCharacter();
} }

Loading…
Cancel
Save