import * as React from 'react'; import { ICommand, TextState, TextApi } from './'; export const title2: ICommand = { name: 'title2', keyCommand: 'title2', shortcuts: 'ctrlcmd+2', buttonProps: { 'aria-label': 'Insert title2', title: 'Insert title 2' }, icon:
Title 2
, execute: (state: TextState, api: TextApi) => { let modifyText = `## ${state.selectedText}\n`; if (!state.selectedText) { modifyText = `## `; } api.replaceSelection(modifyText); }, };