Fix blueimp download

This commit is contained in:
nathan 2024-10-22 16:23:06 -06:00
parent 4bae269e14
commit cc3584b1fc

View File

@ -427,7 +427,7 @@ export function ExposeMixin<B extends Constructor<LitElement>>(superclass : B)
<a title="${egw().lang('Close')}" class="close"></a>
<a title="${egw().lang('Play/Pause')}" class="play-pause"></a>
<a title="${egw().lang('Fullscreen')}" class="fullscreen"></a>
<a title="${egw().lang('Save')}" class="download"></a>
<a title="${egw().lang('Save')}" class="download" @click=${this.handleDownload.bind(this)}></a>
<ol class="indicator"></ol>
</div>
`;
@ -540,6 +540,8 @@ export function ExposeMixin<B extends Constructor<LitElement>>(superclass : B)
// @ts-ignore
this._gallery = new blueimp.Gallery(mediaContent, options);
// @ts-ignore
document.body.querySelector("#blueimp-gallery").gallery = this._gallery
}
/**
@ -952,5 +954,13 @@ export function ExposeMixin<B extends Constructor<LitElement>>(superclass : B)
}
protected expose_onclosed() {}
protected handleDownload(e)
{
const gallery = document.body.querySelector("#blueimp-gallery").gallery;
const index = gallery.getIndex();
const data = gallery.list[index] ?? {};
this.getInstanceManager().download(data.download_href ?? data.download_url ?? data.href);
}
}
}