Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow deleting steps using the keyboard #1017

Merged
merged 1 commit into from Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,6 +39,7 @@ export type EventVars = {
y2: number;
active: boolean;
};
shouldAutoFocus: boolean;
error?: string | null;
timestamp: number | undefined;
subViewIndex: number;
Expand Down Expand Up @@ -393,6 +394,7 @@ export const useEventVars = () => {
...updated,
openedStep: newStep.uuid,
subViewIndex: 0,
shouldAutoFocus: true,
...selectSteps([newStep.uuid]),
});
}
Expand Down Expand Up @@ -424,6 +426,7 @@ export const useEventVars = () => {
return withTimestamp({
...state,
...updated,
shouldAutoFocus: true,
...selectSteps(newSteps.map((s) => s.uuid)),
});
}
Expand All @@ -449,6 +452,7 @@ export const useEventVars = () => {
...state,
cursorControlledStep: undefined,
selectedSteps: [],
shouldAutoFocus: false,
stepSelector: {
x1: selectorOrigin.x,
x2: selectorOrigin.x,
Expand Down Expand Up @@ -485,6 +489,7 @@ export const useEventVars = () => {

return {
...state,
shouldAutoFocus: false,
...selectSteps(uniqueSteps),
};
}
Expand Down Expand Up @@ -704,6 +709,7 @@ export const useEventVars = () => {
selectedConnection: null,
timestamp: undefined,
subViewIndex: 0,
shouldAutoFocus: false,
});

// this function doesn't trigger update, it simply persists clientX clientY for calculation
Expand Down
Expand Up @@ -135,6 +135,7 @@ const StepDetailsComponent: React.FC<{
<StepDetailsProperties
pipelineCwd={pipelineCwd}
readOnly={isReadOnly}
shouldAutoFocus={eventVars.shouldAutoFocus}
onSave={onSave}
menuMaxWidth={`${panelWidth - 48}px`}
/>
Expand Down
Expand Up @@ -56,11 +56,13 @@ const KERNEL_OPTIONS = [
export const StepDetailsProperties = ({
pipelineCwd,
readOnly,
shouldAutoFocus,
onSave,
menuMaxWidth,
}: {
pipelineCwd: string | undefined;
readOnly: boolean;
shouldAutoFocus: boolean;
onSave: (payload: Partial<Step>, uuid: string, replace?: boolean) => void;
menuMaxWidth?: string;
}) => {
Expand Down Expand Up @@ -299,7 +301,7 @@ export const StepDetailsProperties = ({
<div className={"detail-subview"}>
<Stack direction="column" spacing={3}>
<TextField
autoFocus
autoFocus={shouldAutoFocus}
value={step.title}
onChange={(e) => onChangeTitle(e.target.value)}
label="Title"
Expand Down