import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
export const findCodeBlock = (state, selection) => {
  const {
    codeBlock
  } = state.schema.nodes;
  return findSelectedNodeOfType(codeBlock)(selection || state.selection) || findParentNodeOfType(codeBlock)(selection || state.selection);
};