UNPKG

delta-component

Version:

embeddable react component

42 lines (33 loc) 1.09 kB
import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; // TODO: https://github.yandex-team.ru/lego/islands/pull/2304 import { decl } from 'islands/common.blocks/i-bem/i-bem.react.js'; import actions from '../../redux/actions'; import {AceEditor} from '../aceeditor/aceeditor.react.js'; export default decl({ block: 'editor-container', content() { return ( // можно вот так {...this.props}, пока пишу явно <AceEditor id={this.props.id} lang={this.props.lang} theme={this.props.theme} fontSize='20px' /> ); } }, editor => { const mapStateToProps = (state) => { return { lang: state.lang, theme: state.theme, plain: state.plain }; } const mapDispatchToProps = (dispatch) => { return bindActionCreators({ ...actions }, dispatch);; } return connect(mapStateToProps, mapDispatchToProps)(editor); });