1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-06-21 15:04:01 +02:00

fix add library

This commit is contained in:
Kushagra Gour
2022-07-21 13:35:59 +05:30
parent 432143ba3e
commit 72e5d12a30

View File

@ -19,20 +19,21 @@ export default class AddLibrary extends Component {
return;
}
const type = target.selectedOptions[0].dataset.type;
if (type === 'js') {
this.setState({
js: `${this.state.js}\n${target.value}`
});
} else {
this.setState({
css: `${this.state.css}\n${target.value}`
});
}
trackEvent('ui', 'addLibrarySelect', target.selectedOptions[0].label);
this.props.onChange({ js: this.state.js, css: this.state.css });
// Reset the select to the default value
target.value = '';
this.setState(state => {
const targetValue = target.value;
this.props.onChange({
...state,
[type]: `${this.state[type]}\n${targetValue}`
});
// Reset the select to the default value
target.value = '';
return {
[type]: `${this.state[type]}\n${targetValue}`
};
});
}
textareaBlurHandler(e, textarea) {
const target = e ? e.target : textarea;