chore: update filter in timeline

This commit is contained in:
Steven
2024-01-18 08:06:59 +08:00
parent 8fcd9332f7
commit 54296f0437
13 changed files with 299 additions and 197 deletions

View File

@ -33,6 +33,7 @@ interface Props {
memoId?: number;
parentMemoId?: number;
relationList?: MemoRelation[];
autoFocus?: boolean;
onConfirm?: (memoId: number) => void;
}
@ -45,7 +46,7 @@ interface State {
}
const MemoEditor = (props: Props) => {
const { className, editorClassName, cacheKey, memoId, parentMemoId, onConfirm } = props;
const { className, editorClassName, cacheKey, memoId, parentMemoId, autoFocus, onConfirm } = props;
const { i18n } = useTranslation();
const t = useTranslate();
const contentCacheKey = `memo-editor-${cacheKey}`;
@ -76,6 +77,12 @@ const MemoEditor = (props: Props) => {
editorRef.current?.setContent(contentCache || "");
}, []);
useEffect(() => {
if (autoFocus) {
handleEditorFocus();
}
}, [autoFocus]);
useEffect(() => {
let visibility = userSetting.memoVisibility;
if (systemStatus.disablePublicMemos && visibility === "PUBLIC") {
@ -376,8 +383,8 @@ const MemoEditor = (props: Props) => {
<Editor ref={editorRef} {...editorConfig} />
<div className="relative w-full flex flex-row justify-between items-center pt-2" onFocus={(e) => e.stopPropagation()}>
<div className="flex flex-row justify-start items-center opacity-80">
<MarkdownMenu editorRef={editorRef} />
<TagSelector editorRef={editorRef} />
<MarkdownMenu editorRef={editorRef} />
<IconButton size="sm" onClick={handleUploadFileBtnClick}>
<Icon.Image className="w-5 h-5 mx-auto" />
</IconButton>