- Build: Update per latest (let `master` demo reflect current state)

master
Brett Zamir 2020-07-12 15:15:37 +08:00
parent 053ad67ad9
commit 7c3e18ef46
9 changed files with 141 additions and 112 deletions

View File

@ -496,6 +496,7 @@ var svgEditorExtension_imagelib = (function () {
closeBrowser = function _closeBrowser() {
$('#imgbrowse_holder').hide();
document.activeElement.blur(); // make sure focus is the body to correct issue #417
};
$ = _ref.$, decode64 = _ref.decode64, importLocale = _ref.importLocale, dropXMLInternalSubset = _ref.dropXMLInternalSubset;

61
dist/index-es.js vendored
View File

@ -35526,14 +35526,16 @@ editor.init = function () {
*/
setAll: function setAll() {
var flyouts = {};
$$b.each(toolButtons, function (i, opts) {
var keyHandler = {}; // will contain the action for each pressed key
toolButtons.forEach(function (opts) {
// Bind function to button
var btn;
if (opts.sel) {
btn = $$b(opts.sel);
btn = document.querySelector(opts.sel);
if (!btn.length) {
if (btn === null) {
return true;
} // Skip if markup does not exist
@ -35545,7 +35547,7 @@ editor.init = function () {
opts.evt = 'mousedown';
}
btn[opts.evt](opts.fn);
btn.addEventListener(opts.evt, opts.fn);
} // Add to parent flyout menu, if able to be displayed
@ -35557,7 +35559,7 @@ editor.init = function () {
}
if (opts.prepend) {
btn[0].style.margin = 'initial';
btn.style.margin = 'initial';
}
fH[opts.prepend ? 'prepend' : 'append'](btn);
@ -35573,47 +35575,52 @@ editor.init = function () {
if (opts.key) {
// Set shortcut based on options
var keyval,
// disInInp = true,
pd = false;
var keyval = opts.key;
var pd = false;
if (Array.isArray(opts.key)) {
keyval = opts.key[0];
if (opts.key.length > 1) {
pd = opts.key[1];
} // if (opts.key.length > 2) { disInInp = opts.key[2]; }
} else {
keyval = opts.key;
}
}
keyval = String(keyval);
var fn = opts.fn;
$$b.each(keyval.split('/'), function (j, key) {
$$b(document).bind('keydown', key, function (e) {
fn();
if (pd) {
e.preventDefault();
} // Prevent default on ALL keys?
return false;
});
keyval.split('/').forEach(function (key) {
keyHandler[key] = {
fn: fn,
pd: pd
};
}); // Put shortcut in title
if (opts.sel && !opts.hidekey && btn.attr('title')) {
var newTitle = btn.attr('title').split('[')[0] + ' (' + keyval + ')';
if (opts.sel && !opts.hidekey && btn.title) {
var newTitle = "".concat(btn.title.split('[')[0], " (").concat(keyval, ")");
keyAssocs[keyval] = opts.sel; // Disregard for menu items
if (!btn.parents('#main_menu').length) {
btn.attr('title', newTitle);
if (btn.closest('#main_menu') === null) {
btn.title = newTitle;
}
}
}
return true;
}); // register the keydown event
document.addEventListener('keydown', function (e) {
// only track keyboard shortcuts for the body containing the SVG-Editor
if (e.target.nodeName !== 'BODY') return; // normalize key
var key = "".concat(e.metaKey ? 'meta+' : '').concat(e.ctrlKey ? 'ctrl+' : '').concat(e.key.toLowerCase()); // return if no shortcut defined for this key
if (!keyHandler[key]) return; // launch associated handler and preventDefault if necessary
keyHandler[key].fn();
if (keyHandler[key].pd) {
e.preventDefault();
}
}); // Setup flyouts
setupFlyouts(flyouts); // Misc additional actions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

61
dist/index-umd.js vendored
View File

@ -35532,14 +35532,16 @@
*/
setAll: function setAll() {
var flyouts = {};
$$b.each(toolButtons, function (i, opts) {
var keyHandler = {}; // will contain the action for each pressed key
toolButtons.forEach(function (opts) {
// Bind function to button
var btn;
if (opts.sel) {
btn = $$b(opts.sel);
btn = document.querySelector(opts.sel);
if (!btn.length) {
if (btn === null) {
return true;
} // Skip if markup does not exist
@ -35551,7 +35553,7 @@
opts.evt = 'mousedown';
}
btn[opts.evt](opts.fn);
btn.addEventListener(opts.evt, opts.fn);
} // Add to parent flyout menu, if able to be displayed
@ -35563,7 +35565,7 @@
}
if (opts.prepend) {
btn[0].style.margin = 'initial';
btn.style.margin = 'initial';
}
fH[opts.prepend ? 'prepend' : 'append'](btn);
@ -35579,47 +35581,52 @@
if (opts.key) {
// Set shortcut based on options
var keyval,
// disInInp = true,
pd = false;
var keyval = opts.key;
var pd = false;
if (Array.isArray(opts.key)) {
keyval = opts.key[0];
if (opts.key.length > 1) {
pd = opts.key[1];
} // if (opts.key.length > 2) { disInInp = opts.key[2]; }
} else {
keyval = opts.key;
}
}
keyval = String(keyval);
var fn = opts.fn;
$$b.each(keyval.split('/'), function (j, key) {
$$b(document).bind('keydown', key, function (e) {
fn();
if (pd) {
e.preventDefault();
} // Prevent default on ALL keys?
return false;
});
keyval.split('/').forEach(function (key) {
keyHandler[key] = {
fn: fn,
pd: pd
};
}); // Put shortcut in title
if (opts.sel && !opts.hidekey && btn.attr('title')) {
var newTitle = btn.attr('title').split('[')[0] + ' (' + keyval + ')';
if (opts.sel && !opts.hidekey && btn.title) {
var newTitle = "".concat(btn.title.split('[')[0], " (").concat(keyval, ")");
keyAssocs[keyval] = opts.sel; // Disregard for menu items
if (!btn.parents('#main_menu').length) {
btn.attr('title', newTitle);
if (btn.closest('#main_menu') === null) {
btn.title = newTitle;
}
}
}
return true;
}); // register the keydown event
document.addEventListener('keydown', function (e) {
// only track keyboard shortcuts for the body containing the SVG-Editor
if (e.target.nodeName !== 'BODY') return; // normalize key
var key = "".concat(e.metaKey ? 'meta+' : '').concat(e.ctrlKey ? 'ctrl+' : '').concat(e.key.toLowerCase()); // return if no shortcut defined for this key
if (!keyHandler[key]) return; // launch associated handler and preventDefault if necessary
keyHandler[key].fn();
if (keyHandler[key].pd) {
e.preventDefault();
}
}); // Setup flyouts
setupFlyouts(flyouts); // Misc additional actions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35529,14 +35529,16 @@
*/
setAll: function setAll() {
var flyouts = {};
$$b.each(toolButtons, function (i, opts) {
var keyHandler = {}; // will contain the action for each pressed key
toolButtons.forEach(function (opts) {
// Bind function to button
var btn;
if (opts.sel) {
btn = $$b(opts.sel);
btn = document.querySelector(opts.sel);
if (!btn.length) {
if (btn === null) {
return true;
} // Skip if markup does not exist
@ -35548,7 +35550,7 @@
opts.evt = 'mousedown';
}
btn[opts.evt](opts.fn);
btn.addEventListener(opts.evt, opts.fn);
} // Add to parent flyout menu, if able to be displayed
@ -35560,7 +35562,7 @@
}
if (opts.prepend) {
btn[0].style.margin = 'initial';
btn.style.margin = 'initial';
}
fH[opts.prepend ? 'prepend' : 'append'](btn);
@ -35576,47 +35578,52 @@
if (opts.key) {
// Set shortcut based on options
var keyval,
// disInInp = true,
pd = false;
var keyval = opts.key;
var pd = false;
if (Array.isArray(opts.key)) {
keyval = opts.key[0];
if (opts.key.length > 1) {
pd = opts.key[1];
} // if (opts.key.length > 2) { disInInp = opts.key[2]; }
} else {
keyval = opts.key;
}
}
keyval = String(keyval);
var fn = opts.fn;
$$b.each(keyval.split('/'), function (j, key) {
$$b(document).bind('keydown', key, function (e) {
fn();
if (pd) {
e.preventDefault();
} // Prevent default on ALL keys?
return false;
});
keyval.split('/').forEach(function (key) {
keyHandler[key] = {
fn: fn,
pd: pd
};
}); // Put shortcut in title
if (opts.sel && !opts.hidekey && btn.attr('title')) {
var newTitle = btn.attr('title').split('[')[0] + ' (' + keyval + ')';
if (opts.sel && !opts.hidekey && btn.title) {
var newTitle = "".concat(btn.title.split('[')[0], " (").concat(keyval, ")");
keyAssocs[keyval] = opts.sel; // Disregard for menu items
if (!btn.parents('#main_menu').length) {
btn.attr('title', newTitle);
if (btn.closest('#main_menu') === null) {
btn.title = newTitle;
}
}
}
return true;
}); // register the keydown event
document.addEventListener('keydown', function (e) {
// only track keyboard shortcuts for the body containing the SVG-Editor
if (e.target.nodeName !== 'BODY') return; // normalize key
var key = "".concat(e.metaKey ? 'meta+' : '').concat(e.ctrlKey ? 'ctrl+' : '').concat(e.key.toLowerCase()); // return if no shortcut defined for this key
if (!keyHandler[key]) return; // launch associated handler and preventDefault if necessary
keyHandler[key].fn();
if (keyHandler[key].pd) {
e.preventDefault();
}
}); // Setup flyouts
setupFlyouts(flyouts); // Misc additional actions

View File

@ -35529,14 +35529,16 @@
*/
setAll: function setAll() {
var flyouts = {};
$$b.each(toolButtons, function (i, opts) {
var keyHandler = {}; // will contain the action for each pressed key
toolButtons.forEach(function (opts) {
// Bind function to button
var btn;
if (opts.sel) {
btn = $$b(opts.sel);
btn = document.querySelector(opts.sel);
if (!btn.length) {
if (btn === null) {
return true;
} // Skip if markup does not exist
@ -35548,7 +35550,7 @@
opts.evt = 'mousedown';
}
btn[opts.evt](opts.fn);
btn.addEventListener(opts.evt, opts.fn);
} // Add to parent flyout menu, if able to be displayed
@ -35560,7 +35562,7 @@
}
if (opts.prepend) {
btn[0].style.margin = 'initial';
btn.style.margin = 'initial';
}
fH[opts.prepend ? 'prepend' : 'append'](btn);
@ -35576,47 +35578,52 @@
if (opts.key) {
// Set shortcut based on options
var keyval,
// disInInp = true,
pd = false;
var keyval = opts.key;
var pd = false;
if (Array.isArray(opts.key)) {
keyval = opts.key[0];
if (opts.key.length > 1) {
pd = opts.key[1];
} // if (opts.key.length > 2) { disInInp = opts.key[2]; }
} else {
keyval = opts.key;
}
}
keyval = String(keyval);
var fn = opts.fn;
$$b.each(keyval.split('/'), function (j, key) {
$$b(document).bind('keydown', key, function (e) {
fn();
if (pd) {
e.preventDefault();
} // Prevent default on ALL keys?
return false;
});
keyval.split('/').forEach(function (key) {
keyHandler[key] = {
fn: fn,
pd: pd
};
}); // Put shortcut in title
if (opts.sel && !opts.hidekey && btn.attr('title')) {
var newTitle = btn.attr('title').split('[')[0] + ' (' + keyval + ')';
if (opts.sel && !opts.hidekey && btn.title) {
var newTitle = "".concat(btn.title.split('[')[0], " (").concat(keyval, ")");
keyAssocs[keyval] = opts.sel; // Disregard for menu items
if (!btn.parents('#main_menu').length) {
btn.attr('title', newTitle);
if (btn.closest('#main_menu') === null) {
btn.title = newTitle;
}
}
}
return true;
}); // register the keydown event
document.addEventListener('keydown', function (e) {
// only track keyboard shortcuts for the body containing the SVG-Editor
if (e.target.nodeName !== 'BODY') return; // normalize key
var key = "".concat(e.metaKey ? 'meta+' : '').concat(e.ctrlKey ? 'ctrl+' : '').concat(e.key.toLowerCase()); // return if no shortcut defined for this key
if (!keyHandler[key]) return; // launch associated handler and preventDefault if necessary
keyHandler[key].fn();
if (keyHandler[key].pd) {
e.preventDefault();
}
}); // Setup flyouts
setupFlyouts(flyouts); // Misc additional actions