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

chore: add onOpenDialog api to support dialog jump #4542

Merged
merged 8 commits into from
Nov 30, 2020
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export const useEditorEventApi = (
const { selectedIds, setSelectedIds, selectableElements } = selectionContext;

const {
onOpenDialog,
onFocusSteps,
onFocusEvent,
onCopy: onClipboardChange,
navTo: onOpen,
saveData: onChange,
undo,
redo,
Expand Down Expand Up @@ -152,7 +152,7 @@ export const useEditorEventApi = (
break;
case NodeEventTypes.OpenDialog:
handler = ({ callee }) => {
onOpen(callee);
onOpenDialog(callee);
announce(ScreenReaderMessage.DialogOpened);
};
break;
Expand Down
5 changes: 5 additions & 0 deletions Composer/packages/client/src/shell/useShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export function useShell(source: EventSource, projectId: string): Shell {
navTo(projectId, null, path, breadcrumb);
}

function openDialog(dialogId: string) {
navTo(projectId, null, dialogId, breadcrumb);
}

function focusEvent(subPath) {
selectTo(projectId, null, null, subPath);
}
Expand Down Expand Up @@ -195,6 +199,7 @@ export function useShell(source: EventSource, projectId: string): Shell {
renameRegExIntent: renameRegExIntentHandler,
updateIntentTrigger: updateIntentTriggerHandler,
navTo: navigationTo,
onOpenDialog: openDialog,
onFocusEvent: focusEvent,
onFocusSteps: focusSteps,
onSelect: setVisualEditorSelection,
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/types/src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type ActionContextApi = {

export type DialogEditingContextApi = {
saveData: <T = any>(newData: T, updatePath?: string) => void;
onOpenDialog: (dialogId: string) => void;
onFocusSteps: (stepIds: string[], focusedTab?: string) => void;
onFocusEvent: (eventId: string) => void;
onSelect: (ids: string[]) => void;
Expand Down