resize popover when toggling editing pinned items

This commit is contained in:
Henry Jameson 2025-01-18 21:21:09 +02:00
parent 9ddf70ce46
commit d25c2f04c9
3 changed files with 15 additions and 10 deletions

View file

@ -275,6 +275,11 @@ const Popover = {
this.scrollable.removeEventListener('scroll', this.onScroll) this.scrollable.removeEventListener('scroll', this.onScroll)
this.scrollable.removeEventListener('resize', this.onResize) this.scrollable.removeEventListener('resize', this.onResize)
}, },
resizePopover () {
setTimeout(() => {
this.updateStyles()
}, 1)
},
onMouseenter (e) { onMouseenter (e) {
if (this.trigger === 'hover') { if (this.trigger === 'hover') {
this.lockReEntry = false this.lockReEntry = false
@ -323,7 +328,12 @@ const Popover = {
this.updateStyles() this.updateStyles()
}, },
onResize (e) { onResize (e) {
this.updateStyles() const content = this.$refs.content
if (!content) return
if (this.oldSize.width !== content.offsetWidth || this.oldSize.height !== content.offsetHeight) {
this.updateStyles()
this.oldSize = { width: content.offsetWidth, height: content.offsetHeight }
}
}, },
onChildPopoverState (childRef, state) { onChildPopoverState (childRef, state) {
if (state) { if (state) {
@ -337,12 +347,7 @@ const Popover = {
// Monitor changes to content size, update styles only when content sizes have changed, // Monitor changes to content size, update styles only when content sizes have changed,
// that should be the only time we need to move the popover box if we don't care about scroll // that should be the only time we need to move the popover box if we don't care about scroll
// or resize // or resize
const content = this.$refs.content this.onResize()
if (!content) return
if (this.oldSize.width !== content.offsetWidth || this.oldSize.height !== content.offsetHeight) {
this.updateStyles()
this.oldSize = { width: content.offsetWidth, height: content.offsetHeight }
}
}, },
mounted () { mounted () {
this.teleport = true this.teleport = true

View file

@ -33,6 +33,7 @@
name="content" name="content"
class="popover-inner" class="popover-inner"
:close="hidePopover" :close="hidePopover"
:resize="resizePopover"
/> />
</div> </div>
</transition> </transition>

View file

@ -41,7 +41,6 @@
:tabindex="0" :tabindex="0"
placement="top" placement="top"
:offset="{ y: 5 }" :offset="{ y: 5 }"
:bound-to="{ x: 'container' }"
remove-padding remove-padding
@show="onShow" @show="onShow"
@close="onClose" @close="onClose"
@ -52,7 +51,7 @@
icon="ellipsis-h" icon="ellipsis-h"
/> />
</template> </template>
<template #content="{close}"> <template #content="{close, resize}">
<div <div
:id="`popup-menu-${randomSeed}`" :id="`popup-menu-${randomSeed}`"
class="dropdown-menu extra-action-buttons" class="dropdown-menu extra-action-buttons"
@ -63,7 +62,7 @@
class="main-button" class="main-button"
role="menuitem" role="menuitem"
:tabindex="0" :tabindex="0"
@click.stop="showPin = !showPin" @click.stop="() => { resize(); showPin = !showPin }"
> >
<FAIcon <FAIcon
class="fa-scale-110" class="fa-scale-110"