Bug fix: Can not insert newline when Bold is toggled ON

pull/75/head
Xin Yao 4 years ago
parent 17a38965c8
commit daa774b0f0
  1. 10
      lib/widgets/controller.dart

@ -86,11 +86,19 @@ class QuillController extends ChangeNotifier {
print('document.replace failed: $e');
throw e;
}
final shouldRetainDelta = delta != null &&
bool shouldRetainDelta = delta != null &&
toggledStyle.isNotEmpty &&
delta.isNotEmpty &&
delta.length <= 2 &&
delta.last.isInsert;
if (shouldRetainDelta && toggledStyle.isNotEmpty) {
// if all attributes are inline, shouldRetainDelta should be false
final anyAttributeNotInline =
toggledStyle.values.any((attr) => !attr.isInline);
if (!anyAttributeNotInline) {
shouldRetainDelta = false;
}
}
if (shouldRetainDelta) {
Delta retainDelta = Delta()
..retain(index)

Loading…
Cancel
Save