feat: Add block command to create Mermaid diagram

closes #4272
This commit is contained in:
Tom Moor
2022-10-23 13:28:01 -04:00
parent 8ba911b56d
commit 1f1dd23e18
2 changed files with 22 additions and 0 deletions

View File

@@ -19,10 +19,22 @@ import {
ClockIcon,
CalendarIcon,
} from "outline-icons";
import * as React from "react";
import styled from "styled-components";
import Image from "@shared/editor/components/Image";
import { MenuItem } from "@shared/editor/types";
import { Dictionary } from "~/hooks/useDictionary";
import { metaDisplay } from "~/utils/keyboard";
const Img = styled(Image)`
border-radius: 2px;
background: #fff;
box-shadow: 0 0 0 1px #fff;
margin: 4px;
width: 18px;
height: 18px;
`;
export default function blockMenuItems(dictionary: Dictionary): MenuItem[] {
return [
{
@@ -168,5 +180,15 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] {
keywords: "notice card suggestion",
attrs: { style: "tip" },
},
{
name: "separator",
},
{
name: "code_block",
title: "Mermaid Diagram",
icon: () => <Img src="/images/mermaidjs.png" alt="Mermaid Diagram" />,
keywords: "diagram flowchart",
attrs: { language: "mermaidjs" },
},
];
}

BIN
public/images/mermaidjs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB