Sorting scene edit page tags alphanumerically, preventing double tags.
This commit is contained in:
parent
211f600242
commit
fdce7b0232
|
@ -43,6 +43,8 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import events from '#/src/events.js';
|
||||
|
||||
import TagSearch from '#/components/tags/search.vue';
|
||||
|
||||
const newTags = ref([]);
|
||||
|
@ -69,6 +71,15 @@ const props = defineProps({
|
|||
const emit = defineEmits(['tags']);
|
||||
|
||||
function addTag(tag) {
|
||||
if (props.edits.tags.some((tagId) => tagId === tag.id)) {
|
||||
events.emit('feedback', {
|
||||
type: 'error',
|
||||
message: 'Tag already added',
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
newTags.value = newTags.value.concat(tag);
|
||||
|
||||
emit('tags', props.edits.tags.concat(tag.id));
|
||||
|
|
|
@ -237,7 +237,7 @@ const fields = computed(() => [
|
|||
{
|
||||
key: 'tags',
|
||||
type: 'tags',
|
||||
value: scene.value.tags,
|
||||
value: scene.value.tags.toSorted((tagA, tagB) => tagA.name.localeCompare(tagB.name)),
|
||||
},
|
||||
{
|
||||
key: 'movies',
|
||||
|
|
Loading…
Reference in New Issue