mirror of
https://github.com/felvesthe/Note-Locker.git
synced 2026-07-22 05:44:06 +00:00
Add hotkey option
Signed-off-by: Felvesthe <23108389+Felvesthe@users.noreply.github.com>
This commit is contained in:
parent
fe4652abc1
commit
90775b8b9b
2 changed files with 22 additions and 0 deletions
17
src/main.ts
17
src/main.ts
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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', {
|
||||
|
|
|
|||
Loading…
Reference in a new issue