aboutsummaryrefslogtreecommitdiff
path: root/src/components/font_control/font_control.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2024-07-24 18:51:17 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2024-07-24 18:51:17 +0000
commit0c9893c8a07426d3e41046663d4072de50eb267c (patch)
treedce14332df570a757bf78e769ac6cfd5fb189f58 /src/components/font_control/font_control.js
parent7a7d80270d1ae041f06c1fd9017135cb5b8c34d6 (diff)
parentaa7bdbae2173fdb921dd241683c3e0f9bd3aaa82 (diff)
Merge branch 'appearance-tab' into 'develop'
Themes 3: Intermission: Appearance Tab and fixes See merge request pleroma/pleroma-fe!1920
Diffstat (limited to 'src/components/font_control/font_control.js')
-rw-r--r--src/components/font_control/font_control.js70
1 files changed, 33 insertions, 37 deletions
diff --git a/src/components/font_control/font_control.js b/src/components/font_control/font_control.js
index 92ee3f30..d9394945 100644
--- a/src/components/font_control/font_control.js
+++ b/src/components/font_control/font_control.js
@@ -1,63 +1,59 @@
-import { set } from 'lodash'
import Select from '../select/select.vue'
+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'
+
+library.add(
+ faExclamationTriangle,
+ faKeyboard,
+ faFont
+)
export default {
components: {
- Select
+ Select,
+ Checkbox,
+ Popover
},
props: [
'name', 'label', 'modelValue', 'fallback', 'options', 'no-inherit'
],
+ mounted () {
+ this.$store.dispatch('queryLocalFonts')
+ },
emits: ['update:modelValue'],
data () {
return {
- lValue: this.modelValue,
+ manualEntry: false,
availableOptions: [
this.noInherit ? '' : 'inherit',
- 'custom',
- ...(this.options || []),
'serif',
+ 'sans-serif',
'monospace',
- 'sans-serif'
+ ...(this.options || [])
].filter(_ => _)
}
},
- beforeUpdate () {
- this.lValue = this.modelValue
+ methods: {
+ toggleManualEntry () {
+ this.manualEntry = !this.manualEntry
+ }
},
computed: {
present () {
- return typeof this.lValue !== 'undefined'
- },
- dValue () {
- return this.lValue || this.fallback || {}
- },
- family: {
- get () {
- return this.dValue.family
- },
- set (v) {
- set(this.lValue, 'family', v)
- this.$emit('update:modelValue', this.lValue)
- }
+ return typeof this.modelValue !== 'undefined'
},
- isCustom () {
- return this.preset === 'custom'
+ localFontsList () {
+ return this.$store.state.interface.localFonts
},
- preset: {
- get () {
- if (this.family === 'serif' ||
- this.family === 'sans-serif' ||
- this.family === 'monospace' ||
- this.family === 'inherit') {
- return this.family
- } else {
- return 'custom'
- }
- },
- set (v) {
- this.family = v === 'custom' ? '' : v
- }
+ localFontsSize () {
+ return this.$store.state.interface.localFonts?.length
}
}
}