Skip to content

Commit b5f03dd

Browse files
committed
Fix: bug in on export
1 parent e2b35b4 commit b5f03dd

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/components/operations/export-button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const ExportAction: React.FC<IExportActionProps> = ({ text = "Export JSON", onEx
5151
icon={<Braces />}
5252
label={text}
5353
onClick={onExportJson}
54+
loading={loading}
5455
className={styles?.core?.button?.className}
5556
style={styles?.core?.button?.properties}
5657
/>

src/components/operations/index.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { ids } from "@/constants";
66
import { store } from "@/store";
77
import { locationPlaceholder, setLocation, toggleControls } from "@/store/reducers/editor";
88
import { ISTKProps } from "@/types";
9-
import { stateToJSON } from "@/utils";
109
import { default as ExportAction } from "./export-button";
1110
import { default as GridSwitch } from "./grid-switch";
1211

@@ -29,17 +28,6 @@ const Operations: React.FC<ISTKProps> = ({
2928
store.dispatch(setLocation(e.target.value));
3029
};
3130

32-
const onExportJson = () => {
33-
const json = stateToJSON();
34-
if (events?.onExport) {
35-
events?.onExport(json);
36-
} else {
37-
console.log(json);
38-
sessionStorage.setItem("stk-data", JSON.stringify(json));
39-
navigator.clipboard.writeText(JSON.stringify(json));
40-
}
41-
};
42-
4331
return (
4432
<div
4533
id={ids.operationBar}
@@ -63,7 +51,7 @@ const Operations: React.FC<ISTKProps> = ({
6351
/>
6452
<div className="flex justify-between items-center gap-5">
6553
{showGridSwitch && <GridSwitch className="mr-2" />}
66-
<ExportAction text={exportButtonText} onExport={onExportJson} styles={props.styles} />
54+
<ExportAction text={exportButtonText} onExport={events?.onExport} styles={props.styles} />
6755
<OperationTriggerIcon
6856
id={ids.operationTrigger}
6957
size={35}

0 commit comments

Comments
 (0)