make sure link is a link
This commit is contained in:
parent
cd1f7a3be3
commit
1fcc95d6b9
|
@ -389,7 +389,14 @@ class AddLinkDialog extends HookWidget {
|
||||||
final urlController = useTextEditingController(text: url);
|
final urlController = useTextEditingController(text: url);
|
||||||
|
|
||||||
void submit() {
|
void submit() {
|
||||||
final finalString = '(${titleController.text})[${urlController.text}]';
|
final link = () {
|
||||||
|
if (urlController.text.startsWith('http?s://')) {
|
||||||
|
return urlController.text;
|
||||||
|
} else {
|
||||||
|
return 'https://${urlController.text}';
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
final finalString = '(${titleController.text})[$link]';
|
||||||
Navigator.of(context).pop(Reformat(
|
Navigator.of(context).pop(Reformat(
|
||||||
text: finalString,
|
text: finalString,
|
||||||
selectionBeginningShift: finalString.length,
|
selectionBeginningShift: finalString.length,
|
||||||
|
|
Loading…
Reference in New Issue