Skip to content

Commit

Permalink
Remove cut nodes from view (#287)
Browse files Browse the repository at this point in the history
* lib: apply display none to cut nodes

* lib: detect cut nodes without using attrs
  • Loading branch information
ArcaTech committed Aug 4, 2023
1 parent b489d66 commit 658b380
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ui/outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ export const OutlineNode: m.Component<Attrs, State> = {
node = handleNode.refTo;
}

let isCut = false;
if (workbench.clipboard && workbench.clipboard.op === "cut") {
if (workbench.clipboard.node.id === node.id) {
isCut = true;
}
}

const expanded = workbench.workspace.getExpanded(path.head, handleNode);
const placeholder = objectHas(node, "handlePlaceholder") ? objectCall(node, "handlePlaceholder") : '';

Expand Down Expand Up @@ -209,7 +216,7 @@ export const OutlineNode: m.Component<Attrs, State> = {
}

return (
<div onmouseover={hover} onmouseout={unhover} id={`node-${path.id}-${handleNode.id}`}>
<div onmouseover={hover} onmouseout={unhover} id={`node-${path.id}-${handleNode.id}`} class={isCut ? "cut-node" : ""}>
<div class="node-row-outer-wrapper flex flex-row items-start">
<svg class="node-menu shrink-0" xmlns="http://www.w3.org/2000/svg"
onclick={(e) => workbench.showMenu(e, {node: handleNode, path})}
Expand Down
3 changes: 3 additions & 0 deletions web/static/app/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ with their icon for Safari only*/
.expanded-node > .indent {
width: var(--8);
}
.cut-node {
display: none;
}
svg.node-menu {
cursor: pointer;
color: var(--color-node-handle);
Expand Down

0 comments on commit 658b380

Please sign in to comment.