pleroma-fe/src/components/font_control/font_control.js

59 lines
1.2 KiB
JavaScript
Raw Normal View History

import Select from '../select/select.vue'
2024-06-26 14:17:22 +03:00
import Checkbox from 'src/components/checkbox/checkbox.vue'
import Popover from 'src/components/popover/popover.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faExclamationTriangle,
faKeyboard,
faFont
} from '@fortawesome/free-solid-svg-icons'
2024-06-26 14:17:22 +03:00
library.add(
faExclamationTriangle,
faKeyboard,
faFont
2024-06-26 14:17:22 +03:00
)
2018-12-11 00:56:15 +03:00
export default {
components: {
2024-06-26 14:17:22 +03:00
Select,
Checkbox,
Popover
},
2018-12-11 00:56:15 +03:00
props: [
2022-03-27 14:16:23 +03:00
'name', 'label', 'modelValue', 'fallback', 'options', 'no-inherit'
2018-12-11 00:56:15 +03:00
],
mounted () {
this.$store.dispatch('queryLocalFonts')
},
2022-03-27 14:16:23 +03:00
emits: ['update:modelValue'],
2018-12-11 00:56:15 +03:00
data () {
return {
2024-06-27 00:59:24 +03:00
manualEntry: false,
2018-12-11 00:56:15 +03:00
availableOptions: [
this.noInherit ? '' : 'inherit',
'serif',
'sans-serif',
2018-12-11 00:56:15 +03:00
'monospace',
...(this.options || [])
2018-12-11 00:56:15 +03:00
].filter(_ => _)
}
},
methods: {
toggleManualEntry () {
this.manualEntry = !this.manualEntry
}
2018-12-11 00:56:15 +03:00
},
computed: {
present () {
return typeof this.modelValue !== 'undefined'
2024-06-26 14:17:22 +03:00
},
localFontsList () {
return this.$store.state.interface.localFonts
2018-12-11 00:56:15 +03:00
},
localFontsSize () {
return this.$store.state.interface.localFonts?.length
2018-12-11 00:56:15 +03:00
}
}
}