Skip to content

Commit 658b380

Browse files
authored
Remove cut nodes from view (#287)
* lib: apply display none to cut nodes * lib: detect cut nodes without using attrs
1 parent b489d66 commit 658b380

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/ui/outline.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ export const OutlineNode: m.Component<Attrs, State> = {
4343
node = handleNode.refTo;
4444
}
4545

46+
let isCut = false;
47+
if (workbench.clipboard && workbench.clipboard.op === "cut") {
48+
if (workbench.clipboard.node.id === node.id) {
49+
isCut = true;
50+
}
51+
}
52+
4653
const expanded = workbench.workspace.getExpanded(path.head, handleNode);
4754
const placeholder = objectHas(node, "handlePlaceholder") ? objectCall(node, "handlePlaceholder") : '';
4855

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

211218
return (
212-
<div onmouseover={hover} onmouseout={unhover} id={`node-${path.id}-${handleNode.id}`}>
219+
<div onmouseover={hover} onmouseout={unhover} id={`node-${path.id}-${handleNode.id}`} class={isCut ? "cut-node" : ""}>
213220
<div class="node-row-outer-wrapper flex flex-row items-start">
214221
<svg class="node-menu shrink-0" xmlns="http://www.w3.org/2000/svg"
215222
onclick={(e) => workbench.showMenu(e, {node: handleNode, path})}

web/static/app/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ with their icon for Safari only*/
274274
.expanded-node > .indent {
275275
width: var(--8);
276276
}
277+
.cut-node {
278+
display: none;
279+
}
277280
svg.node-menu {
278281
cursor: pointer;
279282
color: var(--color-node-handle);

0 commit comments

Comments
 (0)