mirror of
https://github.com/marktext/marktext.git
synced 2025-05-19 18:30:40 +08:00
Validate uploader services (#1183)
This commit is contained in:
parent
4a1d5651c6
commit
aa0e491f1d
@ -2,8 +2,8 @@
|
|||||||
<div class="pref-image-uploader">
|
<div class="pref-image-uploader">
|
||||||
<h4>Image Uploader</h4>
|
<h4>Image Uploader</h4>
|
||||||
<section class="current-uploader">
|
<section class="current-uploader">
|
||||||
<div v-if="currentUploader !== 'none'">The current image uploader is {{ getServiceNameById(currentUploader) }}.</div>
|
<div v-if="isValidUploaderService(currentUploader)">The current image uploader is {{ getServiceNameById(currentUploader) }}.</div>
|
||||||
<span v-else>Currently is no uploader selected. Please select an uploader and click on "Set as default".</span>
|
<span v-else>Currently no uploader is selected. Please select an uploader and click on "Set as default".</span>
|
||||||
</section>
|
</section>
|
||||||
<section class="configration">
|
<section class="configration">
|
||||||
<el-tabs v-model="activeTab">
|
<el-tabs v-model="activeTab">
|
||||||
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { shell } from 'electron'
|
import { shell } from 'electron'
|
||||||
import services from './services.js'
|
import services, { isValidService } from './services.js'
|
||||||
import legalNoticesCheckbox from './legalNoticesCheckbox'
|
import legalNoticesCheckbox from './legalNoticesCheckbox'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -116,6 +116,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isValidUploaderService (name) {
|
||||||
|
return isValidService(name)
|
||||||
|
},
|
||||||
getServiceNameById (id) {
|
getServiceNameById (id) {
|
||||||
const service = services[id]
|
const service = services[id]
|
||||||
return service ? service.name : id
|
return service ? service.name : id
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
// TODO: Remove information from other vue source files into this file.
|
// TODO: Remove information from other vue source files into this file.
|
||||||
|
|
||||||
export default {
|
export const isValidService = name => {
|
||||||
|
return name !== 'none' && services.hasOwnProperty(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
const services = {
|
||||||
// Dummy service used to opt-in real services.
|
// Dummy service used to opt-in real services.
|
||||||
none: {
|
none: {
|
||||||
name: '',
|
name: '',
|
||||||
@ -32,3 +36,5 @@ export default {
|
|||||||
agreedToLegalNotices: false
|
agreedToLegalNotices: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default services
|
||||||
|
Loading…
Reference in New Issue
Block a user