|
|
|
@ -497,12 +497,18 @@ class App extends React.Component {
|
|
|
|
deleteSourceClick = async () => {
|
|
|
|
deleteSourceClick = async () => {
|
|
|
|
// eslint-disable-next-line no-alert
|
|
|
|
// eslint-disable-next-line no-alert
|
|
|
|
if (this.state.working || !window.confirm('Are you sure you want to move the source file to trash?')) return;
|
|
|
|
if (this.state.working || !window.confirm('Are you sure you want to move the source file to trash?')) return;
|
|
|
|
const { filePath, html5FriendlyPath } = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({ working: true });
|
|
|
|
try {
|
|
|
|
await trash(filePath);
|
|
|
|
this.setState({ working: true });
|
|
|
|
if (html5FriendlyPath) await trash(html5FriendlyPath);
|
|
|
|
|
|
|
|
this.resetState();
|
|
|
|
const { filePath, html5FriendlyPath } = this.state;
|
|
|
|
|
|
|
|
await trash(filePath);
|
|
|
|
|
|
|
|
if (html5FriendlyPath) await trash(html5FriendlyPath);
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
toast.fire({ type: 'error', title: `Failed to trash source file: ${err.message}` });
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
this.resetState();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cutClick = async () => {
|
|
|
|
cutClick = async () => {
|
|
|
|
|