|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <b-form-checkbox |
| 4 | + v-model="f.options.dynamicMode" |
| 5 | + v-b-tooltip.noninteractive.hover="{ title: $t('kind.link.dynamicModeTooltip'), boundary: 'viewport' }" |
| 6 | + > |
| 7 | + {{ $t('kind.link.dynamicMode') }} |
| 8 | + </b-form-checkbox> |
| 9 | + |
| 10 | + <div |
| 11 | + v-if="!f.options.dynamicMode" |
| 12 | + class="ml-4 mb-3" |
| 13 | + > |
| 14 | + <div> |
| 15 | + <label>{{ $t('kind.link.protocol') }}</label> |
| 16 | + <b-form-select |
| 17 | + v-model="f.options.tempProtocol" |
| 18 | + :options="protocolOptions" |
| 19 | + @change="onProtocolChange" |
| 20 | + /> |
| 21 | + </div> |
| 22 | + |
| 23 | + <div |
| 24 | + v-if="f.options.tempProtocol === '__CUSTOM__'" |
| 25 | + class="mt-2" |
| 26 | + > |
| 27 | + <div> |
| 28 | + <label>{{ $t('kind.link.customProtocol') }}</label> |
| 29 | + <b-form-input |
| 30 | + v-model="f.options.customProtocol" |
| 31 | + placeholder="e.g., skype:" |
| 32 | + /> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + |
| 37 | + <div v-if="showURLOptions"> |
| 38 | + <div> |
| 39 | + <b-form-checkbox v-model="f.options.trimPath"> |
| 40 | + {{ $t('kind.url.label') }} |
| 41 | + </b-form-checkbox> |
| 42 | + </div> |
| 43 | + <div> |
| 44 | + <b-form-checkbox v-model="f.options.trimFragment"> |
| 45 | + {{ $t('kind.url.trimHash') }} |
| 46 | + </b-form-checkbox> |
| 47 | + </div> |
| 48 | + <div> |
| 49 | + <b-form-checkbox v-model="f.options.trimQuery"> |
| 50 | + {{ $t('kind.url.trimQuestionMark') }} |
| 51 | + </b-form-checkbox> |
| 52 | + </div> |
| 53 | + <div> |
| 54 | + <b-form-checkbox v-model="f.options.onlySecure"> |
| 55 | + {{ $t('kind.url.sshOnly') }} |
| 56 | + </b-form-checkbox> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + |
| 60 | + <div> |
| 61 | + <b-form-checkbox v-model="f.options.outputPlain"> |
| 62 | + {{ $t('kind.link.preventToLink') }} |
| 63 | + </b-form-checkbox> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | +</template> |
| 67 | + |
| 68 | +<script> |
| 69 | +import base from './base' |
| 70 | +
|
| 71 | +export default { |
| 72 | + i18nOptions: { |
| 73 | + namespaces: 'field', |
| 74 | + }, |
| 75 | +
|
| 76 | + extends: base, |
| 77 | +
|
| 78 | + data () { |
| 79 | + return { |
| 80 | + tempProtocol: '', |
| 81 | + } |
| 82 | + }, |
| 83 | +
|
| 84 | + computed: { |
| 85 | + isStaticURL () { |
| 86 | + return !this.f.options.dynamicMode && this.f.options.tempProtocol === 'https://' |
| 87 | + }, |
| 88 | +
|
| 89 | + showURLOptions () { |
| 90 | + return this.f.options.dynamicMode || this.isStaticURL |
| 91 | + }, |
| 92 | +
|
| 93 | + protocolOptions () { |
| 94 | + return [ |
| 95 | + { text: this.$t('kind.link.protocolOptions.none'), value: '' }, |
| 96 | + { text: this.$t('kind.link.protocolOptions.mailto'), value: 'mailto:' }, |
| 97 | + { text: this.$t('kind.link.protocolOptions.tel'), value: 'tel:' }, |
| 98 | + { text: this.$t('kind.link.protocolOptions.url'), value: 'https://' }, |
| 99 | + { text: this.$t('kind.link.protocolOptions.skype'), value: 'skype:' }, |
| 100 | + { text: this.$t('kind.link.protocolOptions.msteams'), value: 'msteams:' }, |
| 101 | + { text: this.$t('kind.link.protocolOptions.slack'), value: 'slack://' }, |
| 102 | + { text: this.$t('kind.link.protocolOptions.sms'), value: 'sms:' }, |
| 103 | + { text: this.$t('kind.link.protocolOptions.facetime'), value: 'facetime:' }, |
| 104 | + { text: this.$t('kind.link.protocolOptions.zoommtg'), value: 'zoommtg://' }, |
| 105 | + { text: this.$t('kind.link.protocolOptions.whatsapp'), value: 'whatsapp://' }, |
| 106 | + { text: this.$t('kind.link.protocolOptions.signal'), value: 'sgnl:' }, |
| 107 | + { text: this.$t('kind.link.protocolOptions.fb'), value: 'fb://' }, |
| 108 | + { text: this.$t('kind.link.protocolOptions.fbmessenger'), value: 'fb-messenger://' }, |
| 109 | + { text: this.$t('kind.link.protocolOptions.instagram'), value: 'instagram://' }, |
| 110 | + { text: this.$t('kind.link.protocolOptions.twitter'), value: 'twitter://' }, |
| 111 | + { text: this.$t('kind.link.protocolOptions.youtube'), value: 'youtube://' }, |
| 112 | + { text: this.$t('kind.link.protocolOptions.spotify'), value: 'spotify://' }, |
| 113 | + { text: this.$t('kind.link.protocolOptions.tiktok'), value: 'tiktok://' }, |
| 114 | + { text: this.$t('kind.link.protocolOptions.discord'), value: 'discord://' }, |
| 115 | + { text: this.$t('kind.link.protocolOptions.custom'), value: '__CUSTOM__' }, |
| 116 | + ] |
| 117 | + }, |
| 118 | + }, |
| 119 | +
|
| 120 | + watch: { |
| 121 | + 'f.options.customProtocol': { |
| 122 | + handler (val) { |
| 123 | + if (val && val !== '__CUSTOM__') { |
| 124 | + this.tempProtocol = val |
| 125 | + } |
| 126 | + }, |
| 127 | + }, |
| 128 | +
|
| 129 | + 'f.options.dynamicMode': { |
| 130 | + handler (val) { |
| 131 | + if (!val && this.f.options.customProtocol) { |
| 132 | + this.tempProtocol = this.f.options.customProtocol |
| 133 | + } |
| 134 | + }, |
| 135 | + }, |
| 136 | + }, |
| 137 | +
|
| 138 | + mounted () { |
| 139 | + if (!this.f.options.tempProtocol) { |
| 140 | + if (this.f.options.customProtocol) { |
| 141 | + this.f.options.tempProtocol = this.f.options.customProtocol |
| 142 | + } else { |
| 143 | + this.f.options.tempProtocol = '' |
| 144 | + } |
| 145 | + } else { |
| 146 | + this.tempProtocol = this.f.options.tempProtocol |
| 147 | + } |
| 148 | + }, |
| 149 | +
|
| 150 | + methods: { |
| 151 | + onProtocolChange () { |
| 152 | + if (this.tempProtocol !== '__CUSTOM__') { |
| 153 | + this.$set(this.field.options, 'customProtocol', this.tempProtocol) |
| 154 | + } |
| 155 | + }, |
| 156 | + }, |
| 157 | +} |
| 158 | +</script> |
0 commit comments