Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

602 B
Raw Blame
import type { MouseEvent } from "react";
import { openExternal } from "@editor/platform/openExternal";

/**
 * Desktop (Tauri) override of the @editor/platform/externalLinkClick seam.
 *
 * The app runs inside a Tauri webview, which traps a `target="_blank"` anchor
 * inside our own window. Intercept the click and hand the URL to the OS browser
 * via the openExternal seam (Tauri shell open) so the link lands in the user's
 * real browser.
 */
export function handleExternalLinkClick(
  url: string,
  event: MouseEvent<HTMLElement>,
): void {
  event.preventDefault();
  void openExternal(url);
}