import { EditorSelection } from '@codemirror/state'; import { ICommand } from '.'; export const strike: ICommand = { name: 'strike', keyCommand: 'strike', button: { 'aria-label': 'Add strike text' }, icon: ( ), execute: ({ state, view }) => { if (!state || !view) return; view.dispatch( view.state.changeByRange((range) => ({ changes: [ { from: range.from, insert: '~~' }, { from: range.to, insert: '~~' }, ], range: EditorSelection.range(range.from + 2, range.to + 2), })), ); }, };