Skip to content

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

web: support note title from session history in diff viewer Signed-off-by: 01zulfi <[email protected]>

01zulfia91983340cac
diff --git a/apps/web/src/components/diff-viewer/index.tsx b/apps/web/src/components/diff-viewer/index.tsx
index 013e738e0..c411194d4 100644
--- a/apps/web/src/components/diff-viewer/index.tsx
+++ b/apps/web/src/components/diff-viewer/index.tsx
@@ -105,11 +105,16 @@ function DiffViewer(props: DiffViewerProps) {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
- textAlign: "center"
+ textAlign: "center",
+ paddingTop: 10
}}
- >
- {session.note.title}
- </Text>
+ dangerouslySetInnerHTML={{
+ __html:
+ session.type === "diff"
+ ? diff(session.oldContentTitle || "", session.note.title)
+ : session.note.title
+ }}
+ ></Text>
<Flex mt={1} sx={{ alignSelf: "center", justifySelf: "center" }}>
{session.type === "diff" ? (
<>
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index d10a53da8..a649285bc 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -145,6 +145,7 @@ export type DiffEditorSession = BaseEditorSession & {
note: Note;
content: ContentItem;
historySessionId: string;
+ oldContentTitle?: string;
};
export type EditorSession =
@@ -658,9 +659,10 @@ class EditorStore extends BaseStore<EditorStore> {
note,
tabId,
title: label,
+ oldContentTitle: oldContent.title,
historySessionId: session.id,
content: {
- type: oldContent.type,
+ type: oldContent.type || "tiptap",
dateCreated: session.dateCreated,
dateEdited: session.dateModified,
dateModified: session.dateModified,
@@ -670,7 +672,7 @@ class EditorStore extends BaseStore<EditorStore> {
conflicted: currentContent,
...(isCipher(oldContent.data)
? { locked: true, data: oldContent.data }
- : { locked: false, data: oldContent.data })
+ : { locked: false, data: oldContent.data || "" })
}
});
};