- Fix: Only clear selection by escape key if not within a dialog (as the escape key should only close the dialog)

- Fix: Ensure escape key will work from within input text boxes (as was already added for textareas)
- Refactoring: Share code for dialog selectors
This commit is contained in:
Brett Zamir
2018-10-02 14:02:15 +08:00
parent 2a943cd1fa
commit 3909d2fd97
10 changed files with 71 additions and 36 deletions

20
dist/index-es.js vendored
View File

@@ -21284,7 +21284,7 @@ function jqPluginJSHotkeys (b) {
e = d.data.toLowerCase().split(" ");
d.handler = function (n) {
if (this !== n.target && (n.which !== 27 && /textarea|select/i.test(n.target.nodeName) || n.target.type === "text")) {
if (this !== n.target && n.which !== 27 && (/textarea|select/i.test(n.target.nodeName) || n.target.type === "text")) {
return;
}
@@ -33015,6 +33015,7 @@ editor.init = function () {
}); // Prevent browser from erroneously repopulating fields
$$b('input,select').attr('autocomplete', 'off');
var dialogSelectors = ['#tool_source_cancel', '#tool_docprops_cancel', '#tool_prefs_cancel', '.overlay'];
/**
* Associate all button actions as well as non-button keyboard shortcuts
* @namespace {PlainObject} module:SVGEditor~Actions
@@ -33152,7 +33153,17 @@ editor.init = function () {
evt: 'click',
key: ['F', true]
}, {
sel: '#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel',
key: ['esc', false, false],
fn: function fn() {
if (dialogSelectors.every(function (sel) {
return $$b(sel + ':hidden').length;
})) {
svgCanvas.clearSelection();
}
},
hidekey: true
}, {
sel: dialogSelectors.join(','),
fn: cancelOverlays,
evt: 'click',
key: ['esc', false, false],
@@ -33413,11 +33424,6 @@ editor.init = function () {
fn: function fn() {
svgCanvas.selectAllInCurrentLayer();
}
}, {
key: ['esc', false, false],
fn: function fn() {
svgCanvas.clearSelection();
}
}, // Standard shortcuts
{
key: modKey + 'z',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

20
dist/index-umd.js vendored
View File

@@ -21290,7 +21290,7 @@
e = d.data.toLowerCase().split(" ");
d.handler = function (n) {
if (this !== n.target && (n.which !== 27 && /textarea|select/i.test(n.target.nodeName) || n.target.type === "text")) {
if (this !== n.target && n.which !== 27 && (/textarea|select/i.test(n.target.nodeName) || n.target.type === "text")) {
return;
}
@@ -33021,6 +33021,7 @@
}); // Prevent browser from erroneously repopulating fields
$$b('input,select').attr('autocomplete', 'off');
var dialogSelectors = ['#tool_source_cancel', '#tool_docprops_cancel', '#tool_prefs_cancel', '.overlay'];
/**
* Associate all button actions as well as non-button keyboard shortcuts
* @namespace {PlainObject} module:SVGEditor~Actions
@@ -33158,7 +33159,17 @@
evt: 'click',
key: ['F', true]
}, {
sel: '#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel',
key: ['esc', false, false],
fn: function fn() {
if (dialogSelectors.every(function (sel) {
return $$b(sel + ':hidden').length;
})) {
svgCanvas.clearSelection();
}
},
hidekey: true
}, {
sel: dialogSelectors.join(','),
fn: cancelOverlays,
evt: 'click',
key: ['esc', false, false],
@@ -33419,11 +33430,6 @@
fn: function fn() {
svgCanvas.selectAllInCurrentLayer();
}
}, {
key: ['esc', false, false],
fn: function fn() {
svgCanvas.clearSelection();
}
}, // Standard shortcuts
{
key: modKey + 'z',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long