swarm-ui: a todo switched from clear to upsert drops its prefix flag
This commit is contained in:
parent
06f3e76329
commit
fb8aa23e66
5 changed files with 34 additions and 12 deletions
|
|
@ -200,6 +200,20 @@ export function reparent(
|
|||
};
|
||||
}
|
||||
|
||||
// A todo with its op switched. A clear carries no text, and only a clear may
|
||||
// be a prefix, so each is reset where the new op has no place for it.
|
||||
export function withOp(
|
||||
node: Extract<FlowNode, { kind: "todo" }>,
|
||||
op: "upsert" | "clear",
|
||||
): Extract<FlowNode, { kind: "todo" }> {
|
||||
return {
|
||||
...node,
|
||||
op,
|
||||
text: op === "clear" ? "" : node.text,
|
||||
prefix: op === "clear" ? node.prefix : false,
|
||||
};
|
||||
}
|
||||
|
||||
// The node with `next.id` swapped for `next`. A node keeps its place and its
|
||||
// kind-class: the source stays the source, and nothing with children becomes
|
||||
// a todo.
|
||||
|
|
|
|||
Loading…
Reference in a new issue