mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-12 17:31:00 +08:00
Merge pull request #8967 from aignatov-bio/ai-sci-12490-focus-on-last-created-tag
Focus on last created tag [SCI-12490]
This commit is contained in:
commit
e8c43e55cf
1 changed files with 6 additions and 1 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<div ref="tagsContainer" class="grow overflow-auto max-h-[50vh]">
|
<div ref="tagsContainer" class="grow overflow-auto max-h-[50vh]">
|
||||||
<div v-for="tag in sortedTags" :key="tag.id"
|
<div v-for="tag in sortedTags" :key="tag.id"
|
||||||
|
:id="'tag-' + tag.id"
|
||||||
class="rounded py-2 cursor-pointer hover:bg-sn-super-light-grey px-3 flex items-center gap-2"
|
class="rounded py-2 cursor-pointer hover:bg-sn-super-light-grey px-3 flex items-center gap-2"
|
||||||
:class="{'!bg-sn-super-light-blue': tagInEdit == tag.id }">
|
:class="{'!bg-sn-super-light-blue': tagInEdit == tag.id }">
|
||||||
<div v-if="canAssign" @click="linkTag(tag)" class="h-4">
|
<div v-if="canAssign" @click="linkTag(tag)" class="h-4">
|
||||||
|
|
@ -223,7 +224,11 @@ export default {
|
||||||
this.newTagsCreated.push(parseInt(tag.id, 10));
|
this.newTagsCreated.push(parseInt(tag.id, 10));
|
||||||
this.addingNewTag = false;
|
this.addingNewTag = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.tagsContainer.scrollTop = this.$refs.tagsContainer.scrollHeight;
|
const container = this.$refs.tagsContainer;
|
||||||
|
const newTagElement = this.$el.querySelector(`#tag-${tag.id}`);
|
||||||
|
if (newTagElement) {
|
||||||
|
container.scrollTop = newTagElement.offsetTop - container.offsetTop;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
if (e.response?.data?.errors) {
|
if (e.response?.data?.errors) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue