2020-10-17 11:12:00 +00:00
|
|
|
<template>
|
2023-01-06 00:41:14 +00:00
|
|
|
<MkModalWindow
|
2022-07-20 13:24:26 +00:00
|
|
|
ref="dialog"
|
2020-10-17 11:12:00 +00:00
|
|
|
:width="370"
|
|
|
|
:with-ok-button="true"
|
|
|
|
@close="$refs.dialog.close()"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
@ok="ok()"
|
|
|
|
>
|
|
|
|
<template #header>:{{ emoji.name }}:</template>
|
|
|
|
|
2023-01-05 12:04:56 +00:00
|
|
|
<MkSpacer :margin-min="20" :margin-max="28">
|
2023-01-06 04:40:17 +00:00
|
|
|
<div class="yigymqpb _gaps_m">
|
2022-12-30 02:14:11 +00:00
|
|
|
<img :src="`/emoji/${emoji.name}.webp`" class="img"/>
|
2023-01-05 12:04:56 +00:00
|
|
|
<MkInput v-model="name">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #label>{{ i18n.ts.name }}</template>
|
2021-08-06 13:29:19 +00:00
|
|
|
</MkInput>
|
2023-01-16 10:36:29 +00:00
|
|
|
<MkInput v-model="category" :datalist="customEmojiCategories">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #label>{{ i18n.ts.category }}</template>
|
2021-08-06 13:29:19 +00:00
|
|
|
</MkInput>
|
2023-01-05 12:04:56 +00:00
|
|
|
<MkInput v-model="aliases">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #label>{{ i18n.ts.tags }}</template>
|
|
|
|
<template #caption>{{ i18n.ts.setMultipleBySeparatingWithSpace }}</template>
|
2021-04-21 03:06:02 +00:00
|
|
|
</MkInput>
|
2023-03-16 06:08:48 +00:00
|
|
|
<MkInput v-model="license">
|
|
|
|
<template #label>{{ i18n.ts.license }}</template>
|
|
|
|
</MkInput>
|
2022-12-19 10:01:30 +00:00
|
|
|
<MkButton danger @click="del()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
2021-04-21 03:06:02 +00:00
|
|
|
</div>
|
2023-01-05 12:04:56 +00:00
|
|
|
</MkSpacer>
|
2023-01-06 00:41:14 +00:00
|
|
|
</MkModalWindow>
|
2020-10-17 11:12:00 +00:00
|
|
|
</template>
|
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-01-06 00:41:14 +00:00
|
|
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 06:09:46 +00:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as os from '@/os';
|
2022-05-15 13:20:01 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2023-01-16 10:36:29 +00:00
|
|
|
import { customEmojiCategories } from '@/custom-emojis';
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
emoji: any,
|
|
|
|
}>();
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
let dialog = $ref(null);
|
|
|
|
let name: string = $ref(props.emoji.name);
|
|
|
|
let category: string = $ref(props.emoji.category);
|
|
|
|
let aliases: string = $ref(props.emoji.aliases.join(' '));
|
2023-03-16 06:08:48 +00:00
|
|
|
let license: string = $ref(props.emoji.license ?? '');
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'done', v: { deleted?: boolean, updated?: any }): void,
|
|
|
|
(ev: 'closed'): void
|
|
|
|
}>();
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
function ok() {
|
|
|
|
update();
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
async function update() {
|
|
|
|
await os.apiWithDialog('admin/emoji/update', {
|
|
|
|
id: props.emoji.id,
|
|
|
|
name,
|
|
|
|
category,
|
|
|
|
aliases: aliases.split(' '),
|
2023-03-16 06:08:48 +00:00
|
|
|
license: license === '' ? null : license,
|
2022-05-15 13:20:01 +00:00
|
|
|
});
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
emit('done', {
|
|
|
|
updated: {
|
|
|
|
id: props.emoji.id,
|
|
|
|
name,
|
|
|
|
category,
|
|
|
|
aliases: aliases.split(' '),
|
2023-03-16 06:08:48 +00:00
|
|
|
license: license === '' ? null : license,
|
2022-07-20 13:24:26 +00:00
|
|
|
},
|
2022-05-15 13:20:01 +00:00
|
|
|
});
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
dialog.close();
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
async function del() {
|
|
|
|
const { canceled } = await os.confirm({
|
|
|
|
type: 'warning',
|
|
|
|
text: i18n.t('removeAreYouSure', { x: name }),
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-05-15 13:20:01 +00:00
|
|
|
os.api('admin/emoji/delete', {
|
2022-07-20 13:24:26 +00:00
|
|
|
id: props.emoji.id,
|
2022-05-15 13:20:01 +00:00
|
|
|
}).then(() => {
|
|
|
|
emit('done', {
|
2022-07-20 13:24:26 +00:00
|
|
|
deleted: true,
|
2022-05-15 13:20:01 +00:00
|
|
|
});
|
|
|
|
dialog.close();
|
|
|
|
});
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2020-10-17 11:12:00 +00:00
|
|
|
.yigymqpb {
|
|
|
|
> .img {
|
|
|
|
display: block;
|
|
|
|
height: 64px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|