Skip to content

Commit

Permalink
Ctrl-s to focus search field, refs #57
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Oct 2, 2013
1 parent 2a28c5f commit 8ef3029
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
12 changes: 10 additions & 2 deletions build/dataflow.build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dataflow.js - v0.0.7 - 2013-10-02 (7:09:36 PM GMT+0200)
/*! dataflow.js - v0.0.7 - 2013-10-02 (7:36:38 PM GMT+0200)
* Copyright (c) 2013 Forrest Oliphant; Licensed MIT, GPL */
// Thanks bobnice http://stackoverflow.com/a/1583281/592125

Expand Down Expand Up @@ -3638,9 +3638,9 @@ CircularBuffer.IndexError= {};

var KeyBinding = Dataflow.prototype.plugin("keybinding");
var Edit = Dataflow.prototype.plugin("edit");
var Search = Dataflow.prototype.plugin("search");

KeyBinding.initialize = function(dataflow){

function zoomIn() {
if (dataflow && dataflow.currentGraph && dataflow.currentGraph.view) {
dataflow.currentGraph.view.zoomIn();
Expand Down Expand Up @@ -3694,6 +3694,10 @@ CircularBuffer.IndexError= {};
break;
case 90: // z
break;
case 83: // s
event.preventDefault();
Search.focus();
break;
default:
break;
}
Expand Down Expand Up @@ -3829,6 +3833,10 @@ CircularBuffer.IndexError= {};
$button.on('click', function () {
dataflow.showPlugin('menu');
});

Search.focus = function () {
$input.focus();
};
};

Search.search = function (text, dataflow) {
Expand Down
6 changes: 3 additions & 3 deletions build/dataflow.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/dataflow.min.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/plugins/keybinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

var KeyBinding = Dataflow.prototype.plugin("keybinding");
var Edit = Dataflow.prototype.plugin("edit");
var Search = Dataflow.prototype.plugin("search");

KeyBinding.initialize = function(dataflow){

function zoomIn() {
if (dataflow && dataflow.currentGraph && dataflow.currentGraph.view) {
dataflow.currentGraph.view.zoomIn();
Expand Down Expand Up @@ -61,6 +61,10 @@
break;
case 90: // z
break;
case 83: // s
event.preventDefault();
Search.focus();
break;
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
$button.on('click', function () {
dataflow.showPlugin('menu');
});

Search.focus = function () {
$input.focus();
};
};

Search.search = function (text, dataflow) {
Expand Down

0 comments on commit 8ef3029

Please sign in to comment.