Commit 9f6ee377 authored by Sonja Happ's avatar Sonja Happ

Merge branch 'develop' of git.rwth-aachen.de:acs/public/villas/web into develop

parents 30c21ddb 9657e0c5
......@@ -22,28 +22,58 @@ class EditWidgetHTMLContent extends React.Component {
constructor(props) {
super(props);
let value = "";
let parts = props.controlId.split('.');
if (parts.length === 1) {
// not a customProperty
value=props.widget[props.controlId]
} else if(parts.length === 2){
// a custom property
value=props.widget[parts[0]][parts[1]]
} else {
value="controlID contains too many dots"
}
this.state = {
widget: {}
value: value
};
}
handleKeyIgnore(event){
// This function prevents a keystroke from beeing handled by dialog.js
event.stopPropagation();
}
static getDerivedStateFromProps(props, state){
let value = "";
let parts = props.controlId.split('.');
if (parts.length === 1) {
// not a customProperty
value=props.widget[props.controlId]
} else if(parts.length === 2){
// a custom property
value=props.widget[parts[0]][parts[1]]
} else {
value="controlID contains too many dots"
}
return {
widget: props.widget
};
value: value
}
}
handleKeyIgnore(event){
// This function prevents a keystroke from beeing handled by dialog.js
event.stopPropagation();
}
render() {
return <FormGroup controlId={this.props.controlId}>
<FormLabel>HTML Content</FormLabel>
<FormControl onKeyPress={this.handleKeyIgnore} componentClass="textarea" style={{ height: 200 }} placeholder={this.props.placeholder} value={this.state.widget[this.props.controlId] || this.state.widget.customProperties[this.props.controlId] || ''} onChange={e => this.props.handleChange(e)} />
</FormGroup>;
return (
<FormGroup controlId={this.props.controlId}>
<FormLabel>HTML Content</FormLabel>
<FormControl type="text" onKeyPress={this.handleKeyIgnore} componentclass="textarea" style={{ height: 200 }} placeholder={this.props.placeholder} value={this.state.value} onChange={e => this.props.handleChange(e)} />
<FormControl.Feedback />
</FormGroup>
);
}
}
export default EditWidgetHTMLContent;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment