mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
feat: share button on connection tabs again
This commit is contained in:
1 parent
f2c9358ecf
commit
cb12541c16
3 files changed
+35
No files matched your search
@@ -320,6 +320,17 @@ export function activate(app: TermixApp): void {
|
||||
},
|
||||
});
|
||||
|
||||
// A small share button on the tab itself, as in 2.8.
|
||||
app.registerSlotContribution("tab.inline", {
|
||||
actionId: SHARE_ACTION,
|
||||
titleKey: "sessionSharing.shareButton",
|
||||
icon: Share2,
|
||||
kind: "button",
|
||||
when: (context) =>
|
||||
typeof (context.handle as { getShareTarget?: unknown } | null | undefined)
|
||||
?.getShareTarget === "function",
|
||||
});
|
||||
|
||||
app.registerSlotContribution("terminal.overlay", {
|
||||
actionId: "session-sharing.participants",
|
||||
titleKey: "collab.members",
|
||||
|
||||
@@ -66,6 +66,9 @@ describe("session-sharing activate", () => {
|
||||
expect(rendered.registered.slot("remote-desktop.toolbar")).toEqual([
|
||||
"session-sharing.share",
|
||||
]);
|
||||
expect(rendered.registered.slot("tab.inline")).toEqual([
|
||||
"session-sharing.share",
|
||||
]);
|
||||
expect(rendered.registered.slot("shell.overlay")).toHaveLength(2);
|
||||
expect(rendered.registered.actions().sort()).toEqual([
|
||||
"session-sharing.share",
|
||||
|
||||
@@ -489,6 +489,27 @@ export function TabBar({
|
||||
<RefreshCw className="size-3" />
|
||||
</button>
|
||||
)}
|
||||
{/* Plugins add small buttons here, invoked with the tab's surface handle. */}
|
||||
<ActionSlot
|
||||
slotId="tab.inline"
|
||||
when={{ tab, handle: tab.terminalRef?.current }}
|
||||
context={() => [tab.terminalRef?.current, tab]}
|
||||
renderItem={(contribution, invoke) => (
|
||||
<button
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
invoke();
|
||||
}}
|
||||
title={t(contribution.titleKey)}
|
||||
className="flex items-center justify-center size-5 md:size-4 rounded-sm transition-colors text-muted-foreground hover:text-foreground hover:bg-muted"
|
||||
>
|
||||
{contribution.icon && (
|
||||
<contribution.icon className="size-3" />
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
/>
|
||||
<button
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={(e) => {
|
||||
|
||||
Reference in new issue
Block a user