import * as React from "react"; import { stringifyStyle, EMPTY_OBJECT } from "tandem-common"; import { rawCssTextChanged } from "../../../../../../../actions"; import { BaseCodeProps } from "./code.pc"; import { Dispatch } from "redux"; import { SyntheticElement, ComputedStyleInfo } from "paperclip"; export type Props = { dispatch: Dispatch; computedStyleInfo: ComputedStyleInfo; }; export type InnerProps = { onChange: any; } & Props; export default (Base: React.ComponentClass) => class CodeController extends React.PureComponent { onChange = value => { this.props.dispatch(rawCssTextChanged(value)); }; render() { const { onChange } = this; const { computedStyleInfo, ...rest } = this.props; const cssText = getSelectedNodeStyle(computedStyleInfo); return ( ); } }; const getSelectedNodeStyle = (info: ComputedStyleInfo) => { return ( info && stringifyStyle(info.style || EMPTY_OBJECT) .split(";") .join(";\n") ); };