diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-01-24 15:51:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 15:51:55 +0300 |
commit | 9f254d8a7fd5f64b1ca1169915ba7c5212dafd79 (patch) | |
tree | 71124b2130099317ea925645e027e816f261f3ae /src | |
parent | d7c1cdf9fa219ebbcc50ec6255d2ba411e9e64e8 (diff) | |
parent | 9bccbf4b381d4732587ac294e1232779d6bc6594 (diff) |
Merge pull request #2539 from nextcloud/mailto_button
Add mailto: protocol handler
Diffstat (limited to 'src')
-rw-r--r-- | src/components/AppSettingsMenu.vue | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/components/AppSettingsMenu.vue b/src/components/AppSettingsMenu.vue index cfd18fd61..a3c3807cc 100644 --- a/src/components/AppSettingsMenu.vue +++ b/src/components/AppSettingsMenu.vue @@ -18,7 +18,11 @@ /> <label for="gravatar-enabled">{{ t('mail', 'Use Gravatar and favicon avatars') }}</label> </p> - + <p> + <button class="icon-mail app-settings-button" @click="registerProtocolHandler"> + {{ t('mail', 'Register as application for mail links') }} + </button> + </p> <p class="icon-details app-settings-button button"> <router-link :to="{name: 'keyboardShortcuts'}"> {{ t('mail', 'Keyboard shortcuts') }} @@ -35,6 +39,7 @@ <script> import Logger from '../logger' +import {generateUrl} from '@nextcloud/router' export default { name: 'AppSettingsMenu', @@ -62,6 +67,17 @@ export default { this.loadingAvatarSettings = false }) }, + registerProtocolHandler: function() { + if (window.navigator.registerProtocolHandler) { + var url = + window.location.protocol + '//' + window.location.host + generateUrl('apps/mail/compose?uri=%s') + try { + window.navigator.registerProtocolHandler('mailto', url, OC.theme.name + ' Mail') + } catch (err) { + Logger.error('could not register protocol handler', {err}) + } + } + }, }, } </script> |