diff --git a/app/assets/javascripts/views/editor/editor-view.pug b/app/assets/javascripts/views/editor/editor-view.pug index c8ea9791b..d0fe2249c 100644 --- a/app/assets/javascripts/views/editor/editor-view.pug +++ b/app/assets/javascripts/views/editor/editor-view.pug @@ -1,6 +1,6 @@ #editor-column.section.editor.sn-component(aria-label='Note') 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' on-view-note='self.dismissProtectedWarning()' ) diff --git a/app/assets/javascripts/views/editor/editor_view.ts b/app/assets/javascripts/views/editor/editor_view.ts index 46bdaec14..2c3e346af 100644 --- a/app/assets/javascripts/views/editor/editor_view.ts +++ b/app/assets/javascripts/views/editor/editor_view.ts @@ -73,6 +73,7 @@ type EditorState = { /** Setting to true then false will allow the main content textarea to be destroyed * then re-initialized. Used when reloading spellcheck status. */ textareaUnloading: boolean; + showProtectedWarning: boolean; }; type EditorValues = { @@ -199,6 +200,11 @@ class EditorViewCtrl extends PureViewCtrl { } } }); + this.autorun(() => { + this.setState({ + showProtectedWarning: this.appState.notes.showProtectedWarning + }); + }); } /** @override */ @@ -216,6 +222,7 @@ class EditorViewCtrl extends PureViewCtrl { noteStatus: undefined, editorUnloading: false, textareaUnloading: false, + showProtectedWarning: false, } as EditorState; } @@ -607,7 +614,7 @@ class EditorViewCtrl extends PureViewCtrl { } setShowProtectedWarning(show: boolean) { - this.application.getAppState().notes.setShowProtectedWarning(show); + this.appState.notes.setShowProtectedWarning(show); } async deleteNote(permanently: boolean) {