|
|
@ -14,7 +14,7 @@ import { convertVisibilityToString } from "@/utils/memo";
|
|
|
|
import Icon from "./Icon";
|
|
|
|
import Icon from "./Icon";
|
|
|
|
import MemoActionMenu from "./MemoActionMenu";
|
|
|
|
import MemoActionMenu from "./MemoActionMenu";
|
|
|
|
import MemoContent from "./MemoContent";
|
|
|
|
import MemoContent from "./MemoContent";
|
|
|
|
import showMemoEditorDialog from "./MemoEditor/MemoEditorDialog";
|
|
|
|
import MemoEditor from "./MemoEditor";
|
|
|
|
import MemoReactionistView from "./MemoReactionListView";
|
|
|
|
import MemoReactionistView from "./MemoReactionListView";
|
|
|
|
import MemoRelationListView from "./MemoRelationListView";
|
|
|
|
import MemoRelationListView from "./MemoRelationListView";
|
|
|
|
import MemoResourceListView from "./MemoResourceListView";
|
|
|
|
import MemoResourceListView from "./MemoResourceListView";
|
|
|
@ -45,6 +45,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|
|
|
const workspaceMemoRelatedSetting =
|
|
|
|
const workspaceMemoRelatedSetting =
|
|
|
|
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.MEMO_RELATED).memoRelatedSetting ||
|
|
|
|
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.MEMO_RELATED).memoRelatedSetting ||
|
|
|
|
WorkspaceMemoRelatedSetting.fromPartial({});
|
|
|
|
WorkspaceMemoRelatedSetting.fromPartial({});
|
|
|
|
|
|
|
|
const [showEditor, setShowEditor] = useState<boolean>(false);
|
|
|
|
const [creator, setCreator] = useState(userStore.getUserByName(memo.creator));
|
|
|
|
const [creator, setCreator] = useState(userStore.getUserByName(memo.creator));
|
|
|
|
const memoContainerRef = useRef<HTMLDivElement>(null);
|
|
|
|
const memoContainerRef = useRef<HTMLDivElement>(null);
|
|
|
|
const referencedMemos = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
|
|
|
|
const referencedMemos = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
|
|
|
@ -85,10 +86,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|
|
|
|
|
|
|
|
|
|
|
if (workspaceMemoRelatedSetting.enableDoubleClickEdit) {
|
|
|
|
if (workspaceMemoRelatedSetting.enableDoubleClickEdit) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
showMemoEditorDialog({
|
|
|
|
setShowEditor(true);
|
|
|
|
memoName: memo.name,
|
|
|
|
|
|
|
|
cacheKey: `${memo.name}-${memo.updateTime}`,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
@ -137,6 +135,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{!showEditor && (
|
|
|
|
<div className="flex flex-row justify-end items-center select-none shrink-0 gap-2">
|
|
|
|
<div className="flex flex-row justify-end items-center select-none shrink-0 gap-2">
|
|
|
|
<div className="w-auto invisible group-hover:visible flex flex-row justify-between items-center gap-2">
|
|
|
|
<div className="w-auto invisible group-hover:visible flex flex-row justify-between items-center gap-2">
|
|
|
|
{props.showVisibility && memo.visibility !== Visibility.PRIVATE && (
|
|
|
|
{props.showVisibility && memo.visibility !== Visibility.PRIVATE && (
|
|
|
@ -166,9 +165,29 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|
|
|
<Icon.Bookmark className="w-4 h-auto text-amber-500" />
|
|
|
|
<Icon.Bookmark className="w-4 h-auto text-amber-500" />
|
|
|
|
</Tooltip>
|
|
|
|
</Tooltip>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
{!readonly && <MemoActionMenu className="-ml-1" memo={memo} hiddenActions={props.showPinned ? [] : ["pin"]} />}
|
|
|
|
{!readonly && (
|
|
|
|
|
|
|
|
<MemoActionMenu
|
|
|
|
|
|
|
|
className="-ml-1"
|
|
|
|
|
|
|
|
memo={memo}
|
|
|
|
|
|
|
|
hiddenActions={props.showPinned ? [] : ["pin"]}
|
|
|
|
|
|
|
|
onEdit={() => setShowEditor(true)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{showEditor ? (
|
|
|
|
|
|
|
|
<MemoEditor
|
|
|
|
|
|
|
|
autoFocus
|
|
|
|
|
|
|
|
className="border-none !p-0 -mb-2"
|
|
|
|
|
|
|
|
cacheKey={`inline-memo-editor-${memo.name}`}
|
|
|
|
|
|
|
|
memoName={memo.name}
|
|
|
|
|
|
|
|
onConfirm={() => setShowEditor(false)}
|
|
|
|
|
|
|
|
onCancel={() => setShowEditor(false)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<>
|
|
|
|
<MemoContent
|
|
|
|
<MemoContent
|
|
|
|
key={`${memo.name}-${memo.updateTime}`}
|
|
|
|
key={`${memo.name}-${memo.updateTime}`}
|
|
|
|
memoName={memo.name}
|
|
|
|
memoName={memo.name}
|
|
|
@ -181,6 +200,8 @@ const MemoView: React.FC<Props> = (props: Props) => {
|
|
|
|
<MemoResourceListView resources={memo.resources} />
|
|
|
|
<MemoResourceListView resources={memo.resources} />
|
|
|
|
<MemoRelationListView memo={memo} relations={referencedMemos} />
|
|
|
|
<MemoRelationListView memo={memo} relations={referencedMemos} />
|
|
|
|
<MemoReactionistView memo={memo} reactions={memo.reactions} />
|
|
|
|
<MemoReactionistView memo={memo} reactions={memo.reactions} />
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|