mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 17:11:23 +00:00

* fix: paste doesn't work sometimes in the first try * test: paste the url that doesn't contain a protocol * feat: skip parsing as a preview block if the url is image
26 lines
643 B
Dart
26 lines
643 B
Dart
/// List of default file extensions used for images.
|
|
///
|
|
/// This is used to make sure that only images that are allowed are picked/uploaded. The extensions
|
|
/// should be supported by Flutter, to avoid causing issues.
|
|
///
|
|
/// See [Image-class documentation](https://api.flutter.dev/flutter/widgets/Image-class.html)
|
|
///
|
|
const List<String> defaultImageExtensions = [
|
|
'jpg',
|
|
'png',
|
|
'jpeg',
|
|
'gif',
|
|
'webp',
|
|
'bmp',
|
|
];
|
|
|
|
extension ImageStringExtension on String {
|
|
bool isImageUrl() {
|
|
final imagePattern = RegExp(
|
|
r'\.(jpe?g|png|gif|webp|bmp)$',
|
|
caseSensitive: false,
|
|
);
|
|
return imagePattern.hasMatch(this);
|
|
}
|
|
}
|