<commit_before>import React from 'react';
import { Modal } from 'olymp-fela';
import { withState, withPropsOnChange, compose } from 'recompose';
import Mediathek from './mediathek';

const enhance = compose(
  withState('isOpen', 'setOpen', false),
  withPropsOnChange(['value'], ({ value }) => ({
    value: Array.isArray(value) ? value : [value],
  })),
);
export default renderFn =>
  enhance(({ onChange, value, isOpen, setOpen, multi }) => (
    <div onClick={() => setOpen(true)}>
      {renderFn(value, multi)}

      <Modal open={isOpen} onClose={() => setOpen(false)}>
        <Mediathek
          multi={multi}
          onChange={(value = []) => {
            onChange(multi ? value : value[0]);
            setOpen(false);
          }}
          onClose={() => setOpen(false)}
          value={value}
        />
      </Modal>
    </div>
  ));<commit_msg>close media-modal on  background-click<commit_after>import React from 'react';
import { Modal } from 'olymp-fela';
import { withState, withPropsOnChange, compose } from 'recompose';
import Mediathek from './mediathek';

const enhance = compose(
  withState('isOpen', 'setOpen', false),
  withPropsOnChange(['value'], ({ value }) => ({
    value: Array.isArray(value) ? value : [value],
  })),
);
export default renderFn =>
  enhance(({ onChange, value, isOpen, setOpen, multi }) => (
    <div>
      <div onClick={() => setOpen(true)}>{renderFn(value, multi)}</div>

      <Modal open={isOpen} onClose={() => setOpen(false)}>
        <Mediathek
          multi={multi}
          onChange={(value = []) => {
            onChange(multi ? value : value[0]);
            setOpen(false);
          }}
          onClose={() => setOpen(false)}
          value={value}
        />
      </Modal>
    </div>
  ));
{'fraction_non_alphanumeric': 0.18135593220338983, 'fraction_numerical': 0.0011299435028248588, 'mean_word_length': 2.8333333333333335, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, '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': '1656550', 'n_tokens_mistral': 548, 'n_tokens_neox': 553, 'n_words': 123}