Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CustomFontFamily.vue « Theming « Components « vue « src - github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4e521e0356ceccd757723b088edfb36690818a71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<template>
    <div class="setting">
        <translate tag="label" for="custom-font" say="SettingsCustomFont"/>
        <select-field id="custom-font" :options="options" v-model="model"/>
    </div>
</template>

<script>
    import SelectField from '@vue/Components/Form/SelectField';
    import Translate from '@vue/Components/Translate';

    export default {
        components: {Translate, SelectField},

        props: ['value'],

        data() {
            return {
                model: this.value
            };
        },

        computed: {
            options() {
                let options = {
                    default  : 'FontDefault',
                    mono     : 'FontMono',
                    serif    : 'FontSerif',
                    sans     : 'FontSans',
                    light    : 'FontLight',
                    nextcloud: 'FontNextcloud',
                    dyslexic : 'FontOpenDyslexic'
                };

                if(!options.hasOwnProperty(this.value)) {
                    options[this.value] = 'FontCustom';
                }

                return options;
            }
        },

        watch: {
            value(value) {
                this.model = value;
            },
            model(value) {
                if(this.value !== value) this.$emit('input', value);
            }
        }
    };
</script>