From 01e225bd0ae266261a582a8807638ac201aec2c1 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 7 Jan 2020 11:35:21 -0500 Subject: [PATCH] Clean up new setting to disable links --- packages/insomnia-app/app/models/settings.js | 2 + .../app/ui/components/response-pane.js | 24 ++++++------ .../app/ui/components/settings/general.js | 10 ++--- .../components/viewers/response-multipart.js | 7 +++- .../ui/components/viewers/response-viewer.js | 37 ++++++++++--------- .../insomnia-app/app/ui/components/wrapper.js | 1 + 6 files changed, 45 insertions(+), 36 deletions(-) diff --git a/packages/insomnia-app/app/models/settings.js b/packages/insomnia-app/app/models/settings.js index 4af229b2c..a3e62e48e 100644 --- a/packages/insomnia-app/app/models/settings.js +++ b/packages/insomnia-app/app/models/settings.js @@ -11,6 +11,7 @@ type BaseSettings = { deviceId: string | null, disableHtmlPreviewJs: boolean, disableUpdateNotification: boolean, + disableResponsePreviewLinks: boolean, editorFontSize: number, editorIndentSize: number, editorIndentWithTabs: boolean, @@ -60,6 +61,7 @@ export function init(): BaseSettings { autocompleteDelay: 1200, deviceId: null, disableHtmlPreviewJs: false, + disableResponsePreviewLinks: false, disableUpdateNotification: false, editorFontSize: 11, editorIndentSize: 2, diff --git a/packages/insomnia-app/app/ui/components/response-pane.js b/packages/insomnia-app/app/ui/components/response-pane.js index 0b440cbb1..f2a3be05b 100644 --- a/packages/insomnia-app/app/ui/components/response-pane.js +++ b/packages/insomnia-app/app/ui/components/response-pane.js @@ -53,6 +53,7 @@ type Props = { loadStartTime: number, responses: Array, hotKeyRegistry: HotKeyRegistry, + disableResponsePreviewLinks: boolean, // Other requestVersions: Array, @@ -61,7 +62,7 @@ type Props = { }; @autobind -class ResponsePane extends React.PureComponent { +class ResponsePane extends React.PureComponent { _responseViewer: any; _setResponseViewerRef(n: any) { @@ -336,23 +337,22 @@ class ResponsePane extends React.PureComponent { diff --git a/packages/insomnia-app/app/ui/components/settings/general.js b/packages/insomnia-app/app/ui/components/settings/general.js index f7fdb3750..1babb8c6d 100644 --- a/packages/insomnia-app/app/ui/components/settings/general.js +++ b/packages/insomnia-app/app/ui/components/settings/general.js @@ -171,11 +171,6 @@ class General extends React.PureComponent { 'forceVerticalLayout', '', )} - {this.renderBooleanSetting( - 'Disable Response Preview Links', - 'disableResponsePreviewLinks', - '', - )}
{this.renderBooleanSetting('Reveal passwords', 'showPasswords', '')} @@ -315,6 +310,11 @@ class General extends React.PureComponent {
{this.renderBooleanSetting('Disable JS in HTML preview', 'disableHtmlPreviewJs', '')} + {this.renderBooleanSetting( + 'Disable Links in response viewer', + 'disableResponsePreviewLinks', + '', + )}
diff --git a/packages/insomnia-app/app/ui/components/viewers/response-multipart.js b/packages/insomnia-app/app/ui/components/viewers/response-multipart.js index f08fe62b7..321de84b9 100644 --- a/packages/insomnia-app/app/ui/components/viewers/response-multipart.js +++ b/packages/insomnia-app/app/ui/components/viewers/response-multipart.js @@ -30,6 +30,7 @@ type Props = { bodyBuffer: Buffer | null, contentType: string, disableHtmlPreviewJs: boolean, + disablePreviewLinks: boolean, filter: string, filterHistory: Array, editorFontSize: number, @@ -217,6 +218,7 @@ class ResponseMultipart extends React.PureComponent { const { download, disableHtmlPreviewJs, + disablePreviewLinks, editorFontSize, editorIndentSize, editorKeyMap, @@ -280,11 +282,11 @@ class ResponseMultipart extends React.PureComponent { {selectedPart ? (
{ filter={filter} filterHistory={filterHistory} getBody={this._getBody} + key={`${responseId}::${activePart}`} previewMode={PREVIEW_MODE_FRIENDLY} responseId={`${responseId}[${activePart}]`} updateFilter={null} diff --git a/packages/insomnia-app/app/ui/components/viewers/response-viewer.js b/packages/insomnia-app/app/ui/components/viewers/response-viewer.js index adb25e252..7b9e711ef 100644 --- a/packages/insomnia-app/app/ui/components/viewers/response-viewer.js +++ b/packages/insomnia-app/app/ui/components/viewers/response-viewer.js @@ -23,20 +23,21 @@ import { hotKeyRefs } from '../../../common/hotkeys'; let alwaysShowLargeResponses = false; type Props = { - getBody: Function, + bytes: number, + contentType: string, + disableHtmlPreviewJs: boolean, + disablePreviewLinks: boolean, download: Function, - responseId: string, - previewMode: string, - filter: string, - filterHistory: Array, editorFontSize: number, editorIndentSize: number, editorKeyMap: string, editorLineWrapping: boolean, + filter: string, + filterHistory: Array, + getBody: Function, + previewMode: string, + responseId: string, url: string, - bytes: number, - contentType: string, - disableHtmlPreviewJs: boolean, // Optional updateFilter: Function | null, @@ -197,6 +198,7 @@ class ResponseViewer extends React.Component { const { bytes, disableHtmlPreviewJs, + disablePreviewLinks, download, editorFontSize, editorIndentSize, @@ -208,7 +210,6 @@ class ResponseViewer extends React.Component { previewMode, responseId, updateFilter, - disableResponsePreviewLinks, url, } = this.props; let contentType = this.props.contentType; @@ -344,6 +345,7 @@ class ResponseViewer extends React.Component { bodyBuffer={bodyBuffer} contentType={contentType} disableHtmlPreviewJs={disableHtmlPreviewJs} + disablePreviewLinks={disablePreviewLinks} download={download} editorFontSize={editorFontSize} editorIndentSize={editorIndentSize} @@ -395,22 +397,23 @@ class ResponseViewer extends React.Component { return ( ); } diff --git a/packages/insomnia-app/app/ui/components/wrapper.js b/packages/insomnia-app/app/ui/components/wrapper.js index 4f84642d7..db3bfb693 100644 --- a/packages/insomnia-app/app/ui/components/wrapper.js +++ b/packages/insomnia-app/app/ui/components/wrapper.js @@ -848,6 +848,7 @@ class Wrapper extends React.PureComponent {