From 34cf86326bc336f038db16df627dbcb3b126b099 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Thu, 14 Sep 2017 16:58:59 -0400 Subject: [PATCH] add find next and find previous commands to nav --- client/components/Nav.jsx | 30 ++++++++++++++++++++---- client/modules/IDE/components/Editor.jsx | 18 ++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index ee0bd9ab..e2c192f7 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -131,7 +131,7 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} > Save - {metaKeyName} + s + {metaKeyName}+s } { this.props.project.id && this.props.user.authenticated && @@ -206,7 +206,7 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} > Tidy Code - {'\u21E7'} + Tab + {'\u21E7'}+Tab
  • @@ -216,7 +216,27 @@ class Nav extends React.PureComponent { onBlur={this.handleBlur} > Find - {metaKeyName} + F + {metaKeyName}+F + +
  • +
  • + +
  • +
  • +
  • @@ -395,7 +415,9 @@ Nav.propTypes = { showKeyboardShortcutModal: PropTypes.func.isRequired, cmController: PropTypes.shape({ tidyCode: PropTypes.func, - showFind: PropTypes.func + showFind: PropTypes.func, + findNext: PropTypes.func, + findPrev: PropTypes.func }) }; diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index 2b4da818..2bef97c7 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -49,6 +49,8 @@ class Editor extends React.Component { super(props); this.tidyCode = this.tidyCode.bind(this); this.showFind = this.showFind.bind(this); + this.findNext = this.findNext.bind(this); + this.findPrev = this.findPrev.bind(this); } componentDidMount() { this.beep = new Audio(beepUrl); @@ -122,7 +124,9 @@ class Editor extends React.Component { this.props.provideController({ tidyCode: this.tidyCode, - showFind: this.showFind + showFind: this.showFind, + findNext: this.findNext, + findPrev: this.findPrev }); } @@ -208,7 +212,17 @@ class Editor extends React.Component { } showFind() { - this._cm.execCommand('find'); + this._cm.execCommand('findPersistent'); + } + + findNext() { + this._cm.focus(); + this._cm.execCommand('findNext'); + } + + findPrev() { + this._cm.focus(); + this._cm.execCommand('findPrev'); } toggleEditorOptions() {