2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-01-30 11:10:42 +09:00
|
|
|
<section class="_card">
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="_title"><fa :icon="faLaugh"/> {{ $t('reaction') }}</div>
|
|
|
|
<div class="_content">
|
2020-02-26 16:48:23 +09:00
|
|
|
<mk-input v-model="reactions" style="font-family: 'Segoe UI Emoji', 'Noto Color Emoji', Roboto, HelveticaNeue, Arial, sans-serif">
|
|
|
|
{{ $t('reaction') }}<template #desc>{{ $t('reactionSettingDescription') }}</template>
|
|
|
|
</mk-input>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
<div class="_footer">
|
|
|
|
<mk-button @click="save()" primary inline :disabled="!changed"><fa :icon="faSave"/> {{ $t('save') }}</mk-button>
|
|
|
|
<mk-button inline @click="preview"><fa :icon="faEye"/> {{ $t('preview') }}</mk-button>
|
2020-02-26 16:48:23 +09:00
|
|
|
<mk-button inline @click="setDefault"><fa :icon="faUndo"/> {{ $t('default') }}</mk-button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
|
2020-02-26 16:48:23 +09:00
|
|
|
import { faUndo } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkInput from '../../components/ui/input.vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
import MkButton from '../../components/ui/button.vue';
|
|
|
|
import MkReactionPicker from '../../components/reaction-picker.vue';
|
|
|
|
import i18n from '../../i18n';
|
2020-02-26 16:48:23 +09:00
|
|
|
import { emojiRegexWithCustom } from '../../../misc/emoji-regex';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n,
|
|
|
|
|
|
|
|
components: {
|
2020-02-26 16:48:23 +09:00
|
|
|
MkInput,
|
2020-01-30 04:37:25 +09:00
|
|
|
MkButton,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-02-26 16:48:23 +09:00
|
|
|
reactions: this.$store.state.settings.reactions.join(''),
|
2020-01-30 04:37:25 +09:00
|
|
|
changed: false,
|
2020-02-26 16:48:23 +09:00
|
|
|
faLaugh, faSave, faEye, faUndo
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
reactions() {
|
|
|
|
this.changed = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-26 16:48:23 +09:00
|
|
|
computed: {
|
|
|
|
splited(): any {
|
|
|
|
return this.reactions.match(emojiRegexWithCustom);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
|
|
|
save() {
|
2020-02-26 16:48:23 +09:00
|
|
|
this.$store.dispatch('settings/set', { key: 'reactions', value: this.splited });
|
2020-01-30 04:37:25 +09:00
|
|
|
this.changed = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
preview(ev) {
|
|
|
|
const picker = this.$root.new(MkReactionPicker, {
|
|
|
|
source: ev.currentTarget || ev.target,
|
2020-02-26 16:48:23 +09:00
|
|
|
reactions: this.splited,
|
2020-01-30 04:37:25 +09:00
|
|
|
showFocus: false,
|
|
|
|
});
|
|
|
|
picker.$once('chosen', reaction => {
|
|
|
|
picker.close();
|
|
|
|
});
|
2020-02-26 16:48:23 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
setDefault() {
|
|
|
|
this.reactions = '👍❤😆🤔😮🎉💢😥😇🍮';
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|