mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
Explicitly set focus on insert (#285)
Adds a flag to the insert layout action to explicitly set the focus of a newly inserted node. This also adds a flag in the starter layout to focus on the terminal block.
This commit is contained in:
@@ -393,6 +393,7 @@ export class LayoutModel {
|
||||
blockId: action.blockid,
|
||||
}),
|
||||
magnified: action.magnified,
|
||||
focused: action.focused,
|
||||
};
|
||||
this.treeReducer(insertNodeAction);
|
||||
break;
|
||||
@@ -423,6 +424,7 @@ export class LayoutModel {
|
||||
}),
|
||||
indexArr: action.indexarr,
|
||||
magnified: action.magnified,
|
||||
focused: action.focused,
|
||||
};
|
||||
this.treeReducer(insertAction);
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,6 @@ export function useDebouncedNodeInnerRect(nodeModel: NodeModel): CSSProperties {
|
||||
}
|
||||
setDebounceTimeout(
|
||||
setTimeout(() => {
|
||||
console.log("setting inner rect", nodeInnerRect);
|
||||
setInnerRect(nodeInnerRect);
|
||||
setDebounceTimeout(null);
|
||||
}, nodeModel.animationTimeS * 1000)
|
||||
|
||||
@@ -268,7 +268,10 @@ export function insertNode(layoutState: LayoutTreeState, action: LayoutTreeInser
|
||||
addChildAt(insertLoc.node, insertLoc.index, action.node);
|
||||
if (action.magnified) {
|
||||
layoutState.magnifiedNodeId = action.node.id;
|
||||
layoutState.focusedNodeId = action.node.id;
|
||||
}
|
||||
}
|
||||
if (action.focused) {
|
||||
layoutState.focusedNodeId = action.node.id;
|
||||
}
|
||||
layoutState.generation++;
|
||||
@@ -290,7 +293,10 @@ export function insertNodeAtIndex(layoutState: LayoutTreeState, action: LayoutTr
|
||||
addChildAt(insertLoc.node, insertLoc.index + 1, action.node);
|
||||
if (action.magnified) {
|
||||
layoutState.magnifiedNodeId = action.node.id;
|
||||
layoutState.focusedNodeId = action.node.id;
|
||||
}
|
||||
}
|
||||
if (action.focused) {
|
||||
layoutState.focusedNodeId = action.node.id;
|
||||
}
|
||||
layoutState.generation++;
|
||||
|
||||
@@ -125,7 +125,11 @@ interface InsertNodeOperation {
|
||||
/**
|
||||
* Whether the inserted node should be magnified.
|
||||
*/
|
||||
magnified?: boolean;
|
||||
magnified: boolean;
|
||||
/**
|
||||
* Whether the inserted node should be focused.
|
||||
*/
|
||||
focused: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user