mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	Add more link protocol support
This commit is contained in:
		@@ -254,8 +254,15 @@ function goToLinkExt(evt, hrefLink, $link) {
 | 
				
			|||||||
                window.open(hrefLink, '_blank');
 | 
					                window.open(hrefLink, '_blank');
 | 
				
			||||||
            } else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) {
 | 
					            } else if (hrefLink.toLowerCase().startsWith('file:') && utils.isElectron()) {
 | 
				
			||||||
                const electron = utils.dynamicRequire('electron');
 | 
					                const electron = utils.dynamicRequire('electron');
 | 
				
			||||||
 | 
					 | 
				
			||||||
                electron.shell.openPath(hrefLink);
 | 
					                electron.shell.openPath(hrefLink);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                // Enable protocols supported by CKEditor 5 to be clickable. 
 | 
				
			||||||
 | 
					                // Refer to `allowedProtocols` in https://github.com/TriliumNext/trilium-ckeditor5/blob/main/packages/ckeditor5-build-balloon-block/src/ckeditor.ts.
 | 
				
			||||||
 | 
					                // Adding `:` to these links might be safer.
 | 
				
			||||||
 | 
					                const otherAllowedProtocols = ['tel:', 'sms:', 'sftp:', 'smb:', 'slack:', 'file:', 'zotero:'];
 | 
				
			||||||
 | 
					                if (otherAllowedProtocols.some(protocol => hrefLink.startsWith(protocol))){
 | 
				
			||||||
 | 
					                    window.open(hrefLink, '_blank');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user