diff --git a/app/ui/components/RequestPane.js b/app/ui/components/RequestPane.js
index 274f5e902c..103baa848e 100644
--- a/app/ui/components/RequestPane.js
+++ b/app/ui/components/RequestPane.js
@@ -74,6 +74,7 @@ class RequestPane extends PureComponent {
forceRefreshCounter,
useBulkHeaderEditor,
handleGenerateCode,
+ importRequest,
updateRequestUrl,
updateRequestMethod,
updateRequestBody,
@@ -148,6 +149,7 @@ class RequestPane extends PureComponent {
method={request.method}
onMethodChange={updateRequestMethod}
onUrlChange={debounce(updateRequestUrl)}
+ onUrlPaste={importRequest}
handleGenerateCode={handleGenerateCode}
handleSend={handleSend}
url={request.url}
@@ -205,14 +207,14 @@ class RequestPane extends PureComponent {
/>
{showPasswords ? (
-
- ) : (
-
- )}
+
+ ) : (
+
+ )}
@@ -289,6 +291,7 @@ RequestPane.propTypes = {
updateRequestMimeType: PropTypes.func.isRequired,
updateSettingsShowPasswords: PropTypes.func.isRequired,
updateSettingsUseBulkHeaderEditor: PropTypes.func.isRequired,
+ importRequest: PropTypes.func.isRequired,
handleImportFile: PropTypes.func.isRequired,
// Other
diff --git a/app/ui/components/RequestUrlBar.js b/app/ui/components/RequestUrlBar.js
index 55cb7d822a..f2564c4e20 100644
--- a/app/ui/components/RequestUrlBar.js
+++ b/app/ui/components/RequestUrlBar.js
@@ -10,7 +10,6 @@ import {showModal} from './modals/index';
class RequestUrlBar extends Component {
state = {
- showAdvanced: false,
currentInterval: null,
currentTimeout: null,
};
@@ -35,6 +34,15 @@ class RequestUrlBar extends Component {
}, DEBOUNCE_MILLIS);
};
+ _handleUrlPaste = e => {
+ e.preventDefault();
+ const text = e.clipboardData.getData('text/plain');
+ this.props.onUrlPaste(text);
+
+ // Set the input anyway in case nothing is able to import
+ e.target.value = text;
+ };
+
_handleGenerateCode = () => {
this.props.handleGenerateCode();
trackEvent('Request', 'Generate Code', 'Send Action');
@@ -52,31 +60,11 @@ class RequestUrlBar extends Component {
this._input.focus();
this._input.select();
}
-
- if (!this.state.showAdvanced && metaPressed) {
- clearTimeout(this._metaTimeout);
- this._metaTimeout = setTimeout(() => {
- this.setState({showAdvanced: true});
- }, 400);
- }
- };
-
- _handleKeyUp = e => {
- const metaPressed = isMac() ? e.metaKey : e.ctrlKey;
-
- // First, clear the meta timeout if it hasn't triggered yet
- if (!metaPressed) {
- clearTimeout(this._metaTimeout);
- }
-
- if (!metaPressed && this.state.showAdvanced) {
- this.setState({showAdvanced: false});
- }
};
_handleSend = () => {
// Don't stop interval because duh, it needs to keep going!
- // this._handleStopInterval();
+ // XXX this._handleStopInterval(); XXX
this._handleStopTimeout();
this.props.handleSend();
@@ -222,6 +210,7 @@ class RequestUrlBar extends Component {