function canInsert(state, nodeType, attrs) {
  let $from = state.selection.$from;
  for (let d = $from.depth; d >= 0; d--) {
    let index = $from.index(d);
    if ($from.node(d).canReplaceWith(index, index, nodeType, attrs))
      return true;
  }
  return false;
}
// Helpers to create specific types of items
Helpers to create specific types of items
Helpers to create specific types of items
function canInsert(state, nodeType, attrs) {
  let $from = state.selection.$from;
  for (let d = $from.depth; d >= 0; d--) {
    let index = $from.index(d);
    if ($from.node(d).canReplaceWith(index, index, nodeType, attrs))
      return true;
  }
  return false;
}
function canInsert ( state , nodeType , attrs ) { let $from = state . selection . $from ; for ( let d = $from . depth ; d >= 0 ; d -- ) { let index = $from . index ( d ) ; if ( $from . node ( d ) . canReplaceWith ( index , index , nodeType , attrs ) ) return true ; } return false ; }
Helpers to create specific types of items
Helpers to create specific types of items