Add hotkey option

Signed-off-by: Felvesthe <23108389+Felvesthe@users.noreply.github.com>
This commit is contained in:
Felvesthe 2025-05-09 17:45:57 +02:00
parent fe4652abc1
commit 90775b8b9b
2 changed files with 22 additions and 0 deletions

View file

@ -37,6 +37,23 @@ export default class NoteLockerPlugin extends Plugin {
}
this.addSettingTab(new NoteLockerSettingTab(this.app, this));
// hotkey
this.addCommand({
id: 'toggle-note-lock',
name: 'Toggle Lock for current note',
checkCallback: (checking: boolean) => {
const file = this.app.workspace.getActiveFile();
if (file && file.extension === 'md') {
if (!checking) {
this.toggleNoteLock(file.path);
}
return true;
}
return false;
},
});
}
onunload() {

View file

@ -47,6 +47,11 @@ export class NoteLockerSettingTab extends PluginSettingTab {
}
}));
const hotkeyInfo = containerEl.createEl('p', {
text: 'You can set a hotkey for locking/unlocking notes in Settings → Hotkeys → Toggle Lock for current note.'
});
hotkeyInfo.style.fontStyle = 'italic';
containerEl.createEl('h3', { text: 'Locked Notes' });
const lockedNotesCount = this.plugin.settings.lockedNotes.size;
containerEl.createEl('p', {