Skip to content

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

web: update editor session content on incoming tiptap sync (#10397)

Mohd Sultancab31d4144f1
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index e1696bf73..b2df608c7 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -297,12 +297,20 @@ function EditorView({
item.type === "tiptap" && item.noteId === session.note.id;
const isNote = item.type === "note" && item.id === session.note.id;
if (isContent && lastChangedTime.current < item.dateModified) {
- if (!item.locked) return editor.updateContent(item.data);
+ if (!item.locked) {
+ if (!session.content)
+ session.content = { type: "tiptap", data: item.data };
+ else session.content.data = item.data;
+ return editor.updateContent(item.data);
+ }
const result = await db.vault
.decryptContent(item)
.catch(() => db.eventManager.publish(EVENTS.vaultLocked));
if (!result) return;
+ if (!session.content)
+ session.content = { type: "tiptap", data: result.data };
+ else session.content.data = result.data;
editor.updateContent(result.data);
} else if (isNote && session.note.title !== item.title) {
AppEventManager.publish(AppEvents.changeNoteTitle, {