mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
Only do the delete hack if it's the first key press
This avoids unexpectedly deleting when you spam backspace to clear a failed search query.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
<script src='js/lib/d3.trigger.js'></script>
|
||||
<script src='js/lib/d3.keybinding.js'></script>
|
||||
<script src='js/lib/d3.clip.js'></script>
|
||||
<script src='js/lib/d3.one.js'></script>
|
||||
<script src='js/lib/d3-compat.js'></script>
|
||||
<script src='js/lib/bootstrap-tooltip.js'></script>
|
||||
<script src='js/lib/rtree.js'></script>
|
||||
|
||||
@@ -26,7 +26,7 @@ iD.ui.PresetGrid = function(context) {
|
||||
var search = searchwrap.append('input')
|
||||
.attr('class', 'preset-grid-search')
|
||||
.attr('type', 'search')
|
||||
.on('keydown', function() {
|
||||
.one('keydown', function() {
|
||||
// hack to let delete shortcut work when search is autofocused
|
||||
if (search.property('value').length === 0 &&
|
||||
(d3.event.keyCode === d3.keybinding.keyCodes['⌫'] ||
|
||||
|
||||
@@ -5,4 +5,5 @@ d3.selection.prototype.one = function (type, listener, capture) {
|
||||
listener.apply(this, arguments);
|
||||
}
|
||||
target.on(typeOnce, one, capture);
|
||||
return this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user