-
Notifications
You must be signed in to change notification settings - Fork 876
feat: open app in tab or slim-window #16152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,12 +129,12 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => { | |
} | ||
|
||
event.preventDefault(); | ||
|
||
// This is an external URI like "vscode://", so | ||
// it needs to be opened with the browser protocol handler. | ||
if (app.external && !app.url.startsWith("http")) { | ||
// If the protocol is external the browser does not | ||
// redirect the user from the page. | ||
const isBrowserProtocol = app.external && !app.url.startsWith("http"); | ||
|
||
if (isBrowserProtocol) { | ||
// This is a magic undocumented string that is replaced | ||
// with a brand-new session token from the backend. | ||
// This only exists for external URLs, and should only | ||
|
@@ -149,12 +149,22 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => { | |
setFetchingSessionToken(false); | ||
} | ||
window.location.href = url; | ||
} else { | ||
window.open( | ||
href, | ||
Language.appTitle(appDisplayName, generateRandomString(12)), | ||
"width=900,height=600", | ||
); | ||
return; | ||
} | ||
|
||
switch (app.open_in) { | ||
case "slim-window": { | ||
window.open( | ||
href, | ||
Language.appTitle(appDisplayName, generateRandomString(12)), | ||
"width=900,height=600", | ||
); | ||
return; | ||
} | ||
case "tab": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We ensure it will always be set and contain one of these two values. |
||
window.open(href); | ||
return; | ||
} | ||
} | ||
}} | ||
> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait this is actually the opposite, right? Not a browser protocol (like
vscode://
). MaybeisExternalProtocol
?Well, I guess the browser does handle it by launching the external app, but
isBrowser
makes me think ofhttp://
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It made sense to me before you brought this up—now I’m not so sure. Maybe
shouldOpenAppExternally
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that name