mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update editor actions
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { Dropdown, IconButton, Menu, MenuButton, MenuItem } from "@mui/joy";
|
||||
import toast from "react-hot-toast";
|
||||
import Icon from "@/components/Icon";
|
||||
import showPreviewMarkdownDialog from "@/components/PreviewMarkdownDialog";
|
||||
import { EditorRefActions } from "../Editor";
|
||||
@ -58,6 +59,12 @@ const MarkdownMenu = (props: Props) => {
|
||||
};
|
||||
|
||||
const handlePreviewClick = () => {
|
||||
const content = editorRef.current?.getContent() ?? "";
|
||||
if (content === "") {
|
||||
toast.error("Nothing to preview");
|
||||
return;
|
||||
}
|
||||
|
||||
showPreviewMarkdownDialog(editorRef.current?.getContent() ?? "");
|
||||
};
|
||||
|
||||
@ -83,7 +90,7 @@ const MarkdownMenu = (props: Props) => {
|
||||
<span>Checkbox</span>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={handlePreviewClick}>
|
||||
<Icon.NotebookText className="w-4 h-auto" />
|
||||
<Icon.GanttSquare className="w-4 h-auto" />
|
||||
<span>Preview</span>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
@ -53,9 +53,9 @@ const TagSelector = (props: Props) => {
|
||||
{tags.map((tag) => {
|
||||
return (
|
||||
<div
|
||||
className="inline-block w-auto max-w-full cursor-pointer rounded text-sm leading-6 px-2 hover:bg-zinc-100 dark:hover:bg-zinc-800 shrink-0"
|
||||
onClick={() => handleTagClick(tag)}
|
||||
key={tag}
|
||||
className="inline-flex w-auto max-w-full cursor-pointer rounded text-sm leading-5 px-1 text-gray-500 dark:text-gray-400 hover:bg-zinc-100 dark:hover:bg-zinc-800"
|
||||
onClick={() => handleTagClick(tag)}
|
||||
>
|
||||
<OverflowTip>#{tag}</OverflowTip>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user