added support for external protocols

This commit is contained in:
Gamosoft 2026-04-06 16:30:27 +02:00
parent e94cd88d63
commit 70982f81c1
2 changed files with 4 additions and 1 deletions

View File

@ -59,6 +59,7 @@
- **Drag to link** - Drag notes or images into the editor to insert links
- **Click to navigate** - Jump between notes seamlessly
- **External links** - Open in new tabs automatically
- **URI protocols** - Supports `mailto:`, `tel:`, `ssh:`, `ftp:`, `slack:`, `discord:`, `teams:`, `zoom:`, `whatsapp:`, `telegram:`, `signal:`, `spotify:`, `steam:`, `magnet:`, and more
### Outline Panel
- **Table of Contents** - View all headings (H1-H6) in sidebar

View File

@ -2580,7 +2580,9 @@ function noteApp() {
if (!href) return;
// Check if it's an external link or API path (media files, etc.)
if (href.startsWith('http://') || href.startsWith('https://') || href.startsWith('//') || href.startsWith('mailto:') || href.startsWith('/api/')) {
// Safe external protocols: http, https, mailto, tel, ssh, ftp, sftp, and app deep links
const externalProtocols = ['http://', 'https://', '//', 'mailto:', 'tel:', 'ssh:', 'ftp:', 'sftp:', 'slack:', 'discord:', 'teams:', 'vscode:', 'zoom:', 'whatsapp:', 'telegram:', 'signal:', 'spotify:', 'steam:', 'magnet:', '/api/'];
if (externalProtocols.some(p => href.startsWith(p))) {
return; // Let external links and API paths work normally
}