Skip to content

Commit

Permalink
Fix: bug in on export
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed May 18, 2024
1 parent e2b35b4 commit b5f03dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/components/operations/export-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const ExportAction: React.FC<IExportActionProps> = ({ text = "Export JSON", onEx
icon={<Braces />}
label={text}
onClick={onExportJson}
loading={loading}
className={styles?.core?.button?.className}
style={styles?.core?.button?.properties}
/>
Expand Down
14 changes: 1 addition & 13 deletions src/components/operations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ids } from "@/constants";
import { store } from "@/store";
import { locationPlaceholder, setLocation, toggleControls } from "@/store/reducers/editor";
import { ISTKProps } from "@/types";
import { stateToJSON } from "@/utils";
import { default as ExportAction } from "./export-button";
import { default as GridSwitch } from "./grid-switch";

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

const onExportJson = () => {
const json = stateToJSON();
if (events?.onExport) {
events?.onExport(json);
} else {
console.log(json);
sessionStorage.setItem("stk-data", JSON.stringify(json));
navigator.clipboard.writeText(JSON.stringify(json));
}
};

return (
<div
id={ids.operationBar}
Expand All @@ -63,7 +51,7 @@ const Operations: React.FC<ISTKProps> = ({
/>
<div className="flex justify-between items-center gap-5">
{showGridSwitch && <GridSwitch className="mr-2" />}
<ExportAction text={exportButtonText} onExport={onExportJson} styles={props.styles} />
<ExportAction text={exportButtonText} onExport={events?.onExport} styles={props.styles} />
<OperationTriggerIcon
id={ids.operationTrigger}
size={35}
Expand Down

0 comments on commit b5f03dd

Please sign in to comment.