mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 02:03:09 +02:00
Resolve #6704
This commit is contained in:
parent
6c3417d9b5
commit
03b072b894
4 changed files with 62 additions and 25 deletions
|
@ -214,6 +214,7 @@ imageUrl: "画像URL"
|
||||||
remove: "削除"
|
remove: "削除"
|
||||||
removed: "削除しました"
|
removed: "削除しました"
|
||||||
removeAreYouSure: "「{x}」を削除しますか?"
|
removeAreYouSure: "「{x}」を削除しますか?"
|
||||||
|
resetAreYouSure: "リセットしますか?"
|
||||||
saved: "保存しました"
|
saved: "保存しました"
|
||||||
messaging: "チャット"
|
messaging: "チャット"
|
||||||
upload: "アップロード"
|
upload: "アップロード"
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="index">
|
<div class="index">
|
||||||
<section>
|
<section v-if="showPinned">
|
||||||
<div>
|
<div>
|
||||||
<button v-for="emoji in pinned"
|
<button v-for="emoji in pinned"
|
||||||
class="_button"
|
class="_button"
|
||||||
|
@ -109,8 +109,9 @@ export default defineComponent({
|
||||||
src: {
|
src: {
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
overridePinned: {
|
showPinned: {
|
||||||
required: false
|
required: false,
|
||||||
|
default: true
|
||||||
},
|
},
|
||||||
compact: {
|
compact: {
|
||||||
required: false
|
required: false
|
||||||
|
@ -123,7 +124,7 @@ export default defineComponent({
|
||||||
return {
|
return {
|
||||||
emojilist: markRaw(emojilist),
|
emojilist: markRaw(emojilist),
|
||||||
getStaticImageUrl,
|
getStaticImageUrl,
|
||||||
pinned: this.overridePinned || this.$store.state.settings.reactions,
|
pinned: this.$store.state.settings.reactions,
|
||||||
customEmojiCategories: this.$store.getters['instance/emojiCategories'],
|
customEmojiCategories: this.$store.getters['instance/emojiCategories'],
|
||||||
customEmojis: this.$store.state.instance.meta.emojis,
|
customEmojis: this.$store.state.instance.meta.emojis,
|
||||||
visibleCategories: {},
|
visibleCategories: {},
|
||||||
|
|
|
@ -275,10 +275,11 @@ export async function selectDriveFolder(multiple: boolean) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pickEmoji(src?: HTMLElement) {
|
export async function pickEmoji(src?: HTMLElement, opts) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
popup(import('@/components/emoji-picker.vue'), {
|
popup(import('@/components/emoji-picker.vue'), {
|
||||||
src
|
src,
|
||||||
|
...opts
|
||||||
}, {
|
}, {
|
||||||
done: emoji => {
|
done: emoji => {
|
||||||
resolve(emoji);
|
resolve(emoji);
|
||||||
|
|
|
@ -3,15 +3,20 @@
|
||||||
<div class="_card">
|
<div class="_card">
|
||||||
<div class="_title"><Fa :icon="faLaugh"/> {{ $t('reaction') }}</div>
|
<div class="_title"><Fa :icon="faLaugh"/> {{ $t('reaction') }}</div>
|
||||||
<div class="_content">
|
<div class="_content">
|
||||||
<MkInput v-model:value="reactions" style="font-family: 'Segoe UI Emoji', 'Noto Color Emoji', Roboto, HelveticaNeue, Arial, sans-serif">
|
<XDraggable class="zoaiodol" :list="reactions" animation="150" delay="100" delay-on-touch-only="true">
|
||||||
{{ $t('reaction') }}<template #desc>{{ $t('reactionSettingDescription') }} <button class="_textButton" @click="chooseEmoji">{{ $t('chooseEmoji') }}</button></template>
|
<button class="_button item" v-for="reaction in reactions" :key="reaction" @click="remove(reaction, $event)">
|
||||||
</MkInput>
|
<MkEmoji :emoji="reaction" :normal="true"/>
|
||||||
<MkButton inline @click="setDefault"><Fa :icon="faUndo"/> {{ $t('default') }}</MkButton>
|
</button>
|
||||||
|
<template #footer>
|
||||||
|
<button>a</button>
|
||||||
|
</template>
|
||||||
|
</XDraggable>
|
||||||
|
<div class="_caption" style="padding: 8px;">{{ $t('reactionSettingDescription') }} <button class="_textButton" @click="chooseEmoji">{{ $t('chooseEmoji') }}</button></div>
|
||||||
<MkSwitch v-model:value="useFullReactionPicker">{{ $t('useFullReactionPicker') }}</MkSwitch>
|
<MkSwitch v-model:value="useFullReactionPicker">{{ $t('useFullReactionPicker') }}</MkSwitch>
|
||||||
</div>
|
</div>
|
||||||
<div class="_footer">
|
<div class="_footer">
|
||||||
<MkButton @click="save()" primary inline :disabled="!changed"><Fa :icon="faSave"/> {{ $t('save') }}</MkButton>
|
|
||||||
<MkButton inline @click="preview"><Fa :icon="faEye"/> {{ $t('preview') }}</MkButton>
|
<MkButton inline @click="preview"><Fa :icon="faEye"/> {{ $t('preview') }}</MkButton>
|
||||||
|
<MkButton inline @click="setDefault"><Fa :icon="faUndo"/> {{ $t('default') }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,6 +26,7 @@
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
|
import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
|
||||||
import { faUndo } from '@fortawesome/free-solid-svg-icons';
|
import { faUndo } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { VueDraggableNext } from 'vue-draggable-next';
|
||||||
import MkInput from '@/components/ui/input.vue';
|
import MkInput from '@/components/ui/input.vue';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import MkSwitch from '@/components/ui/switch.vue';
|
import MkSwitch from '@/components/ui/switch.vue';
|
||||||
|
@ -33,6 +39,7 @@ export default defineComponent({
|
||||||
MkInput,
|
MkInput,
|
||||||
MkButton,
|
MkButton,
|
||||||
MkSwitch,
|
MkSwitch,
|
||||||
|
XDraggable: VueDraggableNext,
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['info'],
|
emits: ['info'],
|
||||||
|
@ -43,17 +50,12 @@ export default defineComponent({
|
||||||
title: this.$t('reaction'),
|
title: this.$t('reaction'),
|
||||||
icon: faLaugh
|
icon: faLaugh
|
||||||
},
|
},
|
||||||
reactions: this.$store.state.settings.reactions.join(''),
|
reactions: JSON.parse(JSON.stringify(this.$store.state.settings.reactions)),
|
||||||
changed: false,
|
|
||||||
faLaugh, faSave, faEye, faUndo
|
faLaugh, faSave, faEye, faUndo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
splited(): any {
|
|
||||||
return this.reactions.match(emojiRegexWithCustom);
|
|
||||||
},
|
|
||||||
|
|
||||||
useFullReactionPicker: {
|
useFullReactionPicker: {
|
||||||
get() { return this.$store.state.device.useFullReactionPicker; },
|
get() { return this.$store.state.device.useFullReactionPicker; },
|
||||||
set(value) { this.$store.commit('device/set', { key: 'useFullReactionPicker', value: value }); }
|
set(value) { this.$store.commit('device/set', { key: 'useFullReactionPicker', value: value }); }
|
||||||
|
@ -63,7 +65,7 @@ export default defineComponent({
|
||||||
watch: {
|
watch: {
|
||||||
reactions: {
|
reactions: {
|
||||||
handler() {
|
handler() {
|
||||||
this.changed = true;
|
this.save();
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
|
@ -75,27 +77,59 @@ export default defineComponent({
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
save() {
|
save() {
|
||||||
this.$store.dispatch('settings/set', { key: 'reactions', value: this.splited });
|
this.$store.dispatch('settings/set', { key: 'reactions', value: this.reactions });
|
||||||
this.changed = false;
|
},
|
||||||
|
|
||||||
|
remove(reaction, ev) {
|
||||||
|
os.modalMenu([{
|
||||||
|
text: this.$t('remove'),
|
||||||
|
action: () => {
|
||||||
|
this.reactions = this.reactions.filter(x => x !== reaction)
|
||||||
|
}
|
||||||
|
}], ev.currentTarget || ev.target);
|
||||||
},
|
},
|
||||||
|
|
||||||
preview(ev) {
|
preview(ev) {
|
||||||
os.popup(import('@/components/emoji-picker.vue'), {
|
os.popup(import('@/components/emoji-picker.vue'), {
|
||||||
overridePinned: this.splited,
|
|
||||||
compact: !this.$store.state.device.useFullReactionPicker,
|
compact: !this.$store.state.device.useFullReactionPicker,
|
||||||
src: ev.currentTarget || ev.target,
|
src: ev.currentTarget || ev.target,
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
},
|
},
|
||||||
|
|
||||||
setDefault() {
|
async setDefault() {
|
||||||
this.reactions = defaultSettings.reactions.join('');
|
const { canceled } = await os.dialog({
|
||||||
|
type: 'warning',
|
||||||
|
text: this.$t('resetAreYouSure'),
|
||||||
|
showCancelButton: true
|
||||||
|
});
|
||||||
|
if (canceled) return;
|
||||||
|
|
||||||
|
this.reactions = JSON.parse(JSON.stringify(defaultSettings.reactions));
|
||||||
},
|
},
|
||||||
|
|
||||||
chooseEmoji(ev) {
|
chooseEmoji(ev) {
|
||||||
os.pickEmoji(ev.currentTarget || ev.target).then(emoji => {
|
os.pickEmoji(ev.currentTarget || ev.target, {
|
||||||
this.reactions += emoji;
|
showPinned: false
|
||||||
|
}).then(emoji => {
|
||||||
|
if (!this.reactions.includes(emoji)) {
|
||||||
|
this.reactions.push(emoji);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.zoaiodol {
|
||||||
|
border: solid 1px var(--divider);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 16px;
|
||||||
|
|
||||||
|
> .item {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 8px;
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue