mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-16 00:37:28 +08:00
Merge pull request #6973 from ivanscinote/SCI-9993-ik
Fix status API request and thumbnail buttons in SciNote Edit [SCI-9993]
This commit is contained in:
commit
a21fc9c95b
4 changed files with 38 additions and 26 deletions
|
@ -1,5 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="asset-context-menu" ref="menu">
|
<div class="asset-context-menu"
|
||||||
|
ref="menu"
|
||||||
|
@mouseenter="fetchLocalAppInfo"
|
||||||
|
>
|
||||||
<a class="marvinjs-edit-button hidden"
|
<a class="marvinjs-edit-button hidden"
|
||||||
v-if="attachment.attributes.asset_type == 'marvinjs' && attachment.attributes.urls.marvin_js_start_edit"
|
v-if="attachment.attributes.asset_type == 'marvinjs' && attachment.attributes.urls.marvin_js_start_edit"
|
||||||
ref="marvinjsEditButton"
|
ref="marvinjsEditButton"
|
||||||
|
|
|
@ -15,11 +15,6 @@ export default {
|
||||||
this.attachment.attributes.asset_type !== 'marvinjs'
|
this.attachment.attributes.asset_type !== 'marvinjs'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.fetchLocalAppInfo();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async fetchLocalAppInfo() {
|
async fetchLocalAppInfo() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="attachment-container asset"
|
<div class="attachment-container asset"
|
||||||
:data-asset-id="attachment.id"
|
:data-asset-id="attachment.id"
|
||||||
@mouseover="showOptions = true"
|
@mouseenter="handleMouseEnter"
|
||||||
@mouseleave="handleMouseLeave"
|
@mouseleave="handleMouseLeave"
|
||||||
|
v-click-outside="handleClickOutsideThumbnail"
|
||||||
>
|
>
|
||||||
<a :class="{ hidden: showOptions }"
|
<a :class="{ hidden: showOptions }"
|
||||||
:href="attachment.attributes.urls.blob"
|
:href="attachment.attributes.urls.blob"
|
||||||
|
@ -44,14 +45,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="absolute bottom-4 w-[184px] grid grid-cols-[repeat(4,_2.5rem)] justify-between">
|
<div class="absolute bottom-4 w-[184px] grid grid-cols-[repeat(4,_2.5rem)] justify-between">
|
||||||
<MenuDropdown
|
<MenuDropdown
|
||||||
v-if="showOptions && multipleOpenOptions.length > 1"
|
v-if="multipleOpenOptions.length > 1"
|
||||||
@open_locally="openLocally"
|
|
||||||
@open_scinote_editor="openScinoteEditor"
|
|
||||||
:listItems="multipleOpenOptions"
|
:listItems="multipleOpenOptions"
|
||||||
:btnClasses="'btn btn-light icon-btn thumbnail-action-btn'"
|
:btnClasses="'btn btn-light icon-btn thumbnail-action-btn'"
|
||||||
:position="'left'"
|
:position="'left'"
|
||||||
:btnIcon="'sn-icon sn-icon-open'"
|
:btnIcon="'sn-icon sn-icon-open'"
|
||||||
:title="i18n.t('attachments.thumbnail.buttons.open')"
|
:title="i18n.t('attachments.thumbnail.buttons.open')"
|
||||||
|
@menu-visibility-changed="handleMenuVisibilityChange"
|
||||||
|
@open_locally="openLocally"
|
||||||
|
@open_scinote_editor="openScinoteEditor"
|
||||||
></MenuDropdown>
|
></MenuDropdown>
|
||||||
<a class="btn btn-light icon-btn thumbnail-action-btn"
|
<a class="btn btn-light icon-btn thumbnail-action-btn"
|
||||||
v-else-if="canOpenLocally"
|
v-else-if="canOpenLocally"
|
||||||
|
@ -167,6 +169,7 @@ import MoveAssetModal from '../modal/move.vue';
|
||||||
import NoPredefinedAppModal from '../modal/no_predefined_app_modal.vue';
|
import NoPredefinedAppModal from '../modal/no_predefined_app_modal.vue';
|
||||||
import MoveMixin from './mixins/move.js';
|
import MoveMixin from './mixins/move.js';
|
||||||
import OpenLocallyMixin from './mixins/open_locally.js';
|
import OpenLocallyMixin from './mixins/open_locally.js';
|
||||||
|
import { vOnClickOutside } from '@vueuse/components';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'thumbnailAttachment',
|
name: 'thumbnailAttachment',
|
||||||
|
@ -196,6 +199,9 @@ export default {
|
||||||
showNoPredefinedAppModal: false
|
showNoPredefinedAppModal: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
directives: {
|
||||||
|
'click-outside': vOnClickOutside
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
multipleOpenOptions() {
|
multipleOpenOptions() {
|
||||||
const options = [];
|
const options = [];
|
||||||
|
@ -258,10 +264,25 @@ export default {
|
||||||
this.showOptions = false;
|
this.showOptions = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleMenuVisibilityChange(newValue) {
|
async handleMouseEnter() {
|
||||||
this.isMenuOpen = newValue;
|
await this.fetchLocalAppInfo();
|
||||||
this.showOptions = newValue;
|
this.showOptions = true;
|
||||||
|
},
|
||||||
|
handleMenuVisibilityChange({ isMenuOpen, showOptions }) {
|
||||||
|
if (isMenuOpen !== null) {
|
||||||
|
this.isMenuOpen = isMenuOpen;
|
||||||
}
|
}
|
||||||
|
if (showOptions !== null) {
|
||||||
|
this.showOptions = showOptions;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleClickOutsideThumbnail(event) {
|
||||||
|
const isClickInsideModal = event.target.closest('.modal');
|
||||||
|
if (!isClickInsideModal) {
|
||||||
|
this.showOptions = false;
|
||||||
|
this.isMenuOpen = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="relative" v-if="listItems.length > 0" v-click-outside="closeMenuAndEmit">
|
<div class="relative" v-if="listItems.length > 0" v-click-outside="closeMenu">
|
||||||
<button
|
<button
|
||||||
ref="openBtn"
|
ref="openBtn"
|
||||||
:class="btnClasses"
|
:class="btnClasses"
|
||||||
|
@ -93,9 +93,10 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
showMenu(newValue) {
|
showMenu(newValue) {
|
||||||
if (newValue) {
|
this.$emit('menu-visibility-changed', {
|
||||||
this.$emit('menu-visibility-changed', newValue);
|
isMenuOpen: newValue,
|
||||||
}
|
showOptions: newValue ? true : null
|
||||||
|
});
|
||||||
|
|
||||||
if (this.showMenu) {
|
if (this.showMenu) {
|
||||||
this.openUp = false;
|
this.openUp = false;
|
||||||
|
@ -116,14 +117,6 @@ export default {
|
||||||
closeMenu() {
|
closeMenu() {
|
||||||
this.showMenu = false;
|
this.showMenu = false;
|
||||||
},
|
},
|
||||||
closeMenuAndEmit(event) {
|
|
||||||
const isClickInsideModal = event.target.closest('.modal');
|
|
||||||
|
|
||||||
if (!isClickInsideModal) {
|
|
||||||
this.showMenu = false;
|
|
||||||
this.$emit('menu-visibility-changed', false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleClick(event, item) {
|
handleClick(event, item) {
|
||||||
if (!item.url) {
|
if (!item.url) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
Loading…
Add table
Reference in a new issue