diff --git a/src/components/toolbar.tsx b/src/components/toolbar.tsx index 5a4bea21..16e012e8 100644 --- a/src/components/toolbar.tsx +++ b/src/components/toolbar.tsx @@ -31,42 +31,6 @@ const Toolbar = auto((props: { store: Store }) => { }, }); }; - const headingClicked = (level: number) => { - const editor = store.editor; - const currentLine = editor.state.doc.lineAt( - editor.state.selection.main.head, - ); - editor.dispatch({ - changes: { - from: currentLine.from, - to: currentLine.from, - insert: `${'#'.repeat(level)} `, - }, - }); - }; - const hrClicked = () => { - const editor = store.editor; - const cursorPos = editor.state.selection.main.head; - const currentLine = editor.state.doc.lineAt(cursorPos); - const isAtLineStart = cursorPos === currentLine.from; - if (isAtLineStart) { - editor.dispatch({ - changes: { - from: currentLine.from, - to: currentLine.from, - insert: '\n---\n\n', - }, - }); - } else { - editor.dispatch({ - changes: { - from: currentLine.to, - to: currentLine.to, - insert: '\n\n---\n\n', - }, - }); - } - }; const listClicked = (prefix: string) => { const editor = store.editor; const startLine = editor.state.doc.lineAt(editor.state.selection.main.from); @@ -119,22 +83,17 @@ const Toolbar = auto((props: { store: Store }) => { > ))} | - {[1, 2, 3, 4, 5, 6].map((level) => ( - headingClicked(level)} - > - h{level} - - ))} - | hrClicked()} + title="Emoji" + className="fa fa-regular fa-smile" + onClick={() => modals.emoji.open()} + > + modals.fontAwesome.open()} > + | {[ { name: 'Quote', icon: 'fa-quote-left', prefix: '> ' }, { name: 'Unordered list', icon: 'fa-list-ul', prefix: '- ' }, @@ -245,17 +204,6 @@ row 2 col 1 | row 2 col 2`.trim(); }} > | - modals.emoji.open()} - > - modals.fontAwesome.open()} - > - | p:last-child, .info > p:last-child, .warning > p:last-child, .danger > p:last-child { margin-bottom: 0; } - .success { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; } - .info { color: #31708f; background-color: #d9edf7; border-color: #bce8f1; } - .warning { color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; } - .danger { color: #a94442; background-color: #f2dede; border-color: #ebccd1; } +/* mermaid */ pre.mermaid { text-align: center; }