Skip to content

Conversation

@alexyaroshuk
Copy link
Contributor

closes #10613
closes #8361

What does this PR do?

Restores the ability to open markdown links in the system browser instead of within the webview.

Problem

After the markdown parser was migrated from JavaScript to Rust, clicking links in markdown would navigate within the desktop app's webview instead of opening in the system browser.

The old implementation relied on:

  1. A module-level click event listener
  2. Filtering for links with the external-link class
  3. Using platform.openLink() to open them externally

Solution

Moved the external link handling into the component's onMount() hook to access
the platform
after the DOM is ready. Key improvements:

  • Catches ALL anchor clicks instead of filtering by class (more robust as
    markdown parser changed)
  • Uses stopPropagation() and stopImmediatePropagation() to prevent the
    webview's default link handling
  • Opens with shellOpen() from @tauri-apps/plugin-shell to open in system
    browser
  • Skips internal links (javascript: and # anchors) - but i don't think these are being used in the app as of now

How did you verify your code works?

Ran the app locally and clicked on links to verify they open in your system browser instead of inside the app window

Before

before_fix-link-handling.mp4

After

after_fix-link-handling.mp4

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #8523: feat(desktop): open external links in system browser instead of webview

Why they're related:
This PR (#8523) appears to be the original implementation for opening external links in the system browser instead of the webview. The current PR (#10697) is titled "restore external link opening," suggesting the feature was lost (likely due to the markdown parser migration from JavaScript to Rust mentioned in the description). PR #10697 is re-implementing the same functionality that PR #8523 originally addressed.

@adamdotdevin adamdotdevin merged commit 984518b into anomalyco:dev Jan 26, 2026
9 checks passed
adamdotdevin added a commit that referenced this pull request Jan 26, 2026
@adamdotdevin
Copy link
Contributor

@alexyaroshuk had to revert this as it breaks normal navigation with links (ie, sessions). want to look into a a solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants