Skip to content

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

mobile: prevent dropping file attachments on new notes

kashaf-ansari-deve750671926ce
diff --git a/apps/mobile/app/screens/editor/tiptap/picker.ts b/apps/mobile/app/screens/editor/tiptap/picker.ts
index da7b3dbdb..b27c657f1 100644
--- a/apps/mobile/app/screens/editor/tiptap/picker.ts
+++ b/apps/mobile/app/screens/editor/tiptap/picker.ts
@@ -123,19 +123,17 @@ const file = async (fileOptions: PickerOptions) => {
console.log(e, "error");
});
+ const isNewNote = fileOptions.noteId === undefined;
const currentFileNoteId =
fileOptions.tabId !== undefined
? useTabStore.getState().getNoteIdForTab(fileOptions.tabId)
: undefined;
- if (!fileOptions.noteId && currentFileNoteId) {
- fileOptions.noteId = currentFileNoteId;
- }
+ const isSameNote = currentFileNoteId === fileOptions.noteId;
if (
fileOptions.tabId !== undefined &&
- (currentFileNoteId === fileOptions.noteId ||
- fileOptions.noteId === undefined)
+ (isSameNote || isNewNote)
) {
editorController.current?.commands.insertAttachment(
{