From 05938779972172377a13daa8d169894e01fc9a7a Mon Sep 17 00:00:00 2001 From: Douglas Ward Date: Wed, 3 Apr 2024 13:23:53 -0600 Subject: [PATCH] Remove comments --- .../lib/screens/quill/my_quill_toolbar.dart | 36 +++++++++---------- lib/src/models/documents/document.dart | 5 --- lib/src/models/rules/insert.dart | 3 -- lib/src/widgets/quill/quill_controller.dart | 12 ------- 4 files changed, 18 insertions(+), 38 deletions(-) diff --git a/example/lib/screens/quill/my_quill_toolbar.dart b/example/lib/screens/quill/my_quill_toolbar.dart index 0163b355..5acfb2de 100644 --- a/example/lib/screens/quill/my_quill_toolbar.dart +++ b/example/lib/screens/quill/my_quill_toolbar.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), diff --git a/lib/src/models/documents/document.dart b/lib/src/models/documents/document.dart index 1a1f7f27..99a72e7a 100644 --- a/lib/src/models/documents/document.dart +++ b/lib/src/models/documents/document.dart @@ -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]; diff --git a/lib/src/models/rules/insert.dart b/lib/src/models/rules/insert.dart index e79879d8..731be9cf 100644 --- a/lib/src/models/rules/insert.dart +++ b/lib/src/models/rules/insert.dart @@ -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(); diff --git a/lib/src/widgets/quill/quill_controller.dart b/lib/src/widgets/quill/quill_controller.dart index b91eae0b..a1b17fc6 100644 --- a/lib/src/widgets/quill/quill_controller.dart +++ b/lib/src/widgets/quill/quill_controller.dart @@ -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); }