mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +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:
parent
c957a6cb43
commit
7b18919564
1 changed files with 10 additions and 0 deletions
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue