mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-03 03:17:54 +01:00
Use a resize observer to center the popup after an image is loaded when polyfilled
This commit is contained in:
parent
6cca977d07
commit
b05d5e12fe
@ -182,6 +182,14 @@ export class Popup {
|
|||||||
if (!this.dlg.showModal) {
|
if (!this.dlg.showModal) {
|
||||||
this.dlg.classList.add('poly_dialog');
|
this.dlg.classList.add('poly_dialog');
|
||||||
dialogPolyfill.registerDialog(this.dlg);
|
dialogPolyfill.registerDialog(this.dlg);
|
||||||
|
// Force a vertical reposition after the content
|
||||||
|
// (like crop image) has been set
|
||||||
|
const resizeObserver = new ResizeObserver((entries) => {
|
||||||
|
for (const entry of entries) {
|
||||||
|
dialogPolyfill.reposition(entry.target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
resizeObserver.observe(this.dlg);
|
||||||
}
|
}
|
||||||
this.body = this.dlg.querySelector('.popup-body');
|
this.body = this.dlg.querySelector('.popup-body');
|
||||||
this.content = this.dlg.querySelector('.popup-content');
|
this.content = this.dlg.querySelector('.popup-content');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user