import { ICommand , TextState , TextAreaTextApi } from './' ; import { selectWord } from '../utils/markdownUtils' ; export const comment = { name : 'comment' , keyCommand : 'comment' , shortcuts : 'ctrlcmd+/' , execute : ( state , api ) => { const newSelectionRange = selectWord ( { text : state . text , selection : state . selection } ) ; const state1 = api . setSelectionRange ( newSelectionRange ) ; const state2 = api . replaceSelection ( `<!-- ${ state1 . selectedText } -->` ) ; api . setSelectionRange ( { start : state2 . selection . end - 4 - state1 . selectedText . length , end : state2 . selection . end - 4 , } ) ; } , } ;