Feat: Implement ungroup shortcut (Ctrl U)
This commit is contained in:
parent
8dad400216
commit
e4db0f225a
1 changed files with 28 additions and 6 deletions
|
|
@ -209,6 +209,23 @@ export default function NodeToolbarComponent({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function onKeyDown(event: KeyboardEvent) {
|
function onKeyDown(event: KeyboardEvent) {
|
||||||
|
if (
|
||||||
|
(selected && isGroup) &&
|
||||||
|
(event.ctrlKey || event.metaKey) &&
|
||||||
|
event.key === "u"
|
||||||
|
) {
|
||||||
|
event.preventDefault();
|
||||||
|
takeSnapshot();
|
||||||
|
expandGroupNode(
|
||||||
|
data.id,
|
||||||
|
updateFlowPosition(position, data.node?.flow!),
|
||||||
|
data.node!.template,
|
||||||
|
nodes,
|
||||||
|
edges,
|
||||||
|
setNodes,
|
||||||
|
setEdges
|
||||||
|
);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
selected &&
|
selected &&
|
||||||
(hasApiKey || hasStore) &&
|
(hasApiKey || hasStore) &&
|
||||||
|
|
@ -548,12 +565,17 @@ export default function NodeToolbarComponent({
|
||||||
{isGroup && (
|
{isGroup && (
|
||||||
<SelectItem value="ungroup">
|
<SelectItem value="ungroup">
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Combine"
|
name="Ungroup"
|
||||||
className="relative top-0.5 mr-2 h-4 w-4"
|
className="relative top-0.5 mr-2 h-4 w-4 "
|
||||||
/>{" "}
|
/>{" "}
|
||||||
Ungroup{" "}
|
<span className="">Ungroup</span>{" "}
|
||||||
</div>
|
<IconComponent
|
||||||
|
name="Command"
|
||||||
|
className="absolute right-[1.15rem] top-[0.65em] h-3.5 w-3.5 stroke-2"
|
||||||
|
></IconComponent>
|
||||||
|
<span className="absolute right-2 top-[0.43em]">U</span>
|
||||||
|
</div>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue