<commit_before>import Embedded from './Embedded';
import getImageComponent from './Image';

const getBlockRenderFunc = (config, customBlockRenderer, getEditorState) => {
  return (block) => {
    if (typeof customBlockRenderer === 'function') {
      const renderedComponent = customBlockRenderer(block, config);
      if (renderedComponent) return renderedComponent;
    }
    if (block.getType() === 'atomic') {
      const contentState = getEditorState().getCurrentContent();
      const entity = contentState.getEntity(block.getEntityAt(0));
      if (entity && entity.type === 'IMAGE') {
        return {
          component: getImageComponent(config),
          editable: false,
        };
      } else if (entity && entity.type === 'EMBEDDED_LINK') {
        return {
          component: Embedded,
          editable: false,
        };
      }
    }
    return undefined;
  };
};

export default getBlockRenderFunc;
<commit_msg>passing editor state customBlockRenderer to be compliant with draft-js 0.10.0<commit_after>import Embedded from './Embedded';
import getImageComponent from './Image';

const getBlockRenderFunc = (config, customBlockRenderer, getEditorState) => {
  return (block) => {
    if (typeof customBlockRenderer === 'function') {
      const renderedComponent = customBlockRenderer(block, config, getEditorState);
      if (renderedComponent) return renderedComponent;
    }
    if (block.getType() === 'atomic') {
      const contentState = getEditorState().getCurrentContent();
      const entity = contentState.getEntity(block.getEntityAt(0));
      if (entity && entity.type === 'IMAGE') {
        return {
          component: getImageComponent(config),
          editable: false,
        };
      } else if (entity && entity.type === 'EMBEDDED_LINK') {
        return {
          component: Embedded,
          editable: false,
        };
      }
    }
    return undefined;
  };
};

export default getBlockRenderFunc;

{'fraction_non_alphanumeric': 0.12090163934426229, 'fraction_numerical': 0.0030737704918032786, 'mean_word_length': 2.9857142857142858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7426927', 'n_tokens_mistral': 526, 'n_tokens_neox': 524, 'n_words': 130}