mirror of
https://github.com/outline/outline.git
synced 2026-01-06 02:59:54 -06:00
fix: Error in non-Outline Electron browser, improved typings
This commit is contained in:
@@ -44,12 +44,12 @@ function HistoryNavigation(props: React.ComponentProps<typeof Flex>) {
|
||||
return (
|
||||
<Navigation gap={4} {...props}>
|
||||
<Tooltip content={t("Go back")} delay={500}>
|
||||
<NudeButton onClick={() => Desktop.bridge.goBack()}>
|
||||
<NudeButton onClick={() => Desktop.bridge?.goBack()}>
|
||||
<Back $active={back} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
<Tooltip content={t("Go forward")} delay={500}>
|
||||
<NudeButton onClick={() => Desktop.bridge.goForward()}>
|
||||
<NudeButton onClick={() => Desktop.bridge?.goForward()}>
|
||||
<Forward $active={forward} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
|
||||
@@ -3,7 +3,7 @@ import Desktop from "~/utils/Desktop";
|
||||
|
||||
export const useDesktopTitlebar = () => {
|
||||
React.useEffect(() => {
|
||||
if (!Desktop.isElectron()) {
|
||||
if (!Desktop.bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const useDesktopTitlebar = () => {
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
await Desktop.bridge.onTitlebarDoubleClick();
|
||||
await Desktop.bridge?.onTitlebarDoubleClick();
|
||||
};
|
||||
|
||||
window.addEventListener("dblclick", handleDoubleClick);
|
||||
|
||||
@@ -37,6 +37,6 @@ export async function navigateToSubdomain(subdomain: string) {
|
||||
.trim()
|
||||
.replace(/^https?:\/\//, "");
|
||||
const host = `https://${normalizedSubdomain}.getoutline.com`;
|
||||
await Desktop.bridge.addCustomHost(host);
|
||||
await Desktop.bridge?.addCustomHost(host);
|
||||
window.location.href = host;
|
||||
}
|
||||
|
||||
2
app/typings/window.d.ts
vendored
2
app/typings/window.d.ts
vendored
@@ -14,7 +14,7 @@ declare global {
|
||||
|
||||
stores: RootStore;
|
||||
|
||||
DesktopBridge: {
|
||||
DesktopBridge?: {
|
||||
/**
|
||||
* The name of the platform running on.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user