Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private onSave = (): void => {
const newProperties = JSON.parse(this.state.propertiesJson);
for (let propName in newProperties) {
set(this.props.webpart.properties, propName, newProperties[propName]);
if (typeof this.props.webpart.properties[propName].onChange !== 'undefined' && this.props.webpart.properties[propName].onChange !== null) {
this.props.webpart.properties[propName].onChange(propName, newProperties[propName]);
}
}
this.props.webpart.render();
this.props.webpart.context.propertyPane.refresh();
this.setState((current) => ({ ...current, openPanel: false }));
}