mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Extra dialog parameters for plugins
This commit is contained in:
parent
3b9031ecc0
commit
a893ba8c88
@ -30,6 +30,8 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a
|
||||
options?: {
|
||||
onHide?: () => void,
|
||||
tall?: boolean,
|
||||
skinny?: boolean,
|
||||
wide?: boolean,
|
||||
} = {},
|
||||
): void {
|
||||
if (renderPurpose !== RENDER_PURPOSE_SEND && renderPurpose !== RENDER_PURPOSE_NO_RENDER) {
|
||||
@ -40,6 +42,8 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a
|
||||
title,
|
||||
body: <HtmlElementWrapper el={body} onUnmount={options.onHide} />,
|
||||
tall: options.tall,
|
||||
skinny: options.skinny,
|
||||
wide: options.wide,
|
||||
});
|
||||
},
|
||||
prompt(
|
||||
|
@ -10,7 +10,9 @@ type State = {
|
||||
title: string,
|
||||
body: React.Node,
|
||||
bodyHTML: ?string,
|
||||
tall: boolean,
|
||||
tall: ?boolean,
|
||||
skinny: ?boolean,
|
||||
wide: ?boolean,
|
||||
};
|
||||
|
||||
@autobind
|
||||
@ -25,6 +27,8 @@ class WrapperModal extends React.PureComponent<Props, State> {
|
||||
body: null,
|
||||
bodyHTML: null,
|
||||
tall: false,
|
||||
skinny: false,
|
||||
wide: false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -33,19 +37,21 @@ class WrapperModal extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
show(options: Object = {}) {
|
||||
const { title, body, bodyHTML, tall } = options;
|
||||
const { title, body, bodyHTML, tall, skinny, wide } = options;
|
||||
this.setState({
|
||||
title,
|
||||
body,
|
||||
bodyHTML,
|
||||
tall: !!tall,
|
||||
skinny: !!skinny,
|
||||
wide: !!wide,
|
||||
});
|
||||
|
||||
this.modal && this.modal.show();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { title, body, bodyHTML, tall } = this.state;
|
||||
const { title, body, bodyHTML, tall, skinny, wide } = this.state;
|
||||
|
||||
let finalBody = body;
|
||||
if (bodyHTML) {
|
||||
@ -53,7 +59,7 @@ class WrapperModal extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal ref={this._setModalRef} tall={tall}>
|
||||
<Modal ref={this._setModalRef} tall={tall} skinny={skinny} wide={wide}>
|
||||
<ModalHeader>{title || 'Uh Oh!'}</ModalHeader>
|
||||
<ModalBody>{finalBody}</ModalBody>
|
||||
</Modal>
|
||||
|
Loading…
Reference in New Issue
Block a user