Merge branch 'master' into new-features-improvements

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

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

@ -1,3 +1,7 @@
## 0.5.0
- Migrated from `gallery_saver` to `gal` for saving images
- Added callbacks for greater control of editing images
## 0.4.1
- Updated dependencies to support image_picker 1.0

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

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

@ -1,6 +1,6 @@
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.
version: 7.4.7
version: 7.4.9
homepage: https://1o24bbs.com/c/bulletjournal/108
repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save