From 5c67d9c4d3b9905a2349addef15489f0faa027be Mon Sep 17 00:00:00 2001 From: Ellet Date: Fri, 10 Nov 2023 18:17:53 +0300 Subject: [PATCH] Update _defaultOnTapOutside --- .../presentation/models/config/editor/image/image.dart | 8 ++++---- lib/src/utils/platform.dart | 1 + lib/src/widgets/raw_editor/raw_editor_state.dart | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/flutter_quill_extensions/lib/presentation/models/config/editor/image/image.dart b/flutter_quill_extensions/lib/presentation/models/config/editor/image/image.dart index 83e46279..3e159d0e 100644 --- a/flutter_quill_extensions/lib/presentation/models/config/editor/image/image.dart +++ b/flutter_quill_extensions/lib/presentation/models/config/editor/image/image.dart @@ -112,6 +112,10 @@ class QuillEditorImageEmbedConfigurations { static ImageEmbedBuilderOnRemovedCallback get defaultOnImageRemovedCallback { return (imageUrl) async { + if (isWeb()) { + return; + } + final mobile = isMobile(supportWeb: false); // If the platform is not mobile, return void; // Since the mobile OS gives us a copy of the image @@ -134,10 +138,6 @@ class QuillEditorImageEmbedConfigurations { // it without // permission - if (isWeb()) { - return; - } - final dartIoImageFile = File(imageUrl); final isFileExists = await dartIoImageFile.exists(); diff --git a/lib/src/utils/platform.dart b/lib/src/utils/platform.dart index 2765b78b..020cfae3 100644 --- a/lib/src/utils/platform.dart +++ b/lib/src/utils/platform.dart @@ -4,6 +4,7 @@ import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/foundation.dart' show kIsWeb, TargetPlatform, defaultTargetPlatform; +/// If you want to override the [kIsWeb] use [overrideIsWeb] bool isWeb({bool? overrideIsWeb}) { return overrideIsWeb ?? kIsWeb; } diff --git a/lib/src/widgets/raw_editor/raw_editor_state.dart b/lib/src/widgets/raw_editor/raw_editor_state.dart index bdcbebfc..0775686c 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state.dart @@ -185,10 +185,6 @@ class QuillRawEditorState extends EditorState } void _defaultOnTapOutside(PointerDownEvent event) { - if (isWeb()) { - widget.focusNode.unfocus(); - } - /// The focus dropping behavior is only present on desktop platforms /// and mobile browsers. switch (defaultTargetPlatform) {