2019-02-10 14:14:58 +00:00
|
|
|
import * as React from "react"
|
2019-02-11 18:22:23 +00:00
|
|
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
|
|
|
|
import { WidgetType, CSSUnits } from "../constants/WidgetConstants"
|
|
|
|
|
import TextComponent from "../editorComponents/TextComponent"
|
2019-02-10 14:14:58 +00:00
|
|
|
import _ from "lodash"
|
|
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
class TextWidget extends BaseWidget<ITextWidgetProps, IWidgetState> {
|
2019-02-10 14:14:58 +00:00
|
|
|
constructor(widgetProps: ITextWidgetProps) {
|
|
|
|
|
super(widgetProps)
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-18 15:10:30 +00:00
|
|
|
getPageView() {
|
2019-02-10 14:14:58 +00:00
|
|
|
return (
|
|
|
|
|
<TextComponent
|
2019-03-19 14:05:48 +00:00
|
|
|
style={this.getPositionStyle()}
|
2019-02-11 18:22:23 +00:00
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
key={this.props.widgetId}
|
|
|
|
|
text={this.props.text}
|
2019-02-10 14:14:58 +00:00
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getWidgetType(): WidgetType {
|
|
|
|
|
return "TEXT_WIDGET"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ITextWidgetProps extends IWidgetProps {
|
|
|
|
|
text?: string
|
|
|
|
|
ellipsize?: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default TextWidget
|