Skip to content

Commit

Permalink
blur selected text field on esc
Browse files Browse the repository at this point in the history
  • Loading branch information
stewartoallen committed Mar 7, 2018
1 parent b5588ad commit 42eb82d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions js/kiri-work.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ if (self.window) {
},

cancel: function(data) {
// console.log({work_cancel: data});
if (data.id) {
var widget = cache[data.id];
if (widget) widget.cancel = true;
Expand Down
10 changes: 2 additions & 8 deletions js/kiri.js
Original file line number Diff line number Diff line change
Expand Up @@ -2538,17 +2538,12 @@ self.kiri.license = exports.LICENSE;
showSlices();
}

function clearSelectedText() {
var sel = WIN.getSelection();
if (sel && sel.rangeCount) sel.collapseToStart();
}

function keyUpHandler(evt) {
switch (evt.keyCode) {
// escape
case 27:
// clear text selection
clearSelectedText();
// blur text input focus
DOC.activeElement.blur();
// dismiss modals
hideModal();
// deselect widgets
Expand Down Expand Up @@ -2624,7 +2619,6 @@ self.kiri.license = exports.LICENSE;
evt.preventDefault();
widgetDeselect();
platformSelectAll();
clearSelectedText();
}
break;
case 83: // 's' for save workspace
Expand Down

0 comments on commit 42eb82d

Please sign in to comment.