mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 05:39:11 +00:00
Tag external links to open in a separate window on the Desktop app
Previously clicking inline links would open the URL directly in the Desktop app. This was strange and it didn't provide any way to go back to Khoj desktop app UI from the opened link
This commit is contained in:
@@ -385,6 +385,16 @@
|
||||
|
||||
let anchorElements = element.querySelectorAll('a');
|
||||
anchorElements.forEach((anchorElement) => {
|
||||
// Tag external links to open in separate window
|
||||
if (
|
||||
!anchorElement.href.startsWith("./") &&
|
||||
!anchorElement.href.startsWith("#") &&
|
||||
!anchorElement.href.startsWith("/")
|
||||
) {
|
||||
anchorElement.setAttribute('target', '_blank');
|
||||
anchorElement.setAttribute('rel', 'noopener noreferrer');
|
||||
}
|
||||
|
||||
// Add the class "inline-chat-link" to each element
|
||||
anchorElement.classList.add("inline-chat-link");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user