Merge branch 'master' into fix-my-issues

pull/1417/head
Ahmed Hnewa 2 years ago committed by GitHub
commit 24eea1e8c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 35
      lib/src/models/documents/document.dart
  3. 13
      lib/src/models/documents/nodes/line.dart
  4. 2
      pubspec.yaml

@ -1,3 +1,9 @@
# [7.4.9]
- Style recognition fixes.
# [7.4.8]
- Upgrade dependencies.
# [7.4.7] # [7.4.7]
- Add Vietnamese and German translations. - Add Vietnamese and German translations.

@ -156,19 +156,28 @@ class Document {
/// included in the result. /// included in the result.
Style collectStyle(int index, int len) { Style collectStyle(int index, int len) {
final res = queryChild(index); final res = queryChild(index);
// -1 because the cursor is at the part of the line that is not visible Style rangeStyle;
// Bug: When the caret is in the middle of the paragraph if (len > 0) {
// and at the end of the format string, it will display the wrong state return (res.node as Line).collectStyle(res.offset, len);
// of the format button }
final isLinkStyle = if (res.offset == 0) {
res.node?.style.attributes[Attribute.link.key]?.value == true; rangeStyle = (res.node as Line).collectStyle(res.offset, len);
// In this case, we have an exception, this is a link. return rangeStyle.removeAll({
// When node is a link we will not -1 for (final attr in rangeStyle.values)
return (res.node as Line).collectStyle( if (attr.isInline) attr
len == 0 && res.node != null && !isLinkStyle });
? res.offset - 1 }
: res.offset, rangeStyle = (res.node as Line).collectStyle(res.offset - 1, len);
len); final linkAttribute = rangeStyle.attributes[Attribute.link.key];
if ((linkAttribute != null) &&
(linkAttribute.value !=
(res.node as Line)
.collectStyle(res.offset, len)
.attributes[Attribute.link.key]
?.value)) {
return rangeStyle.removeAll({linkAttribute});
}
return rangeStyle;
} }
/// Returns all styles and Embed for each node within selection /// Returns all styles and Embed for each node within selection

@ -352,18 +352,13 @@ class Line extends Container<Leaf?> {
final excluded = <Attribute>{}; final excluded = <Attribute>{};
void _handle(Style style) { void _handle(Style style) {
if (result.isEmpty) { for (final attr in result.values) {
excluded.addAll(style.values); if (!style.containsKey(attr.key) ||
} else { (style.attributes[attr.key] != attr.value)) {
for (final attr in result.values) { excluded.add(attr);
if (!style.containsKey(attr.key)) {
excluded.add(attr);
}
} }
} }
final remaining = style.removeAll(excluded);
result = result.removeAll(excluded); result = result.removeAll(excluded);
result = result.mergeAll(remaining);
} }
final data = queryChild(offset, true); final data = queryChild(offset, true);

@ -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: 7.4.7 version: 7.4.9
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

Loading…
Cancel
Save