- 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 selectorsmaster
parent
2a943cd1fa
commit
3909d2fd97
|
@ -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
|
@ -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
|
@ -15,7 +15,7 @@
|
|||
|
||||
// We *do* want to allow the escape key within textareas (and possibly tab too), so add the condition `n.which !== 27`
|
||||
|
||||
export default function(b){b.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};function a(d){if(typeof d.data!=="string"){return}var c=d.handler,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")){return}var h=n.type!=="keypress"&&b.hotkeys.specialKeys[n.which],o=String.fromCharCode(n.which).toLowerCase(),k,m="",g={};if(n.altKey&&h!=="alt"){m+="alt+"}if(n.ctrlKey&&h!=="ctrl"){m+="ctrl+"}if(n.metaKey&&!n.ctrlKey&&h!=="meta"){m+="meta+"}if(n.shiftKey&&h!=="shift"){m+="shift+"}if(h){g[m+h]=true}else{g[m+o]=true;g[m+b.hotkeys.shiftNums[o]]=true;if(m==="shift+"){g[b.hotkeys.shiftNums[o]]=true}}for(var j=0,f=e.length;j<f;j++){if(g[e[j]]){return c.apply(this,arguments)}}}}b.each(["keydown","keyup","keypress"],function(){b.event.special[this]={add:a}})
|
||||
export default function(b){b.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};function a(d){if(typeof d.data!=="string"){return}var c=d.handler,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"))){return}var h=n.type!=="keypress"&&b.hotkeys.specialKeys[n.which],o=String.fromCharCode(n.which).toLowerCase(),k,m="",g={};if(n.altKey&&h!=="alt"){m+="alt+"}if(n.ctrlKey&&h!=="ctrl"){m+="ctrl+"}if(n.metaKey&&!n.ctrlKey&&h!=="meta"){m+="meta+"}if(n.shiftKey&&h!=="shift"){m+="shift+"}if(h){g[m+h]=true}else{g[m+o]=true;g[m+b.hotkeys.shiftNums[o]]=true;if(m==="shift+"){g[b.hotkeys.shiftNums[o]]=true}}for(var j=0,f=e.length;j<f;j++){if(g[e[j]]){return c.apply(this,arguments)}}}}b.each(["keydown","keyup","keypress"],function(){b.event.special[this]={add:a}})
|
||||
|
||||
return b;
|
||||
}
|
||||
|
|
|
@ -5087,6 +5087,7 @@ editor.init = function () {
|
|||
// Prevent browser from erroneously repopulating fields
|
||||
$('input,select').attr('autocomplete', 'off');
|
||||
|
||||
const 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
|
||||
|
@ -5141,8 +5142,19 @@ editor.init = function () {
|
|||
{sel: '#tool_import', fn: clickImport, evt: 'mouseup'},
|
||||
{sel: '#tool_source', fn: showSourceEditor, evt: 'click', key: ['U', true]},
|
||||
{sel: '#tool_wireframe', fn: clickWireframe, evt: 'click', key: ['F', true]},
|
||||
{sel: '#tool_source_cancel,.overlay,#tool_docprops_cancel,#tool_prefs_cancel',
|
||||
fn: cancelOverlays, evt: 'click', key: ['esc', false, false], hidekey: true},
|
||||
{
|
||||
key: ['esc', false, false],
|
||||
fn () {
|
||||
if (dialogSelectors.every((sel) => {
|
||||
return $(sel + ':hidden').length;
|
||||
})) {
|
||||
svgCanvas.clearSelection();
|
||||
}
|
||||
},
|
||||
hidekey: true
|
||||
},
|
||||
{sel: dialogSelectors.join(','), fn: cancelOverlays, evt: 'click',
|
||||
key: ['esc', false, false], hidekey: true},
|
||||
{sel: '#tool_source_save', fn: saveSourceEditor, evt: 'click'},
|
||||
{sel: '#tool_docprops_save', fn: saveDocProperties, evt: 'click'},
|
||||
{sel: '#tool_docprops', fn: showDocProperties, evt: 'mouseup'},
|
||||
|
@ -5205,7 +5217,6 @@ editor.init = function () {
|
|||
{key: ['alt+shift+right', true], fn () { svgCanvas.cloneSelectedElements(10, 0); }},
|
||||
{key: 'a', fn () { svgCanvas.selectAllInCurrentLayer(); }},
|
||||
{key: modKey + 'a', fn () { svgCanvas.selectAllInCurrentLayer(); }},
|
||||
{key: ['esc', false, false], fn () { svgCanvas.clearSelection(); }},
|
||||
|
||||
// Standard shortcuts
|
||||
{key: modKey + 'z', fn: clickUndo},
|
||||
|
|
|
@ -21287,7 +21287,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;
|
||||
}
|
||||
|
||||
|
@ -33018,6 +33018,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
|
||||
|
@ -33155,7 +33156,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],
|
||||
|
@ -33416,11 +33427,6 @@
|
|||
fn: function fn() {
|
||||
svgCanvas.selectAllInCurrentLayer();
|
||||
}
|
||||
}, {
|
||||
key: ['esc', false, false],
|
||||
fn: function fn() {
|
||||
svgCanvas.clearSelection();
|
||||
}
|
||||
}, // Standard shortcuts
|
||||
{
|
||||
key: modKey + 'z',
|
||||
|
|
|
@ -21287,7 +21287,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;
|
||||
}
|
||||
|
||||
|
@ -33018,6 +33018,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
|
||||
|
@ -33155,7 +33156,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],
|
||||
|
@ -33416,11 +33427,6 @@
|
|||
fn: function fn() {
|
||||
svgCanvas.selectAllInCurrentLayer();
|
||||
}
|
||||
}, {
|
||||
key: ['esc', false, false],
|
||||
fn: function fn() {
|
||||
svgCanvas.clearSelection();
|
||||
}
|
||||
}, // Standard shortcuts
|
||||
{
|
||||
key: modKey + 'z',
|
||||
|
|
Loading…
Reference in New Issue