feat: show warning when protecting a note with no protection source
This commit is contained in:
@@ -124,4 +124,6 @@ export const Strings = {
|
||||
: 'password manager';
|
||||
return `Your keys are currently stored in your operating system's ${keychainName}. Adding a passcode prevents even your operating system from reading them.`;
|
||||
},
|
||||
protectingNoteWithoutProtectionSources: 'Access to this note will not be restricted until you set up a passcode or account.',
|
||||
openAccountMenu: 'Open Account Menu'
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
||||
import { Strings, STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
||||
import { Editor } from '@/ui_models/editor';
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { PanelPuppet, WebDirective } from '@/types';
|
||||
@@ -713,15 +713,23 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
||||
);
|
||||
}
|
||||
|
||||
toggleProtectNote() {
|
||||
this.saveNote(
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
async toggleProtectNote() {
|
||||
const note = await this.application.changeAndSaveItem<NoteMutator>(
|
||||
this.note.uuid,
|
||||
(mutator) => {
|
||||
mutator.protected = !this.note.protected;
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
if (note?.protected && !this.application.hasProtectionSources()) {
|
||||
if (await confirmDialog({
|
||||
text: Strings.protectingNoteWithoutProtectionSources,
|
||||
confirmButtonText: Strings.openAccountMenu,
|
||||
confirmButtonStyle: 'info',
|
||||
})) {
|
||||
this.appState.accountMenu.setShow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toggleNotePreview() {
|
||||
|
||||
Reference in New Issue
Block a user