mirror of
https://github.com/usememos/memos.git
synced 2025-02-15 10:50:47 +01:00
chore: update memo editor cache key
This commit is contained in:
parent
776785ac90
commit
eb72609ea3
@ -1,4 +1,5 @@
|
|||||||
import { useContext, useEffect } from "react";
|
import { useContext, useEffect } from "react";
|
||||||
|
import MemoResourceListView from "@/components/MemoResourceListView";
|
||||||
import useLoading from "@/hooks/useLoading";
|
import useLoading from "@/hooks/useLoading";
|
||||||
import { useMemoStore } from "@/store/v1";
|
import { useMemoStore } from "@/store/v1";
|
||||||
import MemoContent from "..";
|
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.
|
// 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);
|
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;
|
export default EmbeddedMemo;
|
||||||
|
@ -8,10 +8,11 @@ import Icon from "../Icon";
|
|||||||
|
|
||||||
interface Props extends DialogProps {
|
interface Props extends DialogProps {
|
||||||
memoId?: number;
|
memoId?: number;
|
||||||
|
cacheKey?: string;
|
||||||
relationList?: MemoRelation[];
|
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 globalStore = useGlobalStore();
|
||||||
const tagStore = useTagStore();
|
const tagStore = useTagStore();
|
||||||
const { systemStatus } = globalStore.state;
|
const { systemStatus } = globalStore.state;
|
||||||
@ -26,10 +27,10 @@ const MemoEditorDialog: React.FC<Props> = ({ memoId, relationList, destroy }: Pr
|
|||||||
|
|
||||||
return (
|
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">
|
<div className="flex flex-row justify-start items-center">
|
||||||
<img className="w-5 h-auto rounded-full shadow" src={systemStatus.customizedProfile.logoUrl} alt="" />
|
<img className="w-6 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>
|
<p className="ml-1 text-lg opacity-80 dark:text-gray-300">{systemStatus.customizedProfile.name}</p>
|
||||||
</div>
|
</div>
|
||||||
<IconButton size="sm" onClick={handleCloseBtnClick}>
|
<IconButton size="sm" onClick={handleCloseBtnClick}>
|
||||||
<Icon.X className="w-5 h-auto" />
|
<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]">
|
<div className="flex flex-col justify-start items-start max-w-full w-[36rem]">
|
||||||
<MemoEditorV1
|
<MemoEditorV1
|
||||||
className="border-none !p-0 -mb-2"
|
className="border-none !p-0 -mb-2"
|
||||||
cacheKey={`memo-editor-${memoId}`}
|
cacheKey={`memo-editor-${cacheKey || memoId}`}
|
||||||
memoId={memoId}
|
memoId={memoId}
|
||||||
relationList={relationList}
|
relationList={relationList}
|
||||||
onConfirm={handleCloseBtnClick}
|
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(
|
generateDialog(
|
||||||
{
|
{
|
||||||
className: "memo-editor-dialog",
|
className: "memo-editor-dialog",
|
||||||
|
@ -106,6 +106,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|||||||
const handleEditMemoClick = () => {
|
const handleEditMemoClick = () => {
|
||||||
showMemoEditorDialog({
|
showMemoEditorDialog({
|
||||||
memoId: memo.id,
|
memoId: memo.id,
|
||||||
|
cacheKey: `${memo.id}-${memo.updateTime}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ const MemoDetail = () => {
|
|||||||
const handleEditMemoClick = () => {
|
const handleEditMemoClick = () => {
|
||||||
showMemoEditorDialog({
|
showMemoEditorDialog({
|
||||||
memoId: memo.id,
|
memoId: memo.id,
|
||||||
|
cacheKey: `${memo.id}-${memo.updateTime}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user