|
|
@ -1,6 +1,6 @@
|
|
|
|
import { Select, Option, Button, IconButton, Divider } from "@mui/joy";
|
|
|
|
import { Select, Option, Button, IconButton, Divider } from "@mui/joy";
|
|
|
|
import { uniqBy } from "lodash-es";
|
|
|
|
import { uniqBy } from "lodash-es";
|
|
|
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
|
|
import { toast } from "react-hot-toast";
|
|
|
|
import { toast } from "react-hot-toast";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import useLocalStorage from "react-use/lib/useLocalStorage";
|
|
|
|
import useLocalStorage from "react-use/lib/useLocalStorage";
|
|
|
@ -335,10 +335,6 @@ const MemoEditor = (props: Props) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleTagSelectorClick = useCallback((tag: string) => {
|
|
|
|
|
|
|
|
editorRef.current?.insertText(`#${tag} `);
|
|
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleEditorFocus = () => {
|
|
|
|
const handleEditorFocus = () => {
|
|
|
|
editorRef.current?.focus();
|
|
|
|
editorRef.current?.focus();
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -368,20 +364,12 @@ const MemoEditor = (props: Props) => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Editor ref={editorRef} {...editorConfig} />
|
|
|
|
<Editor ref={editorRef} {...editorConfig} />
|
|
|
|
<div className="relative w-full flex flex-row justify-between items-center pt-2" onFocus={(e) => e.stopPropagation()}>
|
|
|
|
<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">
|
|
|
|
<div className="flex flex-row justify-start items-center opacity-80">
|
|
|
|
<TagSelector onTagSelectorClick={(tag) => handleTagSelectorClick(tag)} />
|
|
|
|
<TagSelector editorRef={editorRef} />
|
|
|
|
<IconButton
|
|
|
|
<IconButton size="sm" onClick={handleUploadFileBtnClick}>
|
|
|
|
className="flex flex-row justify-center items-center p-1 w-auto h-auto mr-1 select-none rounded cursor-pointer text-gray-600 dark:!text-gray-400 hover:bg-gray-300 dark:hover:bg-zinc-800 hover:shadow"
|
|
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
|
|
onClick={handleUploadFileBtnClick}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Icon.Image className="w-5 h-5 mx-auto" />
|
|
|
|
<Icon.Image className="w-5 h-5 mx-auto" />
|
|
|
|
</IconButton>
|
|
|
|
</IconButton>
|
|
|
|
<IconButton
|
|
|
|
<IconButton size="sm" onClick={handleAddMemoRelationBtnClick}>
|
|
|
|
className="flex flex-row justify-center items-center p-1 w-auto h-auto mr-1 select-none rounded cursor-pointer text-gray-600 dark:!text-gray-400 hover:bg-gray-300 dark:hover:bg-zinc-800 hover:shadow"
|
|
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
|
|
onClick={handleAddMemoRelationBtnClick}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Icon.Link className="w-5 h-5 mx-auto" />
|
|
|
|
<Icon.Link className="w-5 h-5 mx-auto" />
|
|
|
|
</IconButton>
|
|
|
|
</IconButton>
|
|
|
|
<MarkdownMenu editorRef={editorRef} />
|
|
|
|
<MarkdownMenu editorRef={editorRef} />
|
|
|
|