var Textarea; import { Editor } from '@tinymce/tinymce-react'; import { TinyMCE } from './../globals'; export default window.Textarea = Textarea = class Textarea extends React.Component { constructor(props) { var p; super(props); p = props; props.html = false; this.state = p; console.log('props', props, p); this.getValue = this.getValue.bind(this); } setHtml(x) { var html, value; console.log(x, 'x'); ({ html } = this.state); if (html) { value = this.state.value; } else { value = this.input.value; } return this.setState({ html: x, value }); } getValue() { var html, value; ({ html } = this.state); if (html) { value = this.state.value; } else { value = this.input.value; } console.log('getValue', this.state, value); return value; } render() { var _this = this; var html, label, placeholder, value; ({ value, placeholder, html, label } = this.state); return /*#__PURE__*/React.createElement("div", { className: "c-100" }, /*#__PURE__*/React.createElement("div", { className: "f label fvcenter" }, /*#__PURE__*/React.createElement("div", null, label), /*#__PURE__*/React.createElement("div", { className: "dib ml-20" }, /*#__PURE__*/React.createElement(SwitchIOS, { onChange: this.setHtml.bind(this), label: "HTML" }))), html ? /*#__PURE__*/React.createElement(Editor, { apiKey: TinyMCE.apiKey, init: TinyMCE.config, value: value, onEditorChange: function (value) { return _this.setState({ value }); } }) : /*#__PURE__*/React.createElement("textarea", { ref: function (i) { return _this.input = i; }, defaultValue: value, placeholder: placeholder, className: "i c-100" })); } }; //# sourceMappingURL=textarea.js.map