Fix useState initialization and update keyboard shortcut for download button
This commit is contained in:
parent
9c025d5889
commit
3baca9b89b
2 changed files with 12 additions and 22 deletions
|
|
@ -86,7 +86,7 @@ export default function NodeToolbarComponent({
|
||||||
const [showModalAdvanced, setShowModalAdvanced] = useState(false);
|
const [showModalAdvanced, setShowModalAdvanced] = useState(false);
|
||||||
const [showconfirmShare, setShowconfirmShare] = useState(false);
|
const [showconfirmShare, setShowconfirmShare] = useState(false);
|
||||||
const [showOverrideModal, setShowOverrideModal] = useState(false);
|
const [showOverrideModal, setShowOverrideModal] = useState(false);
|
||||||
const [flowComponent, setFlowComponent] = useState<FlowType>();
|
const [flowComponent, setFlowComponent] = useState<FlowType>(createFlowComponent(cloneDeep(data), version));
|
||||||
|
|
||||||
const openInNewTab = (url) => {
|
const openInNewTab = (url) => {
|
||||||
window.open(url, "_blank", "noreferrer");
|
window.open(url, "_blank", "noreferrer");
|
||||||
|
|
@ -286,7 +286,7 @@ export default function NodeToolbarComponent({
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setShowconfirmShare((state) => !state);
|
setShowconfirmShare((state) => !state);
|
||||||
}
|
}
|
||||||
if (selected && (event.ctrlKey || event.metaKey) && event.key === "q") {
|
if (selected && (event.ctrlKey || event.metaKey) && event.shiftKey && event.key === "q") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (isMinimal) {
|
if (isMinimal) {
|
||||||
setShowState((show) => !show);
|
setShowState((show) => !show);
|
||||||
|
|
@ -512,7 +512,7 @@ export default function NodeToolbarComponent({
|
||||||
isMac={navigator.userAgent.toUpperCase().includes("MAC")}
|
isMac={navigator.userAgent.toUpperCase().includes("MAC")}
|
||||||
icon="Download"
|
icon="Download"
|
||||||
styleObj={{ iconClasses: "relative top-0.5 mr-2 h-4 w-4" }}
|
styleObj={{ iconClasses: "relative top-0.5 mr-2 h-4 w-4" }}
|
||||||
keyboardKey={"j"} dataTestId={"Dowload-button-nodeToolbar"} />
|
keyboardKey={"J"} dataTestId={"Dowload-button-nodeToolbar"} />
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
<SelectItem
|
<SelectItem
|
||||||
|
|
@ -530,24 +530,14 @@ export default function NodeToolbarComponent({
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
{isMinimal && (
|
{isMinimal && (
|
||||||
<SelectItem value={"show"}>
|
<SelectItem value={"show"}>
|
||||||
<div className="flex">
|
<ToolbarSelectItem
|
||||||
<IconComponent
|
icon={showNode ? "Minimize2" : "Maximize2"}
|
||||||
name={showNode ? "Minimize2" : "Maximize2"}
|
value={showNode ? "Minimize" : "Expand"}
|
||||||
className="relative top-0.5 mr-2 h-4 w-4"
|
isMac={navigator.userAgent.toUpperCase().includes("MAC")}
|
||||||
/>
|
shift={true}
|
||||||
{showNode ? "Minimize" : "Expand"}
|
keyboardKey={"Q"}
|
||||||
{navigator.userAgent.toUpperCase().includes("MAC") ? (
|
dataTestId={"minimize-button-nodeToolbar"}
|
||||||
<IconComponent
|
/>
|
||||||
name="Command"
|
|
||||||
className="absolute right-[1.25rem] top-[0.65em] h-3.5 w-3.5 stroke-2"
|
|
||||||
></IconComponent>
|
|
||||||
) : (
|
|
||||||
<span className="absolute right-[1.30rem] top-[0.40em] stroke-2">
|
|
||||||
Ctrl +{" "}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<span className="absolute right-2 top-[0.46em]">Q</span>
|
|
||||||
</div>
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
{isGroup && (
|
{isGroup && (
|
||||||
|
|
|
||||||
|
|
@ -1170,7 +1170,7 @@ export function downloadNode(NodeFLow: FlowType) {
|
||||||
type: "application/json",
|
type: "application/json",
|
||||||
});
|
});
|
||||||
element.href = URL.createObjectURL(file);
|
element.href = URL.createObjectURL(file);
|
||||||
element.download = `${NodeFLow.name}.json`;
|
element.download = `${NodeFLow?.name??"node"}.json`;
|
||||||
element.click();
|
element.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue