|
|
|
@ -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>
|
|
|
|
|