mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat: rebuild workspaces as the reference plugin
This commit is contained in:
1 parent
d774df8b41
commit
f217d8db89
79 files changed
+32995
-2184
No files matched your search
@@ -45,8 +45,34 @@ const CORE_SINGLETON = new Set([
|
||||
"ssh-tools",
|
||||
]);
|
||||
|
||||
/** Core tab types that are never part of a saved arrangement. */
|
||||
const CORE_UNSAVED = new Set([
|
||||
"dashboard",
|
||||
"local-terminal",
|
||||
"host-manager",
|
||||
"user-profile",
|
||||
"admin-settings",
|
||||
"split-screen",
|
||||
"sftp",
|
||||
]);
|
||||
|
||||
/**
|
||||
* A tab type no running plugin has registered: its plugin is disabled,
|
||||
* failed, still loading or not installed. The shell shows a placeholder for
|
||||
* it, and a layout keeps it so nothing is lost when the plugin comes back.
|
||||
*/
|
||||
export function isUnregisteredPluginTabType(type: string): boolean {
|
||||
return (
|
||||
!CORE_UNSAVED.has(type) &&
|
||||
!CORE_CAPTURABLE.has(type) &&
|
||||
type !== "serial" &&
|
||||
!getTabType(type)
|
||||
);
|
||||
}
|
||||
|
||||
export function isCapturableTabType(type: string): boolean {
|
||||
if (CORE_CAPTURABLE.has(type)) return true;
|
||||
if (isUnregisteredPluginTabType(type)) return true;
|
||||
const def = getTabType(type);
|
||||
return !!def && def.inLayouts !== false;
|
||||
}
|
||||
@@ -142,6 +168,12 @@ export function resolveLayoutTabTarget(
|
||||
return { kind: "singleton", host };
|
||||
}
|
||||
|
||||
// Reopened as a placeholder rather than dropped, so applying a workspace
|
||||
// while a plugin is off does not quietly lose its tabs.
|
||||
if (!host && isUnregisteredPluginTabType(snapshot.type)) {
|
||||
return { kind: "singleton" };
|
||||
}
|
||||
|
||||
return host ? { kind: "host", host } : { kind: "skip" };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user