Skip to content

Commit 9244b32

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 5ab658f + c8b9df5 commit 9244b32

File tree

98 files changed

+4950
-4510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4950
-4510
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
All notable changes to this project will be documented in this file.
66

7+
## 10.5.18
8+
9+
* feat(web): rich text paste from Clipboard using HTML by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2009
10+
* revert: disable rich text paste feature on web as a workaround by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2221
11+
* refactor: moved shortcuts and onKeyEvents to its own file by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2223
12+
13+
14+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.17...v10.5.18
15+
16+
## 10.5.17
17+
18+
* feat(l10n): localize all untranslated.json by @erdnx in https://github.com/singerdmx/flutter-quill/pull/2217
19+
* Fix: Block Attributes are not displayed if the editor is empty by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2210
20+
21+
## New Contributors
22+
* @erdnx made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2217
23+
24+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.16...v10.5.17
25+
726
## 10.5.16
827

928
* chore: remove device_info_plus and add quill_native_bridge to access platform specific APIs by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2194

CHANGELOG_DATA.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"10.5.18": "* feat(web): rich text paste from Clipboard using HTML by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2009\r\n* revert: disable rich text paste feature on web as a workaround by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2221\r\n* refactor: moved shortcuts and onKeyEvents to its own file by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2223\r\n\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.17...v10.5.18",
3+
"10.5.17": "* feat(l10n): localize all untranslated.json by @erdnx in https://github.com/singerdmx/flutter-quill/pull/2217\r\n* Fix: Block Attributes are not displayed if the editor is empty by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2210\r\n\r\n## New Contributors\r\n* @erdnx made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2217\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.16...v10.5.17",
24
"10.5.16": "* chore: remove device_info_plus and add quill_native_bridge to access platform specific APIs by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2194\r\n* Not show/update/hiden mangnifier when manifier config is disbale by @demoYang in https://github.com/singerdmx/flutter-quill/pull/2212\r\n\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.14...v10.5.16",
35
"10.5.15-dev.0": "Introduce `quill_native_bridge` which is an internal plugin to use by `flutter_quill` to access platform APIs.\r\n\r\nFor now, the only functionality it supports is to check whatever the iOS app is running on iOS simulator without requiring [`device_info_plus`](pub.dev/packages/device_info_plus) as a dependency.\r\n\r\n> [!NOTE]\r\n> `quill_native_bridge` is a plugin for internal use and should not be used in production applications\r\n> as breaking changes can happen and can removed at any time.\r\n\r\nFor more details and discussion see [#2194](https://github.com/singerdmx/flutter-quill/pull/2194).\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.14...v10.5.15-dev.0",
46
"10.5.14": "* chore(localization): add Greek language support by @DKalathas in https://github.com/singerdmx/flutter-quill/pull/2206\r\n\r\n## New Contributors\r\n* @DKalathas made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2206\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.13...v10.5.14",

dart_quill_delta/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
All notable changes to this project will be documented in this file.
66

7+
## 10.5.18
8+
9+
* feat(web): rich text paste from Clipboard using HTML by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2009
10+
* revert: disable rich text paste feature on web as a workaround by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2221
11+
* refactor: moved shortcuts and onKeyEvents to its own file by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2223
12+
13+
14+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.17...v10.5.18
15+
16+
## 10.5.17
17+
18+
* feat(l10n): localize all untranslated.json by @erdnx in https://github.com/singerdmx/flutter-quill/pull/2217
19+
* Fix: Block Attributes are not displayed if the editor is empty by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2210
20+
21+
## New Contributors
22+
* @erdnx made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2217
23+
24+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.16...v10.5.17
25+
726
## 10.5.16
827

928
* chore: remove device_info_plus and add quill_native_bridge to access platform specific APIs by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2194

dart_quill_delta/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_quill_delta
22
description: A port of quill-js-delta from typescript to dart
3-
version: 10.5.16
3+
version: 10.5.18
44
homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
55
repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
66
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

flutter_quill_extensions/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
All notable changes to this project will be documented in this file.
66

