Remove comments

pull/1801/head
Douglas Ward 1 year ago
parent ea7ba7e712
commit 0593877997
  1. 36
      example/lib/screens/quill/my_quill_toolbar.dart
  2. 5
      lib/src/models/documents/document.dart
  3. 3
      lib/src/models/rules/insert.dart
  4. 12
      lib/src/widgets/quill/quill_controller.dart

@ -223,24 +223,24 @@ class MyQuillToolbar extends StatelessWidget {
'40': '40.0'
},
// headerStyleType: HeaderStyleType.buttons,
buttonOptions: QuillSimpleToolbarButtonOptions(
base: QuillToolbarBaseButtonOptions(
afterButtonPressed: focusNode.requestFocus,
// iconSize: 20,
// iconTheme: QuillIconTheme(
// iconButtonSelectedData: IconButtonData(
// style: IconButton.styleFrom(
// foregroundColor: Colors.blue,
// ),
// ),
// iconButtonUnselectedData: IconButtonData(
// style: IconButton.styleFrom(
// foregroundColor: Colors.red,
// ),
// ),
// ),
),
),
// buttonOptions: QuillSimpleToolbarButtonOptions(
// base: QuillToolbarBaseButtonOptions(
// afterButtonPressed: focusNode.requestFocus,
// // iconSize: 20,
// iconTheme: QuillIconTheme(
// iconButtonSelectedData: IconButtonData(
// style: IconButton.styleFrom(
// foregroundColor: Colors.blue,
// ),
// ),
// iconButtonUnselectedData: IconButtonData(
// style: IconButton.styleFrom(
// foregroundColor: Colors.red,
// ),
// ),
// ),
// ),
// ),
customButtons: [
QuillToolbarCustomButtonOptions(
icon: const Icon(Icons.add_alarm_rounded),

@ -185,11 +185,6 @@ class Document {
}
if (res.offset == 0) {
return rangeStyle = (res.node as Line).collectStyle(res.offset, len);
//COMMENT: Selecting the start of a line, user expects the style to be the visible style of the line including inline styles
// return rangeStyle.removeAll({
// for (final attr in rangeStyle.values)
// if (attr.isInline) attr
// });
}
rangeStyle = (res.node as Line).collectStyle(res.offset - 1, len);
final linkAttribute = rangeStyle.attributes[Attribute.link.key];

@ -560,9 +560,6 @@ class PreserveInlineStylesRule extends InsertRule {
final itr = DeltaIterator(document);
var prev = itr.skip(len == 0 ? index : index + 1);
//
// Inserting at start of line should use style for first character on the line
//
if (prev == null ||
(prev.data is String && (prev.data as String).endsWith('\n'))) {
prev = itr.next();

@ -478,24 +478,13 @@ class QuillController extends ChangeNotifier {
super.dispose();
}
/// Comments:
/// Removed param:
/// 'ChangeSource source' as not used within this function!
/// Added param:
/// insertNewline is non-null when user makes an editing change, true when newline is inserted to allow style to be maintained
void _updateSelection(TextSelection textSelection, {bool insertNewline = false}) {
_selection = textSelection;
final end = document.length - 1;
_selection = selection.copyWith(
baseOffset: math.min(selection.baseOffset, end),
extentOffset: math.min(selection.extentOffset, end));
//
if (keepStyleOnNewLine) {
//
// Update toggledStyle:
// if insertNewline: gets style from preceding/last character entered (if any)
// else clears so style will be style of selection
//
if (insertNewline && selection.start > 0) {
final style = document.collectStyle(selection.start - 1, 0);
final ignoredStyles = style.attributes.values.where(
@ -508,7 +497,6 @@ class QuillController extends ChangeNotifier {
} else {
toggledStyle = const Style();
}
//
onSelectionChanged?.call(textSelection);
}

Loading…
Cancel
Save