mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Support for middle mouse click to open in a new tab
This commit is contained in:
parent
ee1b2c699d
commit
cb29a307f0
3 changed files with 6 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "folder-notes",
|
||||
"name": "Folder notes",
|
||||
"version": "1.7.1",
|
||||
"version": "1.7.2",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
|
||||
"author": "Lost Paul",
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export async function turnIntoFolderNote(plugin: FolderNotesPlugin, file: TFile,
|
|||
|
||||
export async function openFolderNote(plugin: FolderNotesPlugin, file: TAbstractFile, evt?: MouseEvent) {
|
||||
const path = file.path;
|
||||
if (plugin.app.workspace.getActiveFile()?.path === path) { return; }
|
||||
if (plugin.app.workspace.getActiveFile()?.path === path && !(Keymap.isModEvent(evt) == 'tab')) { return; }
|
||||
const leaf = plugin.app.workspace.getLeaf(Keymap.isModEvent(evt) || plugin.settings.openInNewTab);
|
||||
if (file instanceof TFile) {
|
||||
await leaf.openFile(file);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
.forEach((element: HTMLElement) => {
|
||||
if (element.onclick) return;
|
||||
if (Platform.isMobile && this.settings.disableOpenFolderNoteOnClick) return;
|
||||
// handle middle click
|
||||
element.addEventListener('auxclick', (event: MouseEvent) => {
|
||||
handleFolderClick(event, this)
|
||||
}, { capture: true });
|
||||
element.onclick = (event: MouseEvent) => handleFolderClick(event, this);
|
||||
this.registerDomEvent(element, 'pointerover', (event: MouseEvent) => {
|
||||
this.hoveredElement = element;
|
||||
|
|
|
|||
Loading…
Reference in a new issue