cancel synapse creation with esc, backspace, or delete
This commit is contained in:
parent
056ef2b5b6
commit
9469b08ffa
1 changed files with 10 additions and 4 deletions
|
@ -791,16 +791,22 @@ Metamaps.Create = {
|
|||
}]
|
||||
);
|
||||
|
||||
$('#synapse_desc').keyup(function () {
|
||||
$('#synapse_desc').keyup(function (e) {
|
||||
var ESC = 27, BACKSPACE = 8, DELETE = 46;
|
||||
if (e.keyCode === BACKSPACE && $(this).val() === "" ||
|
||||
e.keyCode === DELETE && $(this).val() === "" ||
|
||||
e.keyCode === ESC) {
|
||||
Metamaps.Create.newSynapse.hide();
|
||||
}//if
|
||||
Metamaps.Create.newSynapse.description = $(this).val();
|
||||
});
|
||||
|
||||
$('#synapse_desc').focusout(function() {
|
||||
// Metamaps.Create.newSynapse.description = $(this).val();
|
||||
Metamaps.Synapse.createSynapseLocally();
|
||||
if (Metamaps.Create.newSynapse.beingCreated) {
|
||||
Metamaps.Synapse.createSynapseLocally();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#synapse_desc').bind('typeahead:select', function (event, datum, dataset) {
|
||||
if (datum.id) { // if they clicked on an existing synapse get it
|
||||
Metamaps.Synapse.getSynapseFromAutocomplete(datum.id);
|
||||
|
|
Loading…
Reference in a new issue