Skip to content

Commit

Permalink
Merge branch 'master' into updatebf-lu
Browse files Browse the repository at this point in the history
  • Loading branch information
cwhitten authored May 9, 2020
2 parents f9b9994 + 5219327 commit 44ae7a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const KeyNameByModifierAttr = {
shiftKey: 'Shift',
};

const overriddenKeyCodes = ['Tab', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
const overriddenKeyCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];

interface KeyboardZoneProps {
onCommand: (action, e: KeyboardEvent) => object | void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { normalizeSelection } from '../utils/normalizeSelection';
import { KeyboardZone } from '../components/lib/KeyboardZone';
import { scrollNodeIntoView } from '../utils/nodeOperation';
import { designerCache } from '../store/DesignerCache';
import { MenuEventTypes } from '../constants/MenuTypes';
import { MenuTypes, MenuEventTypes } from '../constants/MenuTypes';

import { AdaptiveDialogEditor } from './AdaptiveDialogEditor';

Expand Down Expand Up @@ -252,6 +252,12 @@ export const ObiEditor: FC<ObiEditorProps> = ({
setSelectableElements(querySelectableElements());
}, [data, focusedEvent]);

useEffect((): void => {
if (!focusedId) {
resetSelectionData();
}
}, [focusedId]);

const selection = new Selection({
onSelectionChanged: (): void => {
const selectedIndices = selection.getSelectedIndices();
Expand Down Expand Up @@ -323,7 +329,13 @@ export const ObiEditor: FC<ObiEditorProps> = ({
break;
case KeyboardPrimaryTypes.Cursor: {
const currentSelectedId = selectionContext.selectedIds[0] || focusedId || '';
const { selected, focused, tab } = moveCursor(selectableElements, currentSelectedId, command);
const { selected, focused, tab } = currentSelectedId
? moveCursor(selectableElements, currentSelectedId, command)
: {
selected: `${focusedEvent}.actions[0]${MenuTypes.EdgeMenu}`,
focused: undefined,
tab: '',
};
setSelectionContext({
getNodeIndex: selectionContext.getNodeIndex,
selectedIds: [selected as string],
Expand Down

0 comments on commit 44ae7a1

Please sign in to comment.