diff --git a/packages/insomnia-app/app/ui/components/modals/prompt-modal.js b/packages/insomnia-app/app/ui/components/modals/prompt-modal.js index e13545875..c806daa54 100644 --- a/packages/insomnia-app/app/ui/components/modals/prompt-modal.js +++ b/packages/insomnia-app/app/ui/components/modals/prompt-modal.js @@ -87,7 +87,9 @@ class PromptModal extends React.PureComponent { e.preventDefault(); if (this._input) { - this._done(this._input.value); + const result = + this._input.type === 'checkbox' ? this._input.checked.toString() : this._input.value; + this._done(result); } } @@ -165,7 +167,11 @@ class PromptModal extends React.PureComponent { if (!this._input) { return; } - this._input.value = defaultValue || ''; + if (inputType === 'checkbox') { + this._input.checked = !!defaultValue; + } else { + this._input.value = defaultValue || ''; + } this._input.focus(); selectText && this._input && this._input.select(); }, 100); @@ -226,21 +232,27 @@ class PromptModal extends React.PureComponent { sanitizedHints = hints.slice(0, 15).map(this._renderHintButton); } + let field = input; + if (label) { + const labelClasses = classnames({ + 'inline-block': inputType === 'checkbox', + }); + field = ( + + ); + } + + const divClassnames = classnames('form-control form-control--wide', { + 'form-control--outlined': inputType !== 'checkbox', + }); return ( {title}
-
- {label ? ( - - ) : ( - input - )} -
+
{field}
{sanitizedHints}