Skip to content

Commit

Permalink
fix openedModals
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Mar 15, 2019
1 parent fb5206a commit cf7f4e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Signum.React/Scripts/Frames/FrameModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default class FrameModal extends React.Component<FrameModalProps, FrameMo
return (
<div className="modal-body">
{renderWidgets({ ctx: ctx, pack: pack })}
{this.entityComponent && <ButtonBar frame={frame} pack={pack} isOperationVisible={this.props.isOperationVisible} />}
{this.entityComponent && <ButtonBar ref={bb => this.buttonBar = bb} frame={frame} pack={pack} isOperationVisible={this.props.isOperationVisible} />}
<ValidationErrors entity={pack.entity} ref={ve => this.validationErrors = ve} prefix={this.prefix} />
{embeddedWidgets.top}
<div className="sf-main-control" data-test-ticks={new Date().valueOf()} data-main-entity={entityInfo(ctx.value)}>
Expand Down
4 changes: 2 additions & 2 deletions Signum.React/Scripts/Frames/FramePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default class FramePage extends React.Component<FramePageProps, FramePage
}

hanldleKeyDown = (e: KeyboardEvent) => {
if (!e.defaultPrevented)
this.buttonBar && this.buttonBar.hanldleKeyDown(e);
if (!e.openedModals && this.buttonBar)
this.buttonBar.hanldleKeyDown(e);
}

load(props: FramePageProps) {
Expand Down
8 changes: 7 additions & 1 deletion Signum.React/Scripts/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import * as React from 'react'
import { FunctionalAdapter } from './Frames/FrameModal';
import { Modal } from 'react-overlays';

declare global {
interface KeyboardEvent {
openedModals?: boolean;
}
}

export interface IModalProps {
onExited?: (val: any) => void;
}
Expand Down Expand Up @@ -39,7 +45,7 @@ export class GlobalModalContainer extends React.Component<{}, GlobalModalContain

hanldleKeyDown = (e: KeyboardEvent) => {
if (modalInstances.length) {
e.preventDefault();
e.openedModals = true;
var topMost = modalInstances[modalInstances.length - 1];

if (topMost.handleKeyDown) {
Expand Down

0 comments on commit cf7f4e6

Please sign in to comment.