1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-26 04:28:17 +09:00
MisskeyIO/packages/client/src/pages/settings/custom-css.vue
2022-01-13 01:50:53 +09:00

58 lines
1.2 KiB
Vue

<template>
<div class="_formRoot">
<FormInfo warn class="_formBlock">{{ $ts.customCssWarn }}</FormInfo>
<FormTextarea v-model="localCustomCss" manual-save tall class="_monospace _formBlock" style="tab-size: 2;">
<template #label>CSS</template>
</FormTextarea>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import FormTextarea from '@/components/form/textarea.vue';
import FormInfo from '@/components/ui/info.vue';
import * as os from '@/os';
import { unisonReload } from '@/scripts/unison-reload';
import * as symbols from '@/symbols';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
FormTextarea,
FormInfo,
},
emits: ['info'],
data() {
return {
[symbols.PAGE_INFO]: {
title: this.$ts.customCss,
icon: 'fas fa-code',
bg: 'var(--bg)',
},
localCustomCss: localStorage.getItem('customCss')
}
},
mounted() {
this.$watch('localCustomCss', this.apply);
},
methods: {
async apply() {
localStorage.setItem('customCss', this.localCustomCss);
const { canceled } = await os.confirm({
type: 'info',
text: this.$ts.reloadToApplySetting,
});
if (canceled) return;
unisonReload();
}
}
});
</script>