!1156 优化:未保存图纸提示框位置

pull/1156/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent f5cec84f9d
commit 637b6a7dda

@ -3,6 +3,7 @@ import * as ReactDOM from 'react-dom';
import { Alert, Intent, Overlay, Button, Classes, Card } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import { KeyBoard } from '../../../Common/KeyEnum';
class Confirm
{
@ -56,6 +57,14 @@ export class CommonConfirm extends React.Component<ICommonConfirmProps>
return this.props.message.map(s => <p>{s}</p>);
}
};
componentDidMount()
{
document.addEventListener('keydown', this.handleKeydown);
}
componentWillUnmount()
{
document.removeEventListener('keydown', this.handleKeydown);
}
render()
{
return <Alert
@ -64,22 +73,35 @@ export class CommonConfirm extends React.Component<ICommonConfirmProps>
confirmButtonText="确认"
cancelButtonText="取消"
intent={Intent.SUCCESS}
onConfirm={() =>
{
this.props.res(true);
this.props.close();
}}
onCancel={() =>
{
this.props.res(false);
this.props.close();
}}
onConfirm={this.confirm}
onCancel={this.cancel}
>
{
this.renderMessage()
}
</Alert>;
}
private confirm = () =>
{
this.props.res(true);
this.props.close();
};
private cancel = () =>
{
this.props.res(false);
this.props.close();
};
private handleKeydown = (e: KeyboardEvent) =>
{
if (e.keyCode === KeyBoard.Escape)
{
this.cancel();
}
else if (e.keyCode === KeyBoard.Enter)
{
this.confirm();
}
};
}
@ -106,7 +128,6 @@ class CommonOverLay extends React.Component<ICommonOverLayProps>
{
return <Overlay
isOpen={true}
hasBackdrop={false}
canEscapeKeyClose
canOutsideClickClose
className={Classes.OVERLAY_SCROLL_CONTAINER}
@ -116,6 +137,7 @@ class CommonOverLay extends React.Component<ICommonOverLayProps>
left: 0,
right: 0,
top: 0,
bottom: 0,
width: " max-content",
height: "max-content",
margin: "auto",

Loading…
Cancel
Save