fix(file-viewer): phones ignore expand and the grip, folder paging follows history, swallow Alt+arrows

Under 600px the window stays full screen whatever Expand or a drag says, and both
controls are hidden. Stepping onto a folder-grid entry goes through the grid so its
index follows. Alt+left/right is swallowed at the ends of the list too. Adds tests
for the key handler, the grip clamp and the history/grid case, zh-CN titles and wiki lines.
This commit is contained in:
Devvyn committed 2026-10-18 18:03:54 +08:00
1 parent 08e57ed708
commit 2cd0d82544
6 files changed
+197 -5

No files matched your search

+7
View File
@@ -1039,6 +1039,13 @@
'Source type filter': '来源类型筛选',
'Copy content': '复制内容',
'Edit file': '编辑文件',
'Back (Alt+←)': '后退 (Alt+←)',
'Forward (Alt+→)': '前进 (Alt+→)',
'Back to the previous file': '返回上一个文件',
'Forward to the next file': '前进到下一个文件',
Expand: '展开',
'Restore size': '恢复大小',
'Drag to resize': '拖动以调整大小',
'Rendered markdown': '渲染 Markdown',
'Line numbers': '行号',
'Wrap lines': '自动换行',
+13
View File
@@ -2298,6 +2298,19 @@ html.mobile-init .file-browser-panel {
border-right: none;
}
/* Expand and the resize grip would only shrink the full-screen window (96vw x 94vh,
or a px size left by a drag in landscape), so a phone ignores both. */
.file-preview-window,
.file-preview-window.expanded {
width: 100vw !important;
height: var(--app-height, 100vh) !important;
}
#filePreviewExpandBtn,
.file-preview-resize {
display: none;
}
.file-preview-editbar {
padding-bottom: calc(0.4rem + var(--safe-area-bottom));
}
+11 -2
View File
@@ -4583,6 +4583,13 @@ Object.assign(CodemanApp.prototype, {
// only needs to cover the call itself.
this._filePreviewHistoryStepping = true;
try {
// A folder-grid page goes through the grid so index, lastIndex and the highlighted
// tile follow; otherwise the next ‹ › would continue from the newer file.
const folderFile = e.options?.folderFile;
if (folderFile && folderFile.folderId === this.folderGrid?.folderId) {
const index = this.folderGrid.files.findIndex((f) => f.name === folderFile.name);
if (index !== -1) return this._openFolderGridFile(index);
}
return this.openFilePreview(e.filePath, e.sessionId, e.attachmentId, e.options || {});
} finally {
this._filePreviewHistoryStepping = false;
@@ -4639,11 +4646,13 @@ Object.assign(CodemanApp.prototype, {
if (!this.$('filePreviewOverlay')?.classList.contains('visible')) return;
const t = ev.target;
if (t && (t.isContentEditable || (/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) && !t.classList?.contains('xterm-helper-textarea')))) return;
// Swallowed even at the ends of the list: otherwise the terminal behind the overlay
// types it as word-left/right, and on a header button the browser's own Alt+← goes Back.
ev.preventDefault();
ev.stopPropagation();
const h = this.filePreviewHistory;
const delta = ev.key === 'ArrowLeft' ? -1 : 1;
if (!h || h.index + delta < 0 || h.index + delta >= h.entries.length) return;
ev.preventDefault();
ev.stopPropagation();
this.stepFilePreviewHistory(delta);
},
true