From 187bbd53bdfa240c02ac1863aeed9ea6865655b5 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 26 Feb 2017 15:47:45 -0800 Subject: [PATCH] Wrap lines in all editors (#89) --- app/ui/components/Wrapper.js | 2 ++ .../dropdowns/RequestActionsDropdown.js | 16 ---------------- app/ui/components/editors/EnvironmentEditor.js | 10 +++++++++- app/ui/components/modals/EnvironmentEditModal.js | 15 +++++++++++++-- app/ui/components/modals/RequestSwitcherModal.js | 12 ++++++++++-- .../modals/WorkspaceEnvironmentsEditModal.js | 4 +++- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/app/ui/components/Wrapper.js b/app/ui/components/Wrapper.js index d1a833e98..d4f13ddea 100644 --- a/app/ui/components/Wrapper.js +++ b/app/ui/components/Wrapper.js @@ -322,11 +322,13 @@ class Wrapper extends Component { ref={registerModal} editorFontSize={settings.editorFontSize} editorKeyMap={settings.editorKeyMap} + lineWrapping={settings.editorLineWrapping} onChange={models.requestGroup.update} /> diff --git a/app/ui/components/dropdowns/RequestActionsDropdown.js b/app/ui/components/dropdowns/RequestActionsDropdown.js index d8a0d0f0b..44c6e55ff 100644 --- a/app/ui/components/dropdowns/RequestActionsDropdown.js +++ b/app/ui/components/dropdowns/RequestActionsDropdown.js @@ -23,19 +23,6 @@ class RequestActionsDropdown extends Component { trackEvent('Request', 'Generate Code', 'Request Action'); }; - _handleAdvancedSend = () => { - trackEvent('Request', 'Advanced Send Hint', 'Request Action'); - showModal(AlertModal, { - title: 'Advanced Sending', - message: ( -
- For advanced sending options, hold {MOD_SYM.replace('+', '')} while - clicking the send button next to the Url. -
- ) - }); - }; - _handlePromptUpdateName = async () => { const {request} = this.props; @@ -78,9 +65,6 @@ class RequestActionsDropdown extends Component { Generate Code - - Advanced Sending - Delete diff --git a/app/ui/components/editors/EnvironmentEditor.js b/app/ui/components/editors/EnvironmentEditor.js index db5693a2f..ad30be472 100644 --- a/app/ui/components/editors/EnvironmentEditor.js +++ b/app/ui/components/editors/EnvironmentEditor.js @@ -22,12 +22,19 @@ class EnvironmentEditor extends Component { } render () { - const {environment, editorFontSize, editorKeyMap, ...props} = this.props; + const { + environment, + editorFontSize, + editorKeyMap, + lineWrapping, + ...props + } = this.props; return ( this.modal = m} tall={true} top={true} {...extraProps}> @@ -57,6 +66,7 @@ class EnvironmentEditModal extends Component { editorKeyMap={editorKeyMap} ref={node => this._envEditor = node} key={requestGroup ? requestGroup._id : 'n/a'} + lineWrapping={lineWrapping} environment={requestGroup ? requestGroup.environment : {}} didChange={this._didChange.bind(this)} lightTheme={true} @@ -79,6 +89,7 @@ EnvironmentEditModal.propTypes = { onChange: PropTypes.func.isRequired, editorFontSize: PropTypes.number.isRequired, editorKeyMap: PropTypes.string.isRequired, + lineWrapping: PropTypes.bool.isRequired, }; export default EnvironmentEditModal; diff --git a/app/ui/components/modals/RequestSwitcherModal.js b/app/ui/components/modals/RequestSwitcherModal.js index 3631bb5d1..e71d8949b 100644 --- a/app/ui/components/modals/RequestSwitcherModal.js +++ b/app/ui/components/modals/RequestSwitcherModal.js @@ -93,8 +93,16 @@ class RequestSwitcherModal extends Component { if (searchString) { matchedRequests = matchedRequests.filter(r => { const name = r.name.toLowerCase(); + const id = r._id.toLowerCase(); const toMatch = searchString.toLowerCase(); - return name.indexOf(toMatch) !== -1 + + // Match substring of name + const matchesName = name.indexOf(toMatch) >= 0; + + // Match exact Id + const matchesId = id === toMatch; + + return matchesName || matchesId; }); } @@ -120,7 +128,7 @@ class RequestSwitcherModal extends Component { .filter(w => { const name = w.name.toLowerCase(); const toMatch = searchString.toLowerCase(); - return name.indexOf(toMatch) !== -1 + return name.indexOf(toMatch) !== -1; }); const activeIndex = searchString ? 0 : -1; diff --git a/app/ui/components/modals/WorkspaceEnvironmentsEditModal.js b/app/ui/components/modals/WorkspaceEnvironmentsEditModal.js index 33c1b28c2..81b165cfb 100644 --- a/app/ui/components/modals/WorkspaceEnvironmentsEditModal.js +++ b/app/ui/components/modals/WorkspaceEnvironmentsEditModal.js @@ -142,7 +142,7 @@ class WorkspaceEnvironmentsEditModal extends Component { } render () { - const {editorFontSize, editorKeyMap} = this.props; + const {editorFontSize, editorKeyMap, lineWrapping} = this.props; const {subEnvironments, rootEnvironment, isValid, forceRefreshKey} = this.state; const activeEnvironment = this._getActiveEnvironment(); @@ -224,6 +224,7 @@ class WorkspaceEnvironmentsEditModal extends Component { this._envEditor = n} key={`${forceRefreshKey}::${(activeEnvironment ? activeEnvironment._id : 'n/a')}`} environment={activeEnvironment ? activeEnvironment.data : {}} @@ -254,6 +255,7 @@ WorkspaceEnvironmentsEditModal.propTypes = { onChange: PropTypes.func.isRequired, editorFontSize: PropTypes.number.isRequired, editorKeyMap: PropTypes.string.isRequired, + lineWrapping: PropTypes.bool.isRequired, }; export default WorkspaceEnvironmentsEditModal;