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 );