From e954b3a6482027761facea9b56694ccb5946259b Mon Sep 17 00:00:00 2001 From: li3317 Date: Thu, 25 Nov 2021 15:01:14 -0500 Subject: [PATCH 1/5] handle click on embed object --- lib/src/translations/toolbar.i18n.dart | 5 +++-- lib/src/widgets/text_line.dart | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/translations/toolbar.i18n.dart b/lib/src/translations/toolbar.i18n.dart index 353b6c27..d8eba561 100644 --- a/lib/src/translations/toolbar.i18n.dart +++ b/lib/src/translations/toolbar.i18n.dart @@ -74,14 +74,15 @@ extension Localization on String { 'Gallery': 'Galeria', 'Link': 'Enlace', 'Please first select some text to transform into a link.': - 'Por favor selecciona primero un texto para transformarlo en un enlace', + 'Por favor selecciona primero un texto para transformarlo ' + 'en un enlace', }, 'tr': { 'Paste a link': 'Bağlantıyı Yapıştır', 'Ok': 'Tamam', 'Select Color': 'Renk Seçin', 'Gallery': 'Galeri', - 'Link': 'Bağlantı', + 'Link': 'Bağlantı', 'Please first select some text to transform into a link.': 'Lütfen bağlantıya dönüştürmek için bir metin seçin.', }, diff --git a/lib/src/widgets/text_line.dart b/lib/src/widgets/text_line.dart index e9e5f229..0990e797 100644 --- a/lib/src/widgets/text_line.dart +++ b/lib/src/widgets/text_line.dart @@ -876,7 +876,14 @@ class RenderEditableTextLine extends RenderEditableBox { @override bool hitTestChildren(BoxHitTestResult result, {required Offset position}) { - return _children.first.hitTest(result, position: position); + if (_body == null) return false; + final parentData = _body!.parentData as BoxParentData; + return result.addWithPaintOffset( + offset: parentData.offset, + position: position, + hitTest: (result, position) { + return _body!.hitTest(result, position: position); + }); } @override From 65164f768f60a2956b4fb58f19025b34c60bc41a Mon Sep 17 00:00:00 2001 From: li3317 Date: Thu, 25 Nov 2021 22:42:39 -0500 Subject: [PATCH 2/5] upgrade to 2.0.21 --- CHANGELOG.md | 3 +++ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ee25198..d35c67ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [2.0.21] +* Handle click on embed object. + ## [2.0.20] * Improved UX/UI of Image widget. diff --git a/pubspec.yaml b/pubspec.yaml index c158fcdc..2b70bb4e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 2.0.20 +version: 2.0.21 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill From 06463721de46680ecfb1c5fb07354e155b04d086 Mon Sep 17 00:00:00 2001 From: Andy Trand Date: Mon, 29 Nov 2021 09:03:54 +0200 Subject: [PATCH 3/5] ukraine language support (#483) --- README.md | 1 + lib/src/translations/toolbar.i18n.dart | 9 +++++++++ lib/src/widgets/toolbar.dart | 2 ++ 3 files changed, 12 insertions(+) diff --git a/README.md b/README.md index d7efa693..d6b8f5d0 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ Currently, translations are available for these locales: * `Locale('ru')` * `Locale('es')` * `Locale('tr')` +* `Locale('uk')` ### Contributing to translations The translation file is located at [lib/src/translations/toolbar.i18n.dart](lib/src/translations/toolbar.i18n.dart). Feel free to contribute your own translations, just copy the English translations map and replace the values with your translations. Then open a pull request so everyone can benefit from your translations! diff --git a/lib/src/translations/toolbar.i18n.dart b/lib/src/translations/toolbar.i18n.dart index d8eba561..79a834c2 100644 --- a/lib/src/translations/toolbar.i18n.dart +++ b/lib/src/translations/toolbar.i18n.dart @@ -86,6 +86,15 @@ extension Localization on String { 'Please first select some text to transform into a link.': 'Lütfen bağlantıya dönüştürmek için bir metin seçin.', }, + 'uk': { + 'Paste a link': 'Вставити посилання', + 'Ok': 'ОК', + 'Select Color': 'Вибрати колір', + 'Gallery': 'Галерея', + 'Link': 'Посилання', + 'Please first select some text to transform into a link.': + 'Виділіть текст для створення посилання.', + }, }; String get i18n => localize(this, _t); diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 7115ff2c..68960fbf 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -122,6 +122,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { /// * Locale('de') /// * Locale('fr') /// * Locale('zh') + /// and more https://github.com/singerdmx/flutter-quill#translation-of-toolbar Locale? locale, Key? key, }) { @@ -439,6 +440,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { /// * Locale('de') /// * Locale('fr') /// * Locale('zh', 'CN') + /// and more https://github.com/singerdmx/flutter-quill#translation-of-toolbar final Locale? locale; @override From 477f3fc72f33409f8eb6ced37be09f0e733d3c89 Mon Sep 17 00:00:00 2001 From: Andy Trand Date: Mon, 29 Nov 2021 09:04:08 +0200 Subject: [PATCH 4/5] targetChild error temporary fix (#484) --- lib/src/widgets/editor.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index 48524ca1..c67e2e8a 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -1192,7 +1192,11 @@ class RenderEditableContainerBox extends RenderBox if (targetChild.getContainer() == targetNode) { break; } - targetChild = childAfter(targetChild); + final newChild = childAfter(targetChild); + if (newChild == null) { + break; + } + targetChild = newChild; } if (targetChild == null) { throw 'targetChild should not be null'; From 3b9ac9f411f6e8f646dcebc18cc01470cf98c8e4 Mon Sep 17 00:00:00 2001 From: Andriy Trubchanin Date: Mon, 29 Nov 2021 17:20:55 +0200 Subject: [PATCH 5/5] fix attributes compare --- lib/src/models/quill_delta.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/models/quill_delta.dart b/lib/src/models/quill_delta.dart index 47bbde2a..e4a11055 100644 --- a/lib/src/models/quill_delta.dart +++ b/lib/src/models/quill_delta.dart @@ -150,6 +150,11 @@ class Operation { /// Returns `true` if [other] operation has the same attributes as this one. bool hasSameAttributes(Operation other) { + // treat null and empty equal + if ((_attributes?.isEmpty ?? true) && + (other._attributes?.isEmpty ?? true)) { + return true; + } return _attributeEquality.equals(_attributes, other._attributes); }