2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
2020-11-25 21:31:34 +09:00
|
|
|
<div>
|
|
|
|
<MkTab v-model:value="tab">
|
2020-12-26 10:47:36 +09:00
|
|
|
<option value="soft">{{ $ts._wordMute.soft }}</option>
|
|
|
|
<option value="hard">{{ $ts._wordMute.hard }}</option>
|
2020-11-25 21:31:34 +09:00
|
|
|
</MkTab>
|
|
|
|
<FormBase>
|
|
|
|
<div class="_formItem">
|
2020-10-17 20:12:00 +09:00
|
|
|
<div v-show="tab === 'soft'">
|
2021-04-14 01:41:49 +09:00
|
|
|
<FormInfo>{{ $ts._wordMute.softDescription }}</FormInfo>
|
2020-11-25 21:31:34 +09:00
|
|
|
<FormTextarea v-model:value="softMutedWords">
|
2020-12-26 10:47:36 +09:00
|
|
|
<span>{{ $ts._wordMute.muteWords }}</span>
|
|
|
|
<template #desc>{{ $ts._wordMute.muteWordsDescription }}<br>{{ $ts._wordMute.muteWordsDescription2 }}</template>
|
2020-11-25 21:31:34 +09:00
|
|
|
</FormTextarea>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
<div v-show="tab === 'hard'">
|
2021-04-14 01:41:49 +09:00
|
|
|
<FormInfo>{{ $ts._wordMute.hardDescription }}</FormInfo>
|
2020-11-25 21:31:34 +09:00
|
|
|
<FormTextarea v-model:value="hardMutedWords">
|
2020-12-26 10:47:36 +09:00
|
|
|
<span>{{ $ts._wordMute.muteWords }}</span>
|
|
|
|
<template #desc>{{ $ts._wordMute.muteWordsDescription }}<br>{{ $ts._wordMute.muteWordsDescription2 }}</template>
|
2020-11-25 21:31:34 +09:00
|
|
|
</FormTextarea>
|
|
|
|
<FormKeyValueView v-if="hardWordMutedNotesCount != null">
|
2020-12-26 10:47:36 +09:00
|
|
|
<template #key>{{ $ts._wordMute.mutedNotes }}</template>
|
2020-11-25 21:31:34 +09:00
|
|
|
<template #value>{{ number(hardWordMutedNotesCount) }}</template>
|
|
|
|
</FormKeyValueView>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="save()" primary inline :disabled="!changed"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
2020-11-25 21:31:34 +09:00
|
|
|
</FormBase>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import FormTextarea from '@client/components/form/textarea.vue';
|
|
|
|
import FormBase from '@client/components/form/base.vue';
|
|
|
|
import FormKeyValueView from '@client/components/form/key-value-view.vue';
|
|
|
|
import FormButton from '@client/components/form/button.vue';
|
2021-04-14 01:41:49 +09:00
|
|
|
import FormInfo from '@client/components/form/info.vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import MkTab from '@client/components/tab.vue';
|
|
|
|
import * as os from '@client/os';
|
|
|
|
import number from '@client/filters/number';
|
2021-04-10 12:54:12 +09:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
2020-11-25 21:31:34 +09:00
|
|
|
FormBase,
|
|
|
|
FormButton,
|
|
|
|
FormTextarea,
|
|
|
|
FormKeyValueView,
|
2020-10-17 20:12:00 +09:00
|
|
|
MkTab,
|
2021-04-14 01:41:49 +09:00
|
|
|
FormInfo,
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 12:54:12 +09:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-26 10:47:36 +09:00
|
|
|
title: this.$ts.wordMute,
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-comment-slash'
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
tab: 'soft',
|
|
|
|
softMutedWords: '',
|
|
|
|
hardMutedWords: '',
|
|
|
|
hardWordMutedNotesCount: null,
|
|
|
|
changed: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
softMutedWords: {
|
|
|
|
handler() {
|
|
|
|
this.changed = true;
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
hardMutedWords: {
|
|
|
|
handler() {
|
|
|
|
this.changed = true;
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
async created() {
|
2020-12-19 10:55:52 +09:00
|
|
|
this.softMutedWords = this.$store.state.mutedWords.map(x => x.join(' ')).join('\n');
|
|
|
|
this.hardMutedWords = this.$i.mutedWords.map(x => x.join(' ')).join('\n');
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
this.hardWordMutedNotesCount = (await os.api('i/get-word-muted-notes-count', {})).count;
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-04-10 12:54:12 +09:00
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async save() {
|
2020-12-19 10:55:52 +09:00
|
|
|
this.$store.set('mutedWords', this.softMutedWords.trim().split('\n').map(x => x.trim().split(' ')));
|
2020-10-17 20:12:00 +09:00
|
|
|
await os.api('i/update', {
|
|
|
|
mutedWords: this.hardMutedWords.trim().split('\n').map(x => x.trim().split(' ')),
|
|
|
|
});
|
|
|
|
this.changed = false;
|
|
|
|
},
|
2020-11-25 21:31:34 +09:00
|
|
|
|
|
|
|
number
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|