From 952ebd0fb72f5968254fffd2d470a2c8b4f32b40 Mon Sep 17 00:00:00 2001 From: meld-cp <18450687+meld-cp@users.noreply.github.com> Date: Thu, 26 Jun 2025 23:46:36 +1200 Subject: [PATCH] fixed incorrectly adding view actions #207 --- .../EncryptedMarkdownView.ts | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts b/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts index 3a0b7d2..9c93ff2 100644 --- a/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts +++ b/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts @@ -29,6 +29,23 @@ export class EncryptedMarkdownView extends MarkdownView { return ENCRYPTED_FILE_EXTENSIONS.includes( extension ); } + protected override async onOpen(): Promise { + await super.onOpen(); + + // add view actions + this.addAction( + 'key-round', + 'Change password', + () => this.changePassword(), + ) + + this.addAction( + 'lock', + 'Lock & Close', + () => this.lockAndClose(), + ) + } + override async onLoadFile(file: TFile): Promise { //console.debug('onLoadFile', {file}); this.setViewBusy( true ); @@ -96,18 +113,6 @@ export class EncryptedMarkdownView extends MarkdownView { this.isSavingEnabled = true; // allow saving after the file is loaded with a password } - this.addAction( - 'key-round', - 'Change password', - () => this.changePassword(), - ) - - this.addAction( - 'lock', - 'Lock & Close', - () => this.lockAndClose(), - ) - }finally{ //console.debug('onLoadFile done'); this.setViewBusy( false );