|
| 1 | +// TODO: This might be removed from here or moved to quill_native_bridge |
| 2 | +// commented in https://github.com/singerdmx/flutter-quill/pull/2293 |
| 3 | +// removed due to bug https://github.com/singerdmx/flutter-quill/issues/2220 |
| 4 | +// added to solve https://github.com/singerdmx/flutter-quill/issues/1998#issuecomment-2361599854 |
| 5 | + |
1 | 6 | // This file should not be exported as the APIs in it are meant for internal usage only |
2 | 7 |
|
3 | | -import 'dart:async' show StreamSubscription; |
| 8 | +// import 'dart:async' show StreamSubscription; |
4 | 9 |
|
5 | | -import 'package:web/web.dart'; |
| 10 | +// import 'package:web/web.dart'; |
6 | 11 |
|
7 | | -import '../quill_controller.dart'; |
8 | | -// ignore: unused_import |
9 | | -import '../quill_controller_rich_paste.dart'; |
| 12 | +// import '../quill_controller.dart'; |
| 13 | +// // ignore: unused_import |
| 14 | +// import '../quill_controller_rich_paste.dart'; |
10 | 15 |
|
11 | | -/// Paste event for the web. |
12 | | -/// |
13 | | -/// Will be `null` when [QuillControllerWeb.initializeWebPasteEvent] was not called |
14 | | -/// or the subscription was canceled due to calling [QuillControllerWeb.cancelWebPasteEvent] |
15 | | -/// |
16 | | -/// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event |
17 | | -StreamSubscription? _webPasteEventSubscription; |
| 16 | +// /// Paste event for the web. |
| 17 | +// /// |
| 18 | +// /// Will be `null` when [QuillControllerWeb.initializeWebPasteEvent] was not called |
| 19 | +// /// or the subscription was canceled due to calling [QuillControllerWeb.cancelWebPasteEvent] |
| 20 | +// /// |
| 21 | +// /// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event |
| 22 | +// StreamSubscription? _webPasteEventSubscription; |
18 | 23 |
|
19 | | -extension QuillControllerWeb on QuillController { |
20 | | - void initializeWebPasteEvent() { |
21 | | - _webPasteEventSubscription = |
22 | | - EventStreamProviders.pasteEvent.forTarget(window.document).listen((e) { |
23 | | - // TODO: See if we can support markdown paste |
24 | | - final html = e.clipboardData?.getData('text/html'); |
25 | | - if (html == null) { |
26 | | - return; |
27 | | - } |
28 | | - // TODO: Temporarily disable the rich text pasting feature as a workaround |
29 | | - // due to issue https://github.com/singerdmx/flutter-quill/issues/2220 |
30 | | - // pasteHTML(html: html); |
31 | | - }); |
32 | | - } |
| 24 | +// extension QuillControllerWeb on QuillController { |
| 25 | +// void initializeWebPasteEvent() { |
| 26 | +// _webPasteEventSubscription = |
| 27 | +// EventStreamProviders.pasteEvent.forTarget(window.document).listen((e) { |
| 28 | +// final html = e.clipboardData?.getData('text/html'); |
| 29 | +// if (html == null) { |
| 30 | +// return; |
| 31 | +// } |
| 32 | +// // TODO: Temporarily disable the rich text pasting feature as a workaround |
| 33 | +// // due to issue https://github.com/singerdmx/flutter-quill/issues/2220 |
| 34 | +// // pasteHTML(html: html); |
| 35 | +// }); |
| 36 | +// } |
33 | 37 |
|
34 | | - void cancelWebPasteEvent() { |
35 | | - _webPasteEventSubscription?.cancel(); |
36 | | - _webPasteEventSubscription = null; |
37 | | - } |
38 | | -} |
| 38 | +// void cancelWebPasteEvent() { |
| 39 | +// _webPasteEventSubscription?.cancel(); |
| 40 | +// _webPasteEventSubscription = null; |
| 41 | +// } |
| 42 | +// } |
0 commit comments