Skip to content

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

mobile: fix readonly mode

Ammar Ahmed69c20045c209
diff --git a/apps/mobile/app/screens/editor/index.tsx b/apps/mobile/app/screens/editor/index.tsx
index d3b1ca015..d2c314b8e 100755
--- a/apps/mobile/app/screens/editor/index.tsx
+++ b/apps/mobile/app/screens/editor/index.tsx
@@ -102,7 +102,7 @@ const Editor = React.memo(
useEffect(() => {
const sub = [eSubscribeEvent("webview_reset", onError)];
return () => {
- sub.forEach((s) => s.unsubscribe());
+ sub.forEach((s) => s?.unsubscribe());
};
}, [onError]);
@@ -179,9 +179,8 @@ const ReadonlyButton = ({ editor }: { editor: useEditorType }) => {
const onPress = async () => {
if (editor.note.current) {
- await db.notes.note(editor.note.current.id)?.readonly();
- editor.note.current = db.notes?.note(editor.note.current.id)?.data;
-
+ await db.notes.readonly(false, editor.note.current.id);
+ editor.note.current = await db.notes?.note(editor.note.current.id);
useEditorStore.getState().setReadonly(false);
}
};