fix: allow # in links when pasting (#2110)

Closes: #1871
This commit is contained in:
Mathias Mogensen 2023-03-27 06:47:41 +02:00 committed by GitHub
parent 5afdb5de35
commit c73b7d1184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,7 @@ void _pasteSingleLine(
/// parse url from the line text
/// reference: https://stackoverflow.com/questions/59444837/flutter-dart-regex-to-extract-urls-from-a-string
Delta _lineContentToDelta(String lineContent) {
final exp = RegExp(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+');
final exp = RegExp(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\#\w/\-?=%.]+');
final Iterable<RegExpMatch> matches = exp.allMatches(lineContent);
final delta = Delta();