Use dynamic max height for attachment preview (#4651)
Some checks failed
CI / Build, Upload, Test (push) Has been cancelled

This commit is contained in:
windingwind 2024-08-31 14:10:23 +08:00 committed by GitHub
parent e0aaa7e366
commit 181196149a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -606,6 +606,7 @@
_handleResize() {
if (this.disableResize) return;
this.style.setProperty("--preview-width", `${this.clientWidth}px`);
this.style.setProperty("--screen-height", `${window.screen.availHeight}px`);
}
_handleDragStart(event) {

View file

@ -9,7 +9,10 @@ attachment-preview {
// Suppose it's A4 size
--width-height-ratio: 0.7070707071;
--min-height: 56px;
--max-height: 600px;
// This is set in JS
--screen-height: 600px;
// Use screen available height - 200px (approximately the height of the toolbars)
--max-height: calc(max(var(--screen-height) - 200px, 600px));
// This is set in JS
--preview-width: 400;
--preview-height: calc(min(var(--preview-width) / var(--width-height-ratio), var(--max-height)));