修复: webview尺寸收窄卡住与兜底失效闪退
- 窗口尺寸变化后webview收窄卡住根修 - 尺寸兜底失效致闪退与修复空转加固 - 跨服务器预览残留清理
This commit is contained in:
@@ -513,8 +513,11 @@ const fileEditorPanelConfig = computed(() => {
|
||||
currentFileExtension,
|
||||
isBinaryFile: isBinaryFileRef.value,
|
||||
fileMtime: selectedFileItem.value?.modified_time || '',
|
||||
// 多 tab
|
||||
previewTabs: multiPreview.tabs.value,
|
||||
// 多 tab(按当前服务器过滤,跨服务器的标签不显示在浮动标签栏)
|
||||
previewTabs: (() => {
|
||||
const pid = connectionManager.activeProfile?.id
|
||||
return multiPreview.tabs.value.filter(t => (t.profileId ?? 'local-default') === pid)
|
||||
})(),
|
||||
activeTabId: multiPreview.activeTabId.value,
|
||||
// 预览插件(优先于内置 v-if 链;.drawio/.dio 命中,其余为 null)
|
||||
activePlugin: currentFileName ? resolvePreviewHandler(currentFileName) : null,
|
||||
@@ -569,6 +572,7 @@ const handleFileChanged = async (event: any) => {
|
||||
// 同路径也强制重载:navigate 同路径早退时列表会永远不加载
|
||||
const switchConnection = async (profileId: string) => {
|
||||
await connectionManager.connect(profileId)
|
||||
await syncPreviewToActiveProfile()
|
||||
await loadCommonPaths()
|
||||
const targetPath = connectionManager.isRemote() ? '/' : 'C:/'
|
||||
if (filePath.value === targetPath) {
|
||||
@@ -596,6 +600,7 @@ const handleGoToPath = async (path: string) => {
|
||||
const targetProfileId = getProfileIdForPath(path)
|
||||
if (targetProfileId && targetProfileId !== connectionManager.activeProfile?.id) {
|
||||
await connectionManager.connect(targetProfileId)
|
||||
await syncPreviewToActiveProfile()
|
||||
}
|
||||
await navigate(path)
|
||||
}
|
||||
@@ -1459,6 +1464,26 @@ const doCloseTab = (tabId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 切换服务器后预览区联动:只显示当前服务器的标签与内容,避免旧服务器文档残留卡住 */
|
||||
const syncPreviewToActiveProfile = async () => {
|
||||
const currentProfileId = connectionManager.activeProfile?.id
|
||||
const isMine = (t: PreviewTab) => (t.profileId ?? 'local-default') === currentProfileId
|
||||
|
||||
const active = multiPreview.activeTab.value
|
||||
if (active && isMine(active)) return
|
||||
|
||||
// 面板上残留的是旧服务器内容,先缓存回它自己的 tab(loaded 标记让切回时秒恢复)
|
||||
cacheCurrentTabState()
|
||||
const mine = multiPreview.tabs.value.find(isMine)
|
||||
if (mine) {
|
||||
await activateTab(mine)
|
||||
} else {
|
||||
// 当前服务器没有已打开的预览:回到空白预览态
|
||||
selectedFileItem.value = null
|
||||
clearContent()
|
||||
}
|
||||
}
|
||||
|
||||
/** 缓存当前 tab 的编辑状态 */
|
||||
const cacheCurrentTabState = () => {
|
||||
multiPreview.cacheCurrentTab({
|
||||
|
||||
Reference in New Issue
Block a user