Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: readonly mode cannot be disabled (fixes streetwriters/notesnook#491)

thecodrrc1e2e322763d
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index e98893899..d55d185e6 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -141,7 +141,7 @@ class EditorStore extends BaseStore {
saveSession = async (sessionId, session) => {
const currentSession = this.get().session;
- if (currentSession.readonly) return; // do not allow saving of readonly session
+ if (currentSession.readonly && session.readonly !== false) return; // do not allow saving of readonly session
this.setSaveState(0);
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 314d0f3a7..4e03c0249 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -122,6 +122,7 @@ class NoteStore extends BaseStore {
readonly = async (id) => {
const note = db.notes.note(id);
await note.readonly();
+ this._syncEditor(note.id, "readonly", !note.data.readonly);
this.refresh();
};