mirror of
https://github.com/signynt/virtual-content.git
synced 2026-07-22 12:40:27 +00:00
Prevent links opening twice in new tab in reading view
Fixes issue where ctrl+click or middle-click on a link while in reading view would cause the link to be opened twice in two new tabs.
This commit is contained in:
parent
cc81960832
commit
fbe4f78407
1 changed files with 3 additions and 0 deletions
3
main.ts
3
main.ts
|
|
@ -1740,6 +1740,9 @@ export default class VirtualFooterPlugin extends Plugin {
|
|||
* @param component The Obsidian Component associated with this content, for event registration.
|
||||
*/
|
||||
public attachInternalLinkHandlers(container: HTMLElement, sourcePath: string, component: Component): void {
|
||||
// If in reading view, do nothing, as the default behavior is fine
|
||||
if (container.closest(".markdown-reading-view")) return;
|
||||
|
||||
// Handle left-click on internal links and external file links
|
||||
component.registerDomEvent(container, 'click', (event: MouseEvent) => {
|
||||
if (event.button !== 0) return; // Only handle left-clicks
|
||||
|
|
|
|||
Loading…
Reference in a new issue