Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update memo editor cache key

Steveneb72609ea325
diff --git a/web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx b/web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
index d69fd648a..0605970ad 100644
--- a/web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
+++ b/web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
@@ -1,4 +1,5 @@
import { useContext, useEffect } from "react";
+import MemoResourceListView from "@/components/MemoResourceListView";
import useLoading from "@/hooks/useLoading";
import { useMemoStore } from "@/store/v1";
import MemoContent from "..";
@@ -33,7 +34,12 @@ const EmbeddedMemo = ({ memoId }: Props) => {
// Add the memo to the set of embedded memos. This is used to prevent infinite loops when a memo embeds itself.
context.embeddedMemos.add(resourceName);
- return <MemoContent nodes={memo.nodes} memoId={memoId} embeddedMemos={context.embeddedMemos} />;
+ return (
+ <div className="w-full">
+ <MemoContent nodes={memo.nodes} memoId={memoId} embeddedMemos={context.embeddedMemos} />
+ <MemoResourceListView resources={memo.resources} />
+ </div>
+ );
};
export default EmbeddedMemo;
diff --git a/web/src/components/MemoEditor/MemoEditorDialog.tsx b/web/src/components/MemoEditor/MemoEditorDialog.tsx
index 736d0bde8..448a4c86a 100644
--- a/web/src/components/MemoEditor/MemoEditorDialog.tsx
+++ b/web/src/components/MemoEditor/MemoEditorDialog.tsx
@@ -8,10 +8,11 @@ import Icon from "../Icon";
interface Props extends DialogProps {
memoId?: number;
+ cacheKey?: string;
relationList?: MemoRelation[];
}
-const MemoEditorDialog: React.FC<Props> = ({ memoId, relationList, destroy }: Props) => {
+const MemoEditorDialog: React.FC<Props> = ({ memoId, cacheKey, relationList, destroy }: Props) => {
const globalStore = useGlobalStore();
const tagStore = useTagStore();
const { systemStatus } = globalStore.state;
@@ -26,10 +27,10 @@ const MemoEditorDialog: React.FC<Props> = ({ memoId, relationList, destroy }: Pr
return (
<>
- <div className="dialog-header-container">
+ <div className="w-full flex flex-row justify-between items-center mb-2">
<div className="flex flex-row justify-start items-center">
- <img className="w-5 h-auto rounded-full shadow" src={systemStatus.customizedProfile.logoUrl} alt="" />
- <p className="ml-1 text-black opacity-80 dark:text-gray-200">{systemStatus.customizedProfile.name}</p>
+ <img className="w-6 h-auto rounded-full shadow" src={systemStatus.customizedProfile.logoUrl} alt="" />
+ <p className="ml-1 text-lg opacity-80 dark:text-gray-300">{systemStatus.customizedProfile.name}</p>
</div>
<IconButton size="sm" onClick={handleCloseBtnClick}>
<Icon.X className="w-5 h-auto" />
@@ -38,7 +39,7 @@ const MemoEditorDialog: React.FC<Props> = ({ memoId, relationList, destroy }: Pr
<div className="flex flex-col justify-start items-start max-w-full w-[36rem]">
<MemoEditorV1
className="border-none !p-0 -mb-2"
- cacheKey={`memo-editor-${memoId}`}
+ cacheKey={`memo-editor-${cacheKey || memoId}`}
memoId={memoId}
relationList={relationList}
onConfirm={handleCloseBtnClick}
@@ -49,7 +50,7 @@ const MemoEditorDialog: React.FC<Props> = ({ memoId, relationList, destroy }: Pr
);
};
-export default function showMemoEditorDialog(props: Pick<Props, "memoId" | "relationList"> = {}): void {
+export default function showMemoEditorDialog(props: Pick<Props, "memoId" | "cacheKey" | "relationList"> = {}): void {
generateDialog(
{
className: "memo-editor-dialog",
diff --git a/web/src/components/MemoView.tsx b/web/src/components/MemoView.tsx
index d13797476..08eae64f9 100644
--- a/web/src/components/MemoView.tsx
+++ b/web/src/components/MemoView.tsx
@@ -106,6 +106,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
const handleEditMemoClick = () => {
showMemoEditorDialog({
memoId: memo.id,
+ cacheKey: `${memo.id}-${memo.updateTime}`,
});
};
diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx
index a7a0d1fb7..716908556 100644
--- a/web/src/pages/MemoDetail.tsx
+++ b/web/src/pages/MemoDetail.tsx
@@ -95,6 +95,7 @@ const MemoDetail = () => {
const handleEditMemoClick = () => {
showMemoEditorDialog({
memoId: memo.id,
+ cacheKey: `${memo.id}-${memo.updateTime}`,
});
};