Fixed keepStyleOnNewLine

The “keepStyleOnNewLine” parameter in the Controller class is no longer functional.
pull/1262/head
liam-duan 2 years ago committed by GitHub
parent b883f727d8
commit b3ed417cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      lib/src/widgets/controller.dart

@ -255,14 +255,6 @@ class QuillController extends ChangeNotifier {
} }
} }
if (_keepStyleOnNewLine) {
final style = getSelectionStyle();
final notInlineStyle = style.attributes.values.where((s) => !s.isInline);
toggledStyle = style.removeAll(notInlineStyle.toSet());
} else {
toggledStyle = Style();
}
if (textSelection != null) { if (textSelection != null) {
if (delta == null || delta.isEmpty) { if (delta == null || delta.isEmpty) {
_updateSelection(textSelection, ChangeSource.LOCAL); _updateSelection(textSelection, ChangeSource.LOCAL);
@ -400,7 +392,13 @@ class QuillController extends ChangeNotifier {
_selection = selection.copyWith( _selection = selection.copyWith(
baseOffset: math.min(selection.baseOffset, end), baseOffset: math.min(selection.baseOffset, end),
extentOffset: math.min(selection.extentOffset, end)); extentOffset: math.min(selection.extentOffset, end));
if (_keepStyleOnNewLine) {
final style = getSelectionStyle();
final notInlineStyle = style.attributes.values.where((s) => !s.isInline);
toggledStyle = style.removeAll(notInlineStyle.toSet());
} else {
toggledStyle = Style(); toggledStyle = Style();
}
onSelectionChanged?.call(textSelection); onSelectionChanged?.call(textSelection);
} }

Loading…
Cancel
Save