mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: ignore case sensitive of image name when dragging image to document (#6017)
This commit is contained in:
parent
6a0650e6d5
commit
70e96c01b3
@ -197,13 +197,15 @@ class _DocumentPageState extends State<DocumentPage>
|
|||||||
|
|
||||||
final isLocalMode = context.read<DocumentBloc>().isLocalMode;
|
final isLocalMode = context.read<DocumentBloc>().isLocalMode;
|
||||||
final List<XFile> imageFiles = [];
|
final List<XFile> imageFiles = [];
|
||||||
final List<XFile> otherfiles = [];
|
final List<XFile> otherFiles = [];
|
||||||
|
|
||||||
for (final file in details.files) {
|
for (final file in details.files) {
|
||||||
|
final fileName = file.name.toLowerCase();
|
||||||
if (file.mimeType?.startsWith('image/') ??
|
if (file.mimeType?.startsWith('image/') ??
|
||||||
false || imgExtensionRegex.hasMatch(file.name)) {
|
false || imgExtensionRegex.hasMatch(fileName)) {
|
||||||
imageFiles.add(file);
|
imageFiles.add(file);
|
||||||
} else {
|
} else {
|
||||||
otherfiles.add(file);
|
otherFiles.add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +217,7 @@ class _DocumentPageState extends State<DocumentPage>
|
|||||||
);
|
);
|
||||||
await editorState!.dropFiles(
|
await editorState!.dropFiles(
|
||||||
data.dropTarget!,
|
data.dropTarget!,
|
||||||
otherfiles,
|
otherFiles,
|
||||||
widget.view.id,
|
widget.view.id,
|
||||||
isLocalMode,
|
isLocalMode,
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@ extension PasteFromImage on EditorState {
|
|||||||
final imageFiles = files.where(
|
final imageFiles = files.where(
|
||||||
(file) =>
|
(file) =>
|
||||||
file.mimeType?.startsWith('image/') ??
|
file.mimeType?.startsWith('image/') ??
|
||||||
false || imgExtensionRegex.hasMatch(file.name),
|
false || imgExtensionRegex.hasMatch(file.name.toLowerCase()),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final file in imageFiles) {
|
for (final file in imageFiles) {
|
||||||
|
Loading…
Reference in New Issue
Block a user