1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-29 09:40:10 +02:00

more prettier to worker, migrating change from master branch

This commit is contained in:
Kushagra Gour
2018-10-26 13:38:11 +05:30
parent 834536e315
commit 03e8e3e463
6 changed files with 44 additions and 108 deletions

View File

@@ -1326,17 +1326,18 @@ export default class App extends Component {
return classes.join(' ');
}
prettify(selectedFile) {
prettifyHandler(selectedFile) {
const currentItem = {
...this.state.currentItem,
files: [...this.state.currentItem.files]
};
const formattedContent = prettify(selectedFile);
if (formattedContent !== selectedFile.content) {
selectedFile.content = formattedContent;
this.incrementUnsavedChanges();
this.setState({ currentItem });
}
prettify({ file: selectedFile }).then(formattedContent => {
if (formattedContent !== selectedFile.content) {
selectedFile.content = formattedContent;
this.incrementUnsavedChanges();
this.setState({ currentItem });
}
});
}
render() {
@@ -1375,7 +1376,7 @@ export default class App extends Component {
onRenameFile={this.renameFileHandler.bind(this)}
onFileDrop={this.fileDropHandler.bind(this)}
onFolderSelect={this.folderSelectHandler.bind(this)}
onPrettifyBtnClick={this.prettify.bind(this)}
onPrettifyBtnClick={this.prettifyHandler.bind(this)}
/>
) : (
<ContentWrap