fix(nodeToolbarComponent): add check to disable button when nodeLength is 0 to prevent unwanted actions
feat(nodeToolbarComponent): add event handler to ignore events with "disabled" keyword to prevent unwanted actions
This commit is contained in:
parent
fdde05d29e
commit
cb74a0fb44
1 changed files with 6 additions and 2 deletions
|
|
@ -62,6 +62,9 @@ export default function NodeToolbarComponent({
|
|||
setShowNode((prev) => !prev);
|
||||
updateNodeInternals(data.id);
|
||||
}
|
||||
if(event.includes("disabled")){
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -153,8 +156,8 @@ export default function NodeToolbarComponent({
|
|||
</SelectTrigger>
|
||||
</ShadTooltip>
|
||||
<SelectContent>
|
||||
<SelectItem value={getRandomKeyByssmm() + "advanced"}>
|
||||
<div className="flex">
|
||||
<SelectItem value={getRandomKeyByssmm() + (nodeLength==0?"disabled":"advanced")}>
|
||||
<div className={"flex "+(nodeLength==0?"text-muted-foreground":"text-primary")}>
|
||||
<IconComponent
|
||||
name="Settings2"
|
||||
className="relative top-0.5 mr-2 h-4 w-4"
|
||||
|
|
@ -179,6 +182,7 @@ export default function NodeToolbarComponent({
|
|||
<ShadTooltip content="Edit" side="top">
|
||||
<div>
|
||||
<button
|
||||
disabled={nodeLength === 0}
|
||||
onClick={() => setShowModalAdvanced(true)}
|
||||
className={classNames(
|
||||
"relative -ml-px inline-flex items-center rounded-r-md bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10" +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue