fix: view note on protected notes warning not dismissing warning

This commit is contained in:
Antonella Sgarlatta
2021-08-09 12:28:51 -03:00
parent e82e27ddb6
commit 083d8f592e
2 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
#editor-column.section.editor.sn-component(aria-label='Note') #editor-column.section.editor.sn-component(aria-label='Note')
protected-note-panel.h-full.flex.justify-center.items-center( protected-note-panel.h-full.flex.justify-center.items-center(
ng-if='self.appState.notes.showProtectedWarning' ng-if='self.state.showProtectedWarning'
app-state='self.appState' app-state='self.appState'
on-view-note='self.dismissProtectedWarning()' on-view-note='self.dismissProtectedWarning()'
) )

View File

@@ -73,6 +73,7 @@ type EditorState = {
/** Setting to true then false will allow the main content textarea to be destroyed /** Setting to true then false will allow the main content textarea to be destroyed
* then re-initialized. Used when reloading spellcheck status. */ * then re-initialized. Used when reloading spellcheck status. */
textareaUnloading: boolean; textareaUnloading: boolean;
showProtectedWarning: boolean;
}; };
type EditorValues = { type EditorValues = {
@@ -199,6 +200,11 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
} }
} }
}); });
this.autorun(() => {
this.setState({
showProtectedWarning: this.appState.notes.showProtectedWarning
});
});
} }
/** @override */ /** @override */
@@ -216,6 +222,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
noteStatus: undefined, noteStatus: undefined,
editorUnloading: false, editorUnloading: false,
textareaUnloading: false, textareaUnloading: false,
showProtectedWarning: false,
} as EditorState; } as EditorState;
} }
@@ -607,7 +614,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
} }
setShowProtectedWarning(show: boolean) { setShowProtectedWarning(show: boolean) {
this.application.getAppState().notes.setShowProtectedWarning(show); this.appState.notes.setShowProtectedWarning(show);
} }
async deleteNote(permanently: boolean) { async deleteNote(permanently: boolean) {