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';
|
: '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.`;
|
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 { Editor } from '@/ui_models/editor';
|
||||||
import { WebApplication } from '@/ui_models/application';
|
import { WebApplication } from '@/ui_models/application';
|
||||||
import { PanelPuppet, WebDirective } from '@/types';
|
import { PanelPuppet, WebDirective } from '@/types';
|
||||||
@@ -713,15 +713,23 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleProtectNote() {
|
async toggleProtectNote() {
|
||||||
this.saveNote(
|
const note = await this.application.changeAndSaveItem<NoteMutator>(
|
||||||
true,
|
this.note.uuid,
|
||||||
false,
|
|
||||||
true,
|
|
||||||
(mutator) => {
|
(mutator) => {
|
||||||
mutator.protected = !this.note.protected;
|
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() {
|
toggleNotePreview() {
|
||||||
|
|||||||
Reference in New Issue
Block a user