import * as React from "react"; import { PCSourceTagNames, SyntheticVisibleNode, SyntheticTextNode } from "paperclip"; import { textValueChanged } from "../../../../../actions"; import { BaseTextPropertiesProps, ElementProps } from "./view.pc"; import { Dispatch } from "redux"; export type Props = { dispatch: Dispatch; selectedNodes: SyntheticVisibleNode[]; } & ElementProps; type InnerProps = { onTextValueChange: any; } & Props; export default (Base: React.ComponentClass) => class TextController extends React.PureComponent { onTextValueChange = value => { this.props.dispatch(textValueChanged(value)); }; render() { const { selectedNodes, ...rest } = this.props; const { onTextValueChange } = this; const textNode = selectedNodes.find( (node: SyntheticVisibleNode) => node.name == PCSourceTagNames.TEXT ) as SyntheticTextNode; if (!textNode) { return null; } return ( ); } };