7+
## 10.5.18
8+
9+
* feat(web): rich text paste from Clipboard using HTML by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2009
10+
* revert: disable rich text paste feature on web as a workaround by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2221
11+
* refactor: moved shortcuts and onKeyEvents to its own file by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2223
12+
13+
14+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.17...v10.5.18
15+
16+
## 10.5.17
17+
18+
* feat(l10n): localize all untranslated.json by @erdnx in https://github.com/singerdmx/flutter-quill/pull/2217
19+
* Fix: Block Attributes are not displayed if the editor is empty by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2210
20+
21+
## New Contributors
22+
* @erdnx made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2217
23+
24+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.16...v10.5.17
25+
726
## 10.5.16
827

928
* chore: remove device_info_plus and add quill_native_bridge to access platform specific APIs by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2194

flutter_quill_extensions/lib/flutter_quill_extensions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export 'src/editor/video/video_web_embed.dart';
2626
export 'src/editor_toolbar_shared/shared_configurations.dart';
2727
export 'src/flutter_quill_embeds.dart';
2828
export 'src/toolbar/camera/camera_button.dart';
29+
export 'src/toolbar/camera/camera_types.dart';
2930
export 'src/toolbar/camera/models/camera_configurations.dart';
3031
export 'src/toolbar/formula/formula_button.dart';
3132
export 'src/toolbar/formula/models/formula_configurations.dart';

flutter_quill_extensions/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_quill_extensions
22
description: Embed extensions for flutter_quill including image, video, formula and etc.
3-
version: 10.5.16
3+
version: 10.5.18
44
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
55
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
66
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

flutter_quill_test/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
All notable changes to this project will be documented in this file.
66

7+
## 10.5.18
8+
9+
* feat(web): rich text paste from Clipboard using HTML by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2009
10+
* revert: disable rich text paste feature on web as a workaround by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2221
11+
* refactor: moved shortcuts and onKeyEvents to its own file by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2223
12+
13+
14+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.17...v10.5.18
15+
16+
## 10.5.17
17+
18+
* feat(l10n): localize all untranslated.json by @erdnx in https://github.com/singerdmx/flutter-quill/pull/2217
19+
* Fix: Block Attributes are not displayed if the editor is empty by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2210
20+
21+
## New Contributors
22+
* @erdnx made their first contribution in https://github.com/singerdmx/flutter-quill/pull/2217
23+
24+
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.5.16...v10.5.17
25+
726
## 10.5.16
827

928
* chore: remove device_info_plus and add quill_native_bridge to access platform specific APIs by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2194

flutter_quill_test/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_quill_test
22
description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases.
3-
version: 10.5.16
3+
version: 10.5.18
44
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
55
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
66
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

lib/src/controller/quill_controller.dart

Lines changed: 17 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import 'dart:math' as math;
22

3+
import 'package:flutter/foundation.dart' show kIsWeb;
34
import 'package:flutter/services.dart' show ClipboardData, Clipboard;
45
import 'package:flutter/widgets.dart';
5-
import 'package:html/parser.dart' as html_parser;
66
import 'package:meta/meta.dart' show experimental;
77

88
import '../../quill_delta.dart';
99
import '../common/structs/image_url.dart';
1010
import '../common/structs/offset_value.dart';
1111
import '../common/utils/embeds.dart';
1212
import '../delta/delta_diff.dart';
13-
import '../delta/delta_x.dart';
1413
import '../document/attribute.dart';
1514
import '../document/document.dart';
1615
import '../document/nodes/embeddable.dart';
1716
import '../document/nodes/leaf.dart';
1817
import '../document/structs/doc_change.dart';
1918
import '../document/style.dart';
2019
import '../editor/config/editor_configurations.dart';
21-
import '../editor_toolbar_controller_shared/clipboard/clipboard_service_provider.dart';
2220
import '../toolbar/config/simple_toolbar_configurations.dart';
2321
import 'quill_controller_configurations.dart';
22+
import 'quill_controller_rich_paste.dart';
23+
24+
import 'web/quill_controller_web_stub.dart'
25+
if (dart.library.html) 'web/quill_controller_web_real.dart';
2426

2527
typedef ReplaceTextCallback = bool Function(int index, int len, Object? data);
2628
typedef DeleteCallback = void Function(int cursorPosition, bool forward);
@@ -38,7 +40,11 @@ class QuillController extends ChangeNotifier {
3840
this.readOnly = false,
3941
this.editorFocusNode,
4042
}) : _document = document,
41-
_selection = selection;
43+
_selection = selection {
44+
if (kIsWeb) {
45+
initializeWebPasteEvent();
46+
}
47+
}
4248

