diff --git a/resources/js/components/fieldtypes/LinkFieldtype.vue b/resources/js/components/fieldtypes/LinkFieldtype.vue index dffacc3fd5..c6d272bef2 100644 --- a/resources/js/components/fieldtypes/LinkFieldtype.vue +++ b/resources/js/components/fieldtypes/LinkFieldtype.vue @@ -1,6 +1,5 @@ diff --git a/src/Fieldtypes/Link.php b/src/Fieldtypes/Link.php index 61a9371e56..bc4ff56149 100644 --- a/src/Fieldtypes/Link.php +++ b/src/Fieldtypes/Link.php @@ -61,13 +61,16 @@ public function preload() $selectedAsset = $value && Str::startsWith($value, 'asset::') ? Str::after($value, 'asset::') : null; - $url = ($value !== '@child' && ! $selectedEntry && ! $selectedAsset) ? $value : null; + $mailUrl = $value && Str::startsWith($value, 'mailto:') ? Str::after($value, 'mailto:') : null; + + $url = ($value !== '@child' && ! $selectedEntry && ! $selectedAsset && ! $mailUrl) ? $value : null; $entryFieldtype = $this->nestedEntriesFieldtype($selectedEntry); $assetFieldtype = $showAssetOption ? $this->nestedAssetsFieldtype($selectedAsset) : null; return [ + 'initialMail' => $mailUrl, 'initialUrl' => $url, 'initialSelectedEntries' => $selectedEntry ? [$selectedEntry] : [], 'initialSelectedAssets' => $selectedAsset ? [$selectedAsset] : [], @@ -93,6 +96,8 @@ private function initialOption($value, $entry, $asset) if ($value === '@child') { return 'first-child'; + } elseif (Str::startsWith($value, 'mailto:')) { + return 'mail'; } elseif ($entry) { return 'entry'; } elseif ($asset) {