import { injectable } from 'inversify'; import { Commands } from 'wax-prosemirror-utilities'; import Tools from '../../lib/Tools'; export default @injectable() class Heading2 extends Tools { title = 'Change to heading level 2'; content = 'Heading 2'; name = 'Heading2'; get run() { return (state, dispatch) => { Commands.setBlockType(state.config.schema.nodes.heading, { level: 2 })( state, dispatch, ); }; } select = (state, activeViewId) => { if (activeViewId !== 'main') return false; return true; }; get enable() { return state => { return Commands.setBlockType(state.config.schema.nodes.heading, { level: 2, })(state); }; } }