diff --git a/backend/static/app.js b/backend/static/app.js
index c30f4a0..fb1e977 100644
--- a/backend/static/app.js
+++ b/backend/static/app.js
@@ -233,6 +233,17 @@ class TranscriptionApp {
const isMd = file.ext === '.md';
const isDocx = file.ext === '.docx';
const icon = isMd ? '📝' : isDocx ? '📄' : '📎';
+ const downloadUrl = `/api/files/download?path=${encodeURIComponent(file.path)}`;
+
+ if (isDocx) {
+ return `
+
+ ${icon}
+ ${this.escapeHtml(file.name)}
+ ${this.formatBytes(file.size)}
+
+ `;
+ }
return `
@@ -293,7 +304,7 @@ class TranscriptionApp {
attachFileItemListeners() {
const container = document.getElementById('fileTree');
- container.querySelectorAll('.file-item').forEach(item => {
+ container.querySelectorAll('.file-item:not(.file-download)').forEach(item => {
item.addEventListener('click', (e) => {
e.stopPropagation();
const path = item.dataset.path;
@@ -365,22 +376,9 @@ class TranscriptionApp {
} else if (ext === '.docx') {
viewer.innerHTML = `
-
⬇️ Скачивание DOCX...
+
⬇️ Нажмите на файл слева для скачивания DOCX
`;
- // iframe method — работает без user-gesture restrictions
- const iframe = document.createElement('iframe');
- iframe.style.display = 'none';
- iframe.src = `/api/files/download?path=${encodeURIComponent(path)}`;
- document.body.appendChild(iframe);
- setTimeout(() => {
- iframe.remove();
- viewer.innerHTML = `
-
- `;
- }, 3000);
}
}
diff --git a/backend/static/styles.css b/backend/static/styles.css
index df021b9..c3633b4 100644
--- a/backend/static/styles.css
+++ b/backend/static/styles.css
@@ -292,11 +292,14 @@ header h1 {
cursor: default;
}
-.file-item.clickable {
+.file-item.clickable, .file-download {
cursor: pointer;
+ text-decoration: none;
+ color: inherit;
+ display: flex;
}
-.file-item.clickable:hover {
+.file-item.clickable:hover, .file-download:hover {
background: var(--bg-hover);
}