import { Editor } from '@tiptap/react' import React, { FC } from 'react' import MenuButton from './menu-button.jsx' type Level = 1 | 2 | 3 | 4 | 5 | 6 interface HeadingSelectProps { editor: Editor } const HeadingSelect: FC = (props) => { const { editor } = props const headingLevels: Level[] = [1, 2, 3, 4, 5, 6] return ( <> {headingLevels.map((level) => { const name = `heading.${level}` return ( editor.chain().focus().toggleHeading({ level }).run()} icon="FontSize" attributes={{ level }} >{` ${level}`} ) })} editor.chain().focus().setParagraph().run()} icon="Paragraph" /> ) } export default HeadingSelect