mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fix #268
This commit is contained in:
parent
c87a8b67d9
commit
726476a42c
3 changed files with 11 additions and 6 deletions
|
|
@ -36,7 +36,8 @@ export async function handleViewHeaderClick(event: MouseEvent, plugin: FolderNot
|
|||
});
|
||||
return;
|
||||
} else if (event.altKey || Keymap.isModEvent(event) === 'tab') {
|
||||
if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) {
|
||||
const usedCtrl = Platform.isMacOS ? event.metaKey : event.ctrlKey;
|
||||
if ((plugin.settings.altKey && event.altKey) || (usedCtrl && Keymap.isModEvent(event) === 'tab')) {
|
||||
await createFolderNote(plugin, folderPath, true, undefined, true);
|
||||
addCSSClassToFileExplorerEl(folderPath, 'has-folder-note', false, plugin);
|
||||
removeCSSClassFromFileExplorerEL(folderPath, 'has-not-folder-note', false, plugin);
|
||||
|
|
|
|||
|
|
@ -278,9 +278,11 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
const excludedFolder = getExcludedFolder(this, folderPath, true);
|
||||
if (excludedFolder?.disableFolderNote) return;
|
||||
|
||||
const usedCtrl = Platform.isMacOS ? evt.metaKey : evt.ctrlKey;
|
||||
|
||||
const folderNote = getFolderNote(this, folderPath);
|
||||
if (!folderNote && (evt.altKey || Keymap.isModEvent(evt) === 'tab')) {
|
||||
if ((this.settings.altKey && evt.altKey) || (this.settings.ctrlKey && Keymap.isModEvent(evt) === 'tab')) {
|
||||
if ((this.settings.altKey && evt.altKey) || (usedCtrl && this.settings.ctrlKey)) {
|
||||
createFolderNote(this, folderPath, true, undefined, true);
|
||||
addCSSClassToFileExplorerEl(folderPath, 'has-folder-note', false, this);
|
||||
removeCSSClassFromFileExplorerEL(folderPath, 'has-not-folder-note', false, this);
|
||||
|
|
@ -289,10 +291,10 @@ export default class FolderNotesPlugin extends Plugin {
|
|||
}
|
||||
if (!(folderNote instanceof TFile)) return;
|
||||
|
||||
if (this.settings.openWithCtrl && !evt.ctrlKey) return;
|
||||
if (this.settings.openWithCtrl && !usedCtrl) return;
|
||||
if (this.settings.openWithAlt && !evt.altKey) return;
|
||||
|
||||
if (!this.settings.enableCollapsing || evt.ctrlKey) {
|
||||
if (!this.settings.enableCollapsing || usedCtrl) {
|
||||
evt.preventDefault();
|
||||
evt.stopImmediatePropagation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,10 +254,11 @@ export async function renderGeneral(settingsTab: SettingsTab) {
|
|||
.addDropdown((dropdown) => {
|
||||
if (!Platform.isMacOS) {
|
||||
dropdown.addOption('ctrl', 'Ctrl + Click');
|
||||
dropdown.addOption('alt', 'Alt + Click');
|
||||
} else {
|
||||
dropdown.addOption('ctrl', 'Cmd + Click');
|
||||
dropdown.addOption('alt', 'Option + Click');
|
||||
}
|
||||
dropdown.addOption('alt', 'Alt + Click');
|
||||
dropdown.setValue(settingsTab.plugin.settings.ctrlKey ? 'ctrl' : 'alt');
|
||||
dropdown.onChange(async (value) => {
|
||||
settingsTab.plugin.settings.ctrlKey = value === 'ctrl';
|
||||
|
|
@ -274,10 +275,11 @@ export async function renderGeneral(settingsTab: SettingsTab) {
|
|||
dropdown.addOption('click', 'Mouse Click');
|
||||
if (!Platform.isMacOS) {
|
||||
dropdown.addOption('ctrl', 'Ctrl + Click');
|
||||
dropdown.addOption('alt', 'Alt + Click');
|
||||
} else {
|
||||
dropdown.addOption('ctrl', 'Cmd + Click');
|
||||
dropdown.addOption('alt', 'Option + Click');
|
||||
}
|
||||
dropdown.addOption('alt', 'Alt + Click');
|
||||
if (settingsTab.plugin.settings.openByClick) {
|
||||
dropdown.setValue('click');
|
||||
} else if (settingsTab.plugin.settings.openWithCtrl) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue