Skip to content

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

web: fix readonly locked notes opening as editable (#5731)

Yoonjae Choi38f69b514ca4
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index 36eaed265..72172c2d4 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -811,7 +811,7 @@ function UnlockNoteView(props: UnlockNoteViewProps) {
throw new Error("note with this id does not exist.");
useEditorStore.getState().addSession({
- type: "default",
+ type: session.note.readonly ? "readonly" : "default",
locked: true,
id: session.id,
note: session.note,
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index 6981533d3..7d05540d4 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -90,6 +90,7 @@ export type ReadonlyEditorSession = BaseEditorSession & {
content?: NoteContent<false>;
color?: string;
tags?: Tag[];
+ locked?: boolean;
};
export type DeletedEditorSession = BaseEditorSession & {