mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: image url check for embed link (#4826)
* fix: image url check in for embed link * chore: move all patterns to shared * test: prefer enterText over manipulating widget
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:appflowy/core/config/kv.dart';
|
||||
import 'package:appflowy/core/config/kv_keys.dart';
|
||||
import 'package:appflowy/shared/patterns/common_patterns.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import '../../../startup/tasks/prelude.dart';
|
||||
@ -26,7 +28,7 @@ class ApplicationDataStorage {
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
// remove the prefix `/Volumes/*`
|
||||
path = path.replaceFirst(RegExp('^/Volumes/[^/]+'), '');
|
||||
path = path.replaceFirst(macOSVolumesRegex, '');
|
||||
} else if (Platform.isWindows) {
|
||||
path = path.replaceAll('/', '\\');
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
/// RegExp to match Twelve Hour formats
|
||||
/// Source: https://stackoverflow.com/a/33906224
|
||||
///
|
||||
/// Matches eg: "05:05 PM", "5:50 Pm", "10:59 am", etc.
|
||||
///
|
||||
final _twelveHourTimePattern =
|
||||
RegExp(r'\b((1[0-2]|0?[1-9]):([0-5][0-9]) ([AaPp][Mm]))');
|
||||
bool isTwelveHourTime(String? time) =>
|
||||
_twelveHourTimePattern.hasMatch(time ?? '');
|
||||
|
||||
/// RegExp to match Twenty Four Hour formats
|
||||
/// Source: https://stackoverflow.com/a/7536768
|
||||
///
|
||||
/// Matches eg: "0:01", "04:59", "16:30", etc.
|
||||
///
|
||||
final _twentyFourHourtimePattern = RegExp(r'^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$');
|
||||
bool isTwentyFourHourTime(String? time) =>
|
||||
_twentyFourHourtimePattern.hasMatch(time ?? '');
|
Reference in New Issue
Block a user