fix: 文件选择器改为页内iframe弹窗 + 乱码编码修复 + API路径修复

- pickPath()从window.open改为页内iframe模态弹窗(遮罩+关闭按钮)
- files.html添加meta charset+CSS link,独立模式自动加载files.js
- API路径统一通过_apiUrl()构建,适配主面板和iframe两种上下文
- 独立iframe模式注入body/container覆写样式(无topbar)
- 选择模式栏移至底部margin-top:auto紧凑排列
- MD3风格toggle开关(显示隐藏复选框)
- CSS版本号缓存破坏

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
qinglong
2026-06-11 21:51:42 +08:00
parent d275c78aed
commit 9b997d8bda
5 changed files with 109 additions and 34 deletions
+28
View File
@@ -1,4 +1,6 @@
<!-- File Manager Page -->
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/style.css?v=0601">
<div class="fm-container">
<!-- Top bar: editable path + actions -->
<div class="fm-toolbar">
@@ -64,3 +66,29 @@
<div class="fm-context-item danger" onclick="FilesModule.ctxDelete()">🗑 删除</div>
</div>
</div>
<script>
// Load files.js for standalone mode (iframe picker)
(function(){
// Reset body/container for iframe — no topbar, no sidebar
if(window.parent !== window){
var s=document.createElement('style');
s.textContent='html,body{height:100%;margin:0;overflow:hidden}.fm-container{height:100%;gap:8px}.fm-list{padding-bottom:0}';
document.head.appendChild(s);
}
var cssHref = document.querySelector('link[href*=\"style.css\"]')?.href || '';
// e.g. http://host:4200/SenSu/static/css/style.css → staticBase = .../SenSu/static
var staticBase = cssHref.replace(/\/css\/style\.css.*$/, '');
// apiBase = .../SenSu (strip /static)
var apiBase = cssHref.replace(/\/static\/css\/style\.css.*$/, '');
var script = document.createElement('script');
script.src = staticBase + '/pages/files.js?v=0602';
script.onload = function(){
if(window.FilesModule){
window.FilesModule._apiBase = apiBase;
if(window.FilesModule.init) window.FilesModule.init();
}
};
document.head.appendChild(script);
})();
</script>