Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. diff --git a/public/js/components/EditorSearchBar.js b/public/js/components/EditorSearchBar.js
  2. index 1b3a1ce..1444851 100644
  3. --- a/public/js/components/EditorSearchBar.js
  4. +++ b/public/js/components/EditorSearchBar.js
  5. @@ -47,6 +47,8 @@ const EditorSearchBar = React.createClass({
  6. componentDidMount() {
  7. const shortcuts = this.context.shortcuts;
  8. if (isEnabled("search")) {
  9. + shortcuts.on("CmdOrCtrl+g", this.searchNext);
  10. + shortcuts.on("CmdOrCtrl+shift+g", this.searchPrev); // i don't think this is right, but shortcuts is a library in devtools-modules that's easy to use
  11. shortcuts.on("CmdOrCtrl+F", this.toggleSearch);
  12. shortcuts.on("Escape", this.onEscape);
  13. }
  14. @@ -101,16 +103,24 @@ const EditorSearchBar = React.createClass({
  15. }
  16.  
  17. if (e.shiftKey) {
  18. - findPrev(ctx, query);
  19. - const nextIndex = index == 0 ? count - 1 : index - 1;
  20. - this.setState({ index: nextIndex });
  21. + this.searchPrev();
  22. } else {
  23. - findNext(ctx, query);
  24. - const nextIndex = index == count - 1 ? 0 : index + 1;
  25. - this.setState({ index: nextIndex });
  26. + this.searchNext();
  27. }
  28. },
  29.  
  30. + searchNext() {
  31. + findPrev(ctx, query);
  32. + const nextIndex = index == 0 ? count - 1 : index - 1;
  33. + this.setState({ index: nextIndex });
  34. + },
  35. +
  36. + searchPrev() {
  37. + findNext(ctx, query);
  38. + const nextIndex = index == count - 1 ? 0 : index + 1;
  39. + this.setState({ index: nextIndex });
  40. + },
  41. +
  42. renderSummary() {
  43. const { count, index, query } = this.state;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement