Merge remote-tracking branch 'origin/master'

pull/2090/head
AtlasAutocode 8 months ago
commit 72ae847a11
  1. 7
      CHANGELOG.md
  2. 2
      CHANGELOG_DATA.json
  3. 7
      dart_quill_delta/CHANGELOG.md
  4. 2
      dart_quill_delta/pubspec.yaml
  5. 7
      flutter_quill_extensions/CHANGELOG.md
  6. 2
      flutter_quill_extensions/pubspec.yaml
  7. 7
      flutter_quill_test/CHANGELOG.md
  8. 2
      flutter_quill_test/pubspec.yaml
  9. 15
      lib/src/document/document.dart
  10. 2
      pubspec.yaml
  11. 54
      test/document/document_test.dart

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 10.1.4
* Fix: collectStyles for lists and alignments by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2082
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.1.3...v10.1.4
## 10.1.3 ## 10.1.3
* Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078 * Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078

File diff suppressed because one or more lines are too long

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 10.1.4
* Fix: collectStyles for lists and alignments by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2082
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.1.3...v10.1.4
## 10.1.3 ## 10.1.3
* Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078 * Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078

@ -1,6 +1,6 @@
name: dart_quill_delta name: dart_quill_delta
description: A port of quill-js-delta from typescript to dart description: A port of quill-js-delta from typescript to dart
version: 10.1.3 version: 10.1.4
homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 10.1.4
* Fix: collectStyles for lists and alignments by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2082
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.1.3...v10.1.4
## 10.1.3 ## 10.1.3
* Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078 * Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078

@ -1,6 +1,6 @@
name: flutter_quill_extensions name: flutter_quill_extensions
description: Embed extensions for flutter_quill including image, video, formula and etc. description: Embed extensions for flutter_quill including image, video, formula and etc.
version: 10.1.3 version: 10.1.4
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 10.1.4
* Fix: collectStyles for lists and alignments by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2082
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.1.3...v10.1.4
## 10.1.3 ## 10.1.3
* Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078 * Move Controller outside of configurations data class by @AtlasAutocode in https://github.com/singerdmx/flutter-quill/pull/2078

@ -1,6 +1,6 @@
name: flutter_quill_test name: flutter_quill_test
description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases. description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases.
version: 10.1.3 version: 10.1.4
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -192,17 +192,28 @@ class Document {
res = queryChild(--index); res = queryChild(--index);
} }
// //
final style = (res.node as Line).collectStyle(res.offset, 0); var style = (res.node as Line).collectStyle(res.offset, 0);
final remove = <Attribute>{}; final remove = <Attribute>{};
final add = <String, Attribute>{};
for (final attr in style.attributes.values) { for (final attr in style.attributes.values) {
if (!Attribute.inlineKeys.contains(attr.key)) { if (!Attribute.inlineKeys.contains(attr.key)) {
if (!current.containsKey(attr.key)) { if (!current.containsKey(attr.key)) {
remove.add(attr); remove.add(attr);
} else {
/// Trap for type of block attribute is changing
final curAttr = current.attributes[attr.key];
if (curAttr!.value != attr.value) {
remove.add(attr);
add[curAttr.key] = curAttr;
}
} }
} }
} }
if (remove.isNotEmpty) { if (remove.isNotEmpty) {
return style.removeAll(remove); style = style.removeAll(remove);
}
if (add.isNotEmpty) {
style.attributes.addAll(add);
} }
return style; return style;
} }

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter. description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter.
version: 10.1.3 version: 10.1.4
homepage: https://1o24bbs.com/c/bulletjournal/108/ homepage: https://1o24bbs.com/c/bulletjournal/108/
repository: https://github.com/singerdmx/flutter-quill/ repository: https://github.com/singerdmx/flutter-quill/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -4,6 +4,60 @@ import 'package:test/test.dart';
void main() { void main() {
group('collectStyle', () { group('collectStyle', () {
/// Lists and alignments have the same block attribute key but can have different values.
/// Changing the format value updates the document but must also update the toolbar button state
/// by ensuring the collectStyles method returns the attribute selected for the newly entered line.
test('Change block value type', () {
void doTest(Map<String, dynamic> start, Attribute attr,
Map<String, dynamic> change) {
/// Create a document with 2 lines of block attribute using [start]
/// Change the format of the last line using [attr] and verify [change]
final delta = Delta()
..insert('A')
..insert('\n', start)
..insert('B')
..insert('\n', start);
final document = Document.fromDelta(delta)
/// insert a newline
..insert(3, '\n');
/// Verify inserted blank line and block type has not changed
expect(
document.toDelta(),
Delta()
..insert('A')
..insert('\n', start)
..insert('B')
..insert('\n\n', start));
/// Change format of last (empty) line
document.format(4, 0, attr);
expect(
document.toDelta(),
Delta()
..insert('A')
..insert('\n', start)
..insert('B')
..insert('\n', start)
..insert('\n', change),
reason: 'document updated');
/// Verify that the reported style reflects the newly formatted state
expect(document.collectStyle(4, 0), Style.attr({attr.key: attr}),
reason: 'collectStyle reporting correct attribute');
}
doTest({'list': 'ordered'}, const ListAttribute('bullet'),
{'list': 'bullet'});
doTest({'list': 'checked'}, const ListAttribute('bullet'),
{'list': 'bullet'});
doTest({'align': 'center'}, const AlignAttribute('right'),
{'align': 'right'});
doTest({'align': 'left'}, const AlignAttribute('center'),
{'align': 'center'});
});
/// Enter key inserts newline as plain text without inline styles. /// Enter key inserts newline as plain text without inline styles.
/// collectStyle needs to retrieve style of preceding line /// collectStyle needs to retrieve style of preceding line
test('Simulate double enter key at end', () { test('Simulate double enter key at end', () {

Loading…
Cancel
Save