Skip to content

Commit cba0544

Browse files
committed
fix: revert back to scrollable page
1 parent 14d3b1f commit cba0544

File tree

2 files changed

+29
-32
lines changed

2 files changed

+29
-32
lines changed

src/filelist.scss

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,9 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22-
.sendent-compact-empty {
23-
min-height: unset !important;
24-
height: auto !important;
25-
flex-grow: 0 !important;
26-
padding: 12px 0 !important;
27-
28-
// Hide the large folder icon
29-
.empty-content__icon {
30-
display: none !important;
31-
}
32-
33-
// Shrink the "No files" title
34-
.empty-content__name {
35-
font-size: 14px !important;
36-
font-weight: normal !important;
37-
color: var(--color-text-maxcontrast) !important;
38-
margin: 0 !important;
39-
}
40-
41-
// Hide the description text
42-
.empty-content__description {
43-
display: none !important;
44-
}
22+
// Hide the "No files" empty state when securemail content is present
23+
.sendent-hide-empty {
24+
display: none !important;
4525
}
4626

4727
#sendent-content {
@@ -62,10 +42,10 @@
6242
iframe {
6343
display: block;
6444
width: 100%;
65-
max-height: 60vh;
6645
min-height: 120px;
46+
overflow: hidden;
6747
background-color: var(--color-main-background);
6848
border: 1px solid var(--color-border);
6949
border-radius: 8px;
7050
}
71-
}
51+
}

src/filelist.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class FooterFile {
8080

8181
if (!anchor) return
8282

83-
// Make the empty state minimal when securemail content is present
84-
compactEmptyState()
83+
// Hide the "No files" empty state when securemail content is present
84+
hideEmptyState()
8585

8686
anchor.insertAdjacentElement('afterend', container)
8787

@@ -138,29 +138,46 @@ class FooterFile {
138138

139139
private generateIframeElement(content: string): HTMLIFrameElement {
140140
const iframe = document.createElement('iframe')
141+
iframe.scrolling = 'no'
142+
143+
const resizeIframe = () => {
144+
const innerHeight = iframe.contentDocument?.documentElement?.scrollHeight
145+
if (innerHeight) iframe.style.height = innerHeight + 'px'
146+
}
147+
148+
iframe.addEventListener('load', () => {
149+
resizeIframe()
150+
// Re-measure after images finish loading
151+
const images = iframe.contentDocument?.querySelectorAll('img')
152+
for (const img of Array.from(images ?? [])) {
153+
if (!img.complete) {
154+
img.addEventListener('load', resizeIframe)
155+
img.addEventListener('error', resizeIframe)
156+
}
157+
}
158+
})
141159
iframe.srcdoc = content
142160
return iframe
143161
}
144162

145163
}
146164

147165
/**
148-
* Collapses the Nextcloud "No files" empty state so it doesn't fill the viewport,
149-
* but keeps it visible as a compact element.
166+
* Hides the Nextcloud "No files" empty state when securemail content is shown.
150167
*/
151-
function compactEmptyState() {
168+
function hideEmptyState() {
152169
const el = document.querySelector('.files-list__empty')
153170
|| document.querySelector('.files-list .empty-content')
154171
if (el instanceof HTMLElement) {
155-
el.classList.add('sendent-compact-empty')
172+
el.classList.add('sendent-hide-empty')
156173
}
157174
}
158175

159176
/**
160177
* Restores the empty state to its default layout.
161178
*/
162179
function restoreEmptyState() {
163-
document.querySelector('.sendent-compact-empty')?.classList.remove('sendent-compact-empty')
180+
document.querySelector('.sendent-hide-empty')?.classList.remove('sendent-hide-empty')
164181
}
165182

166183
let debounceTimer: ReturnType<typeof setTimeout> | null = null

0 commit comments

Comments
 (0)