4349
factory QuillController.basic(
4450
{QuillControllerConfigurations configurations =
@@ -132,8 +138,8 @@ class QuillController extends ChangeNotifier {
132138

133139
bool ignoreFocusOnTextChange = false;
134140

135-
/// Skip requestKeyboard being called in
136-
/// RawEditorState#_didChangeTextEditingValue
141+
/// Skip requestKeyboard being called
142+
/// in [QuillRawEditorState._didChangeTextEditingValue]
137143
bool skipRequestKeyboard = false;
138144

139145
/// True when this [QuillController] instance has been disposed.
@@ -472,6 +478,9 @@ class QuillController extends ChangeNotifier {
472478
}
473479

474480
_isDisposed = true;
481+
if (kIsWeb) {
482+
closeWebPasteEvent();
483+
}
475484
super.dispose();
476485
}
477486

@@ -565,13 +574,13 @@ class QuillController extends ChangeNotifier {
565574
return true;
566575
}
567576

568-
final pasteUsingHtmlSuccess = await _pasteHTML();
577+
final pasteUsingHtmlSuccess = await pasteHTML();
569578
if (pasteUsingHtmlSuccess) {
570579
updateEditor?.call();
571580
return true;
572581
}
573582

574-
final pasteUsingMarkdownSuccess = await _pasteMarkdown();
583+
final pasteUsingMarkdownSuccess = await pasteMarkdown();
575584
if (pasteUsingMarkdownSuccess) {
576585
updateEditor?.call();
577586
return true;
@@ -616,15 +625,6 @@ class QuillController extends ChangeNotifier {
616625
return false;
617626
}
618627

619-
void _pasteUsingDelta(Delta deltaFromClipboard) {
620-
replaceText(
621-
selection.start,
622-
selection.end - selection.start,
623-
deltaFromClipboard,
624-
TextSelection.collapsed(offset: selection.end),
625-
);
626-
}
627-
628628
/// Return true if can paste internal image
629629
Future<bool> _pasteInternalImage() async {
630630
final copiedImageUrl = _copiedImageUrl;
@@ -653,59 +653,6 @@ class QuillController extends ChangeNotifier {
653653
return false;
654654
}
655655

656-
/// Return true if can paste using HTML
657-
Future<bool> _pasteHTML() async {
658-
final clipboardService = ClipboardServiceProvider.instance;
659-
660-
Future<String?> getHTML() async {
661-
if (await clipboardService.canProvideHtmlTextFromFile()) {
662-
return await clipboardService.getHtmlTextFromFile();
663-
}
664-
if (await clipboardService.canProvideHtmlText()) {
665-
return await clipboardService.getHtmlText();
666-
}
667-
return null;
668-
}
669-
670-
final htmlText = await getHTML();
671-
if (htmlText != null) {
672-
final htmlBody = html_parser.parse(htmlText).body?.outerHtml;
673-
// ignore: deprecated_member_use_from_same_package
674-
final deltaFromClipboard = DeltaX.fromHtml(htmlBody ?? htmlText);
675-
676-
_pasteUsingDelta(deltaFromClipboard);
677-
678-
return true;
679-
}
680-
return false;
681-
}
682-
683-
/// Return true if can paste using Markdown
684-
Future<bool> _pasteMarkdown() async {
685-
final clipboardService = ClipboardServiceProvider.instance;
686-
687-
Future<String?> getMarkdown() async {
688-
if (await clipboardService.canProvideMarkdownTextFromFile()) {
689-
return await clipboardService.getMarkdownTextFromFile();
690-
}
691-
if (await clipboardService.canProvideMarkdownText()) {
692-
return await clipboardService.getMarkdownText();
693-
}
694-
return null;
695-
}
696-
697-
final markdownText = await getMarkdown();
698-
if (markdownText != null) {
699-
// ignore: deprecated_member_use_from_same_package
700-
final deltaFromClipboard = DeltaX.fromMarkdown(markdownText);
701-
702-
_pasteUsingDelta(deltaFromClipboard);
703-
704-
return true;
705-
}
706-
return false;
707-
}
708-
709656
void replaceTextWithEmbeds(
710657
int index,
711658
int len,

0 commit comments

Comments
 (0)