- Fix (regression): Extension locale loading for non-English locales
- Fix: Allow language to be properly set back to a different locale and retaining preference (and ensure language changes are available before dialog closed) - Refactoring: array extra/spread operator - npm: Update devDep (sinon-test)master
parent
0dc0324104
commit
fb9eb80798
|
@ -1,10 +1,15 @@
|
||||||
# ?
|
# 3.0.0
|
||||||
|
|
||||||
|
- See pre-release version notes for other changes that occurred with 3.0.0
|
||||||
- Fix: Map extension click events to "mousedown" so they can be received
|
- Fix: Map extension click events to "mousedown" so they can be received
|
||||||
on touch devices (since `touch.js` changes `touchstart` to
|
on touch devices (since `touch.js` changes `touchstart` to
|
||||||
`mousedown`) (@ClemArt); closes #168
|
`mousedown`) (@ClemArt); closes #168
|
||||||
- Fix: Ensure extension `mouseup` events run on "zoom" and "select"
|
- Fix: Ensure extension `mouseup` events run on "zoom" and "select"
|
||||||
modes (@iuyiuy); closes #159
|
modes (@iuyiuy); closes #159
|
||||||
|
- Fix: Allow language to be properly set back to a different locale and
|
||||||
|
retaining preference (and ensure language changes are available before
|
||||||
|
dialog closed)
|
||||||
|
- Fix (regression): Extension locale loading for non-English locales
|
||||||
- Enhancement: Allow "Escape" to work with hotkeys within text boxes;
|
- Enhancement: Allow "Escape" to work with hotkeys within text boxes;
|
||||||
allows escaping out of source textarea (part of #291)
|
allows escaping out of source textarea (part of #291)
|
||||||
- Enhancement: Allow 'a' also with meta key (command in Mac, ctrl otherwise)
|
- Enhancement: Allow 'a' also with meta key (command in Mac, ctrl otherwise)
|
||||||
|
@ -12,6 +17,7 @@
|
||||||
- Enhancement: Add a global escape key listener to clear the selection
|
- Enhancement: Add a global escape key listener to clear the selection
|
||||||
- Refactoring: Change 'a' to lower case in key command to avoid impression
|
- Refactoring: Change 'a' to lower case in key command to avoid impression
|
||||||
that shift is needed
|
that shift is needed
|
||||||
|
- Refactoring: array extra/spread operator
|
||||||
- npm: Update devDeps
|
- npm: Update devDeps
|
||||||
|
|
||||||
# 3.0.0-rc.3
|
# 3.0.0-rc.3
|
||||||
|
|
|
@ -27033,12 +27033,12 @@ var setStrings = function setStrings(type, obj, ids) {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'content':
|
case 'content':
|
||||||
for (var i = 0, node; node = elem.childNodes[i]; i++) {
|
_toConsumableArray(elem.childNodes).some(function (node) {
|
||||||
if (node.nodeType === 3 && node.textContent.trim()) {
|
if (node.nodeType === 3 && node.textContent.trim()) {
|
||||||
node.textContent = val;
|
node.textContent = val;
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -27879,19 +27879,23 @@ function getImportLocale(_ref) {
|
||||||
|
|
||||||
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
||||||
_context2.prev = 3;
|
_context2.prev = 3;
|
||||||
return _context2.abrupt("return", importLocale(lang));
|
_context2.next = 6;
|
||||||
|
return importLocale(lang);
|
||||||
|
|
||||||
case 7:
|
case 6:
|
||||||
_context2.prev = 7;
|
return _context2.abrupt("return", _context2.sent);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
_context2.prev = 9;
|
||||||
_context2.t0 = _context2["catch"](3);
|
_context2.t0 = _context2["catch"](3);
|
||||||
return _context2.abrupt("return", importLocale('en'));
|
return _context2.abrupt("return", importLocale('en'));
|
||||||
|
|
||||||
case 10:
|
case 12:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee2, this, [[3, 7]]);
|
}, _callee2, this, [[3, 9]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return function importLocale() {
|
return function importLocale() {
|
||||||
|
@ -30740,6 +30744,7 @@ editor.init = function () {
|
||||||
defaultName: ext.name
|
defaultName: ext.name
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
} else {
|
} else {
|
||||||
extsPreLang.push(ext);
|
extsPreLang.push(ext);
|
||||||
}
|
}
|
||||||
|
@ -32340,18 +32345,39 @@ editor.init = function () {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var savePreferences = editor.savePreferences = function () {
|
var savePreferences = editor.savePreferences =
|
||||||
|
/*#__PURE__*/
|
||||||
|
_asyncToGenerator(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee6() {
|
||||||
|
var color, lang, _ref18, langParam, langData;
|
||||||
|
|
||||||
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context6.prev = _context6.next) {
|
||||||
|
case 0:
|
||||||
// Set background
|
// Set background
|
||||||
var color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
||||||
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
||||||
|
|
||||||
var lang = $$b('#lang_select').val();
|
lang = $$b('#lang_select').val();
|
||||||
|
|
||||||
if (lang !== $$b.pref('lang')) {
|
if (!(lang !== $$b.pref('lang'))) {
|
||||||
editor.putLocale(lang, goodLangs, curConfig);
|
_context6.next = 10;
|
||||||
} // set icon size
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context6.next = 6;
|
||||||
|
return editor.putLocale(lang, goodLangs, curConfig);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
_ref18 = _context6.sent;
|
||||||
|
langParam = _ref18.langParam;
|
||||||
|
langData = _ref18.langData;
|
||||||
|
setLang(langParam, langData);
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
// set icon size
|
||||||
setIconSize($$b('#iconsize').val()); // set grid setting
|
setIconSize($$b('#iconsize').val()); // set grid setting
|
||||||
|
|
||||||
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
||||||
|
@ -32368,7 +32394,14 @@ editor.init = function () {
|
||||||
svgCanvas.setConfig(curConfig);
|
svgCanvas.setConfig(curConfig);
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
hidePreferences();
|
hidePreferences();
|
||||||
};
|
|
||||||
|
case 21:
|
||||||
|
case "end":
|
||||||
|
return _context6.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee6, this);
|
||||||
|
}));
|
||||||
|
|
||||||
var resetScrollPos = $$b.noop;
|
var resetScrollPos = $$b.noop;
|
||||||
|
|
||||||
|
@ -33941,8 +33974,8 @@ editor.init = function () {
|
||||||
// bitmap handling
|
// bitmap handling
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = function (_ref17) {
|
reader.onloadend = function (_ref19) {
|
||||||
var result = _ref17.target.result;
|
var result = _ref19.target.result;
|
||||||
|
|
||||||
// let's insert the new image until we know its dimensions
|
// let's insert the new image until we know its dimensions
|
||||||
var insertNewImage = function insertNewImage(width, height) {
|
var insertNewImage = function insertNewImage(width, height) {
|
||||||
|
@ -34022,6 +34055,7 @@ editor.init = function () {
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute('title', revnums);
|
// $('#copyright')[0].setAttribute('title', revnums);
|
||||||
|
|
||||||
|
var loadedExtensionNames = [];
|
||||||
/**
|
/**
|
||||||
* @function module:SVGEditor.setLang
|
* @function module:SVGEditor.setLang
|
||||||
* @param {string} lang The language code
|
* @param {string} lang The language code
|
||||||
|
@ -34057,6 +34091,7 @@ editor.init = function () {
|
||||||
if (extsPreLang.length) {
|
if (extsPreLang.length) {
|
||||||
while (extsPreLang.length) {
|
while (extsPreLang.length) {
|
||||||
var ext = extsPreLang.shift();
|
var ext = extsPreLang.shift();
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
ext.langReady({
|
ext.langReady({
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1,
|
uiStrings: uiStrings$1,
|
||||||
|
@ -34067,11 +34102,17 @@ editor.init = function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
loadedExtensionNames.forEach(function (loadedExtensionName) {
|
||||||
svgCanvas.runExtensions('langReady',
|
svgCanvas.runExtensions('langReady',
|
||||||
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
||||||
{
|
{
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1
|
uiStrings: uiStrings$1,
|
||||||
|
importLocale: getImportLocale({
|
||||||
|
defaultLang: lang,
|
||||||
|
defaultName: loadedExtensionName
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34303,9 +34344,9 @@ var messageQueue = [];
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var messageListener = function messageListener(_ref18) {
|
var messageListener = function messageListener(_ref20) {
|
||||||
var data = _ref18.data,
|
var data = _ref20.data,
|
||||||
origin = _ref18.origin;
|
origin = _ref20.origin;
|
||||||
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
||||||
var messageObj = {
|
var messageObj = {
|
||||||
data: data,
|
data: data,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -27039,12 +27039,12 @@
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'content':
|
case 'content':
|
||||||
for (var i = 0, node; node = elem.childNodes[i]; i++) {
|
_toConsumableArray(elem.childNodes).some(function (node) {
|
||||||
if (node.nodeType === 3 && node.textContent.trim()) {
|
if (node.nodeType === 3 && node.textContent.trim()) {
|
||||||
node.textContent = val;
|
node.textContent = val;
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -27885,19 +27885,23 @@
|
||||||
|
|
||||||
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
||||||
_context2.prev = 3;
|
_context2.prev = 3;
|
||||||
return _context2.abrupt("return", importLocale(lang));
|
_context2.next = 6;
|
||||||
|
return importLocale(lang);
|
||||||
|
|
||||||
case 7:
|
case 6:
|
||||||
_context2.prev = 7;
|
return _context2.abrupt("return", _context2.sent);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
_context2.prev = 9;
|
||||||
_context2.t0 = _context2["catch"](3);
|
_context2.t0 = _context2["catch"](3);
|
||||||
return _context2.abrupt("return", importLocale('en'));
|
return _context2.abrupt("return", importLocale('en'));
|
||||||
|
|
||||||
case 10:
|
case 12:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee2, this, [[3, 7]]);
|
}, _callee2, this, [[3, 9]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return function importLocale() {
|
return function importLocale() {
|
||||||
|
@ -30746,6 +30750,7 @@
|
||||||
defaultName: ext.name
|
defaultName: ext.name
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
} else {
|
} else {
|
||||||
extsPreLang.push(ext);
|
extsPreLang.push(ext);
|
||||||
}
|
}
|
||||||
|
@ -32346,18 +32351,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var savePreferences = editor.savePreferences = function () {
|
var savePreferences = editor.savePreferences =
|
||||||
|
/*#__PURE__*/
|
||||||
|
_asyncToGenerator(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee6() {
|
||||||
|
var color, lang, _ref18, langParam, langData;
|
||||||
|
|
||||||
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context6.prev = _context6.next) {
|
||||||
|
case 0:
|
||||||
// Set background
|
// Set background
|
||||||
var color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
||||||
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
||||||
|
|
||||||
var lang = $$b('#lang_select').val();
|
lang = $$b('#lang_select').val();
|
||||||
|
|
||||||
if (lang !== $$b.pref('lang')) {
|
if (!(lang !== $$b.pref('lang'))) {
|
||||||
editor.putLocale(lang, goodLangs, curConfig);
|
_context6.next = 10;
|
||||||
} // set icon size
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context6.next = 6;
|
||||||
|
return editor.putLocale(lang, goodLangs, curConfig);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
_ref18 = _context6.sent;
|
||||||
|
langParam = _ref18.langParam;
|
||||||
|
langData = _ref18.langData;
|
||||||
|
setLang(langParam, langData);
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
// set icon size
|
||||||
setIconSize($$b('#iconsize').val()); // set grid setting
|
setIconSize($$b('#iconsize').val()); // set grid setting
|
||||||
|
|
||||||
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
||||||
|
@ -32374,7 +32400,14 @@
|
||||||
svgCanvas.setConfig(curConfig);
|
svgCanvas.setConfig(curConfig);
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
hidePreferences();
|
hidePreferences();
|
||||||
};
|
|
||||||
|
case 21:
|
||||||
|
case "end":
|
||||||
|
return _context6.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee6, this);
|
||||||
|
}));
|
||||||
|
|
||||||
var resetScrollPos = $$b.noop;
|
var resetScrollPos = $$b.noop;
|
||||||
|
|
||||||
|
@ -33947,8 +33980,8 @@
|
||||||
// bitmap handling
|
// bitmap handling
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = function (_ref17) {
|
reader.onloadend = function (_ref19) {
|
||||||
var result = _ref17.target.result;
|
var result = _ref19.target.result;
|
||||||
|
|
||||||
// let's insert the new image until we know its dimensions
|
// let's insert the new image until we know its dimensions
|
||||||
var insertNewImage = function insertNewImage(width, height) {
|
var insertNewImage = function insertNewImage(width, height) {
|
||||||
|
@ -34028,6 +34061,7 @@
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute('title', revnums);
|
// $('#copyright')[0].setAttribute('title', revnums);
|
||||||
|
|
||||||
|
var loadedExtensionNames = [];
|
||||||
/**
|
/**
|
||||||
* @function module:SVGEditor.setLang
|
* @function module:SVGEditor.setLang
|
||||||
* @param {string} lang The language code
|
* @param {string} lang The language code
|
||||||
|
@ -34063,6 +34097,7 @@
|
||||||
if (extsPreLang.length) {
|
if (extsPreLang.length) {
|
||||||
while (extsPreLang.length) {
|
while (extsPreLang.length) {
|
||||||
var ext = extsPreLang.shift();
|
var ext = extsPreLang.shift();
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
ext.langReady({
|
ext.langReady({
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1,
|
uiStrings: uiStrings$1,
|
||||||
|
@ -34073,11 +34108,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
loadedExtensionNames.forEach(function (loadedExtensionName) {
|
||||||
svgCanvas.runExtensions('langReady',
|
svgCanvas.runExtensions('langReady',
|
||||||
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
||||||
{
|
{
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1
|
uiStrings: uiStrings$1,
|
||||||
|
importLocale: getImportLocale({
|
||||||
|
defaultLang: lang,
|
||||||
|
defaultName: loadedExtensionName
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34309,9 +34350,9 @@
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var messageListener = function messageListener(_ref18) {
|
var messageListener = function messageListener(_ref20) {
|
||||||
var data = _ref18.data,
|
var data = _ref20.data,
|
||||||
origin = _ref18.origin;
|
origin = _ref20.origin;
|
||||||
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
||||||
var messageObj = {
|
var messageObj = {
|
||||||
data: data,
|
data: data,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -48,12 +48,12 @@ export const setStrings = function (type, obj, ids) {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'content':
|
case 'content':
|
||||||
for (let i = 0, node; (node = elem.childNodes[i]); i++) {
|
[...elem.childNodes].some((node) => {
|
||||||
if (node.nodeType === 3 && node.textContent.trim()) {
|
if (node.nodeType === 3 && node.textContent.trim()) {
|
||||||
node.textContent = val;
|
node.textContent = val;
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'title':
|
case 'title':
|
||||||
|
|
|
@ -342,7 +342,7 @@ function getImportLocale ({defaultLang, defaultName}) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return importLocale(lang);
|
return await importLocale(lang);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return importLocale('en');
|
return importLocale('en');
|
||||||
}
|
}
|
||||||
|
@ -2957,6 +2957,7 @@ editor.init = function () {
|
||||||
uiStrings,
|
uiStrings,
|
||||||
importLocale: getImportLocale({defaultLang: lang, defaultName: ext.name})
|
importLocale: getImportLocale({defaultLang: lang, defaultName: ext.name})
|
||||||
});
|
});
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
} else {
|
} else {
|
||||||
extsPreLang.push(ext);
|
extsPreLang.push(ext);
|
||||||
}
|
}
|
||||||
|
@ -4441,7 +4442,7 @@ editor.init = function () {
|
||||||
* @function module:SVGEditor.savePreferences
|
* @function module:SVGEditor.savePreferences
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
const savePreferences = editor.savePreferences = function () {
|
const savePreferences = editor.savePreferences = async function () {
|
||||||
// Set background
|
// Set background
|
||||||
const color = $('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
const color = $('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
||||||
setBackground(color, $('#canvas_bg_url').val());
|
setBackground(color, $('#canvas_bg_url').val());
|
||||||
|
@ -4449,7 +4450,8 @@ editor.init = function () {
|
||||||
// set language
|
// set language
|
||||||
const lang = $('#lang_select').val();
|
const lang = $('#lang_select').val();
|
||||||
if (lang !== $.pref('lang')) {
|
if (lang !== $.pref('lang')) {
|
||||||
editor.putLocale(lang, goodLangs, curConfig);
|
const {langParam, langData} = await editor.putLocale(lang, goodLangs, curConfig);
|
||||||
|
setLang(langParam, langData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set icon size
|
// set icon size
|
||||||
|
@ -5729,6 +5731,7 @@ editor.init = function () {
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute('title', revnums);
|
// $('#copyright')[0].setAttribute('title', revnums);
|
||||||
|
|
||||||
|
const loadedExtensionNames = [];
|
||||||
/**
|
/**
|
||||||
* @function module:SVGEditor.setLang
|
* @function module:SVGEditor.setLang
|
||||||
* @param {string} lang The language code
|
* @param {string} lang The language code
|
||||||
|
@ -5763,6 +5766,7 @@ editor.init = function () {
|
||||||
if (extsPreLang.length) {
|
if (extsPreLang.length) {
|
||||||
while (extsPreLang.length) {
|
while (extsPreLang.length) {
|
||||||
const ext = extsPreLang.shift();
|
const ext = extsPreLang.shift();
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
ext.langReady({
|
ext.langReady({
|
||||||
lang,
|
lang,
|
||||||
uiStrings,
|
uiStrings,
|
||||||
|
@ -5770,7 +5774,11 @@ editor.init = function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
svgCanvas.runExtensions('langReady', /** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */ {lang, uiStrings});
|
loadedExtensionNames.forEach((loadedExtensionName) => {
|
||||||
|
svgCanvas.runExtensions('langReady', /** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */ {
|
||||||
|
lang, uiStrings, importLocale: getImportLocale({defaultLang: lang, defaultName: loadedExtensionName})
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
svgCanvas.runExtensions('langChanged', /** @type {module:svgcanvas.SvgCanvas#event:ext-langChanged} */ lang);
|
svgCanvas.runExtensions('langChanged', /** @type {module:svgcanvas.SvgCanvas#event:ext-langChanged} */ lang);
|
||||||
|
|
||||||
|
|
|
@ -27036,12 +27036,12 @@
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'content':
|
case 'content':
|
||||||
for (var i = 0, node; node = elem.childNodes[i]; i++) {
|
_toConsumableArray(elem.childNodes).some(function (node) {
|
||||||
if (node.nodeType === 3 && node.textContent.trim()) {
|
if (node.nodeType === 3 && node.textContent.trim()) {
|
||||||
node.textContent = val;
|
node.textContent = val;
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -27882,19 +27882,23 @@
|
||||||
|
|
||||||
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
||||||
_context2.prev = 3;
|
_context2.prev = 3;
|
||||||
return _context2.abrupt("return", importLocale(lang));
|
_context2.next = 6;
|
||||||
|
return importLocale(lang);
|
||||||
|
|
||||||
case 7:
|
case 6:
|
||||||
_context2.prev = 7;
|
return _context2.abrupt("return", _context2.sent);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
_context2.prev = 9;
|
||||||
_context2.t0 = _context2["catch"](3);
|
_context2.t0 = _context2["catch"](3);
|
||||||
return _context2.abrupt("return", importLocale('en'));
|
return _context2.abrupt("return", importLocale('en'));
|
||||||
|
|
||||||
case 10:
|
case 12:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee2, this, [[3, 7]]);
|
}, _callee2, this, [[3, 9]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return function importLocale() {
|
return function importLocale() {
|
||||||
|
@ -30743,6 +30747,7 @@
|
||||||
defaultName: ext.name
|
defaultName: ext.name
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
} else {
|
} else {
|
||||||
extsPreLang.push(ext);
|
extsPreLang.push(ext);
|
||||||
}
|
}
|
||||||
|
@ -32343,18 +32348,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var savePreferences = editor.savePreferences = function () {
|
var savePreferences = editor.savePreferences =
|
||||||
|
/*#__PURE__*/
|
||||||
|
_asyncToGenerator(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee6() {
|
||||||
|
var color, lang, _ref18, langParam, langData;
|
||||||
|
|
||||||
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context6.prev = _context6.next) {
|
||||||
|
case 0:
|
||||||
// Set background
|
// Set background
|
||||||
var color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
||||||
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
||||||
|
|
||||||
var lang = $$b('#lang_select').val();
|
lang = $$b('#lang_select').val();
|
||||||
|
|
||||||
if (lang !== $$b.pref('lang')) {
|
if (!(lang !== $$b.pref('lang'))) {
|
||||||
editor.putLocale(lang, goodLangs, curConfig);
|
_context6.next = 10;
|
||||||
} // set icon size
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context6.next = 6;
|
||||||
|
return editor.putLocale(lang, goodLangs, curConfig);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
_ref18 = _context6.sent;
|
||||||
|
langParam = _ref18.langParam;
|
||||||
|
langData = _ref18.langData;
|
||||||
|
setLang(langParam, langData);
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
// set icon size
|
||||||
setIconSize($$b('#iconsize').val()); // set grid setting
|
setIconSize($$b('#iconsize').val()); // set grid setting
|
||||||
|
|
||||||
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
||||||
|
@ -32371,7 +32397,14 @@
|
||||||
svgCanvas.setConfig(curConfig);
|
svgCanvas.setConfig(curConfig);
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
hidePreferences();
|
hidePreferences();
|
||||||
};
|
|
||||||
|
case 21:
|
||||||
|
case "end":
|
||||||
|
return _context6.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee6, this);
|
||||||
|
}));
|
||||||
|
|
||||||
var resetScrollPos = $$b.noop;
|
var resetScrollPos = $$b.noop;
|
||||||
|
|
||||||
|
@ -33944,8 +33977,8 @@
|
||||||
// bitmap handling
|
// bitmap handling
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = function (_ref17) {
|
reader.onloadend = function (_ref19) {
|
||||||
var result = _ref17.target.result;
|
var result = _ref19.target.result;
|
||||||
|
|
||||||
// let's insert the new image until we know its dimensions
|
// let's insert the new image until we know its dimensions
|
||||||
var insertNewImage = function insertNewImage(width, height) {
|
var insertNewImage = function insertNewImage(width, height) {
|
||||||
|
@ -34025,6 +34058,7 @@
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute('title', revnums);
|
// $('#copyright')[0].setAttribute('title', revnums);
|
||||||
|
|
||||||
|
var loadedExtensionNames = [];
|
||||||
/**
|
/**
|
||||||
* @function module:SVGEditor.setLang
|
* @function module:SVGEditor.setLang
|
||||||
* @param {string} lang The language code
|
* @param {string} lang The language code
|
||||||
|
@ -34060,6 +34094,7 @@
|
||||||
if (extsPreLang.length) {
|
if (extsPreLang.length) {
|
||||||
while (extsPreLang.length) {
|
while (extsPreLang.length) {
|
||||||
var ext = extsPreLang.shift();
|
var ext = extsPreLang.shift();
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
ext.langReady({
|
ext.langReady({
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1,
|
uiStrings: uiStrings$1,
|
||||||
|
@ -34070,11 +34105,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
loadedExtensionNames.forEach(function (loadedExtensionName) {
|
||||||
svgCanvas.runExtensions('langReady',
|
svgCanvas.runExtensions('langReady',
|
||||||
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
||||||
{
|
{
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1
|
uiStrings: uiStrings$1,
|
||||||
|
importLocale: getImportLocale({
|
||||||
|
defaultLang: lang,
|
||||||
|
defaultName: loadedExtensionName
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34306,9 +34347,9 @@
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var messageListener = function messageListener(_ref18) {
|
var messageListener = function messageListener(_ref20) {
|
||||||
var data = _ref18.data,
|
var data = _ref20.data,
|
||||||
origin = _ref18.origin;
|
origin = _ref20.origin;
|
||||||
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
||||||
var messageObj = {
|
var messageObj = {
|
||||||
data: data,
|
data: data,
|
||||||
|
|
|
@ -8996,9 +8996,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sinon-test": {
|
"sinon-test": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/sinon-test/-/sinon-test-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/sinon-test/-/sinon-test-2.4.0.tgz",
|
||||||
"integrity": "sha512-dhy6lbkZAvVW6XVsngX9HY0MNBurNPP3vqVdXGYAN4B3BNq3eXO6d5V1nuS7UsjX2tXSk7QhMEb6cUk/Fia95g==",
|
"integrity": "sha512-oQnO02I7JDbtrSKN8Qs3upobCQRythJCBn3DzPmv4m/SoPvhZJDVqHDFkRZ1lZhN2GkBqOR3m7WT79190z9kEg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"slash": {
|
"slash": {
|
||||||
|
@ -9934,7 +9934,7 @@
|
||||||
},
|
},
|
||||||
"text-encoding": {
|
"text-encoding": {
|
||||||
"version": "0.6.4",
|
"version": "0.6.4",
|
||||||
"resolved": "http://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz",
|
"resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz",
|
||||||
"integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=",
|
"integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
"rollup-plugin-re": "^1.0.7",
|
"rollup-plugin-re": "^1.0.7",
|
||||||
"rollup-plugin-terser": "^3.0.0",
|
"rollup-plugin-terser": "^3.0.0",
|
||||||
"sinon": "^7.0.0",
|
"sinon": "^7.0.0",
|
||||||
"sinon-test": "^2.3.0",
|
"sinon-test": "^2.4.0",
|
||||||
"testcafe": "^0.22.0"
|
"testcafe": "^0.22.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27036,12 +27036,12 @@
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'content':
|
case 'content':
|
||||||
for (var i = 0, node; node = elem.childNodes[i]; i++) {
|
_toConsumableArray(elem.childNodes).some(function (node) {
|
||||||
if (node.nodeType === 3 && node.textContent.trim()) {
|
if (node.nodeType === 3 && node.textContent.trim()) {
|
||||||
node.textContent = val;
|
node.textContent = val;
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -27882,19 +27882,23 @@
|
||||||
|
|
||||||
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
_ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref2$name = _ref2.name, name = _ref2$name === void 0 ? defaultName : _ref2$name, _ref2$lang = _ref2.lang, lang = _ref2$lang === void 0 ? defaultLang : _ref2$lang;
|
||||||
_context2.prev = 3;
|
_context2.prev = 3;
|
||||||
return _context2.abrupt("return", importLocale(lang));
|
_context2.next = 6;
|
||||||
|
return importLocale(lang);
|
||||||
|
|
||||||
case 7:
|
case 6:
|
||||||
_context2.prev = 7;
|
return _context2.abrupt("return", _context2.sent);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
_context2.prev = 9;
|
||||||
_context2.t0 = _context2["catch"](3);
|
_context2.t0 = _context2["catch"](3);
|
||||||
return _context2.abrupt("return", importLocale('en'));
|
return _context2.abrupt("return", importLocale('en'));
|
||||||
|
|
||||||
case 10:
|
case 12:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee2, this, [[3, 7]]);
|
}, _callee2, this, [[3, 9]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return function importLocale() {
|
return function importLocale() {
|
||||||
|
@ -30743,6 +30747,7 @@
|
||||||
defaultName: ext.name
|
defaultName: ext.name
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
} else {
|
} else {
|
||||||
extsPreLang.push(ext);
|
extsPreLang.push(ext);
|
||||||
}
|
}
|
||||||
|
@ -32343,18 +32348,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var savePreferences = editor.savePreferences = function () {
|
var savePreferences = editor.savePreferences =
|
||||||
|
/*#__PURE__*/
|
||||||
|
_asyncToGenerator(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee6() {
|
||||||
|
var color, lang, _ref18, langParam, langData;
|
||||||
|
|
||||||
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context6.prev = _context6.next) {
|
||||||
|
case 0:
|
||||||
// Set background
|
// Set background
|
||||||
var color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
color = $$b('#bg_blocks div.cur_background').css('background-color') || '#FFF';
|
||||||
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
setBackground(color, $$b('#canvas_bg_url').val()); // set language
|
||||||
|
|
||||||
var lang = $$b('#lang_select').val();
|
lang = $$b('#lang_select').val();
|
||||||
|
|
||||||
if (lang !== $$b.pref('lang')) {
|
if (!(lang !== $$b.pref('lang'))) {
|
||||||
editor.putLocale(lang, goodLangs, curConfig);
|
_context6.next = 10;
|
||||||
} // set icon size
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context6.next = 6;
|
||||||
|
return editor.putLocale(lang, goodLangs, curConfig);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
_ref18 = _context6.sent;
|
||||||
|
langParam = _ref18.langParam;
|
||||||
|
langData = _ref18.langData;
|
||||||
|
setLang(langParam, langData);
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
// set icon size
|
||||||
setIconSize($$b('#iconsize').val()); // set grid setting
|
setIconSize($$b('#iconsize').val()); // set grid setting
|
||||||
|
|
||||||
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
curConfig.gridSnapping = $$b('#grid_snapping_on')[0].checked;
|
||||||
|
@ -32371,7 +32397,14 @@
|
||||||
svgCanvas.setConfig(curConfig);
|
svgCanvas.setConfig(curConfig);
|
||||||
updateCanvas();
|
updateCanvas();
|
||||||
hidePreferences();
|
hidePreferences();
|
||||||
};
|
|
||||||
|
case 21:
|
||||||
|
case "end":
|
||||||
|
return _context6.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee6, this);
|
||||||
|
}));
|
||||||
|
|
||||||
var resetScrollPos = $$b.noop;
|
var resetScrollPos = $$b.noop;
|
||||||
|
|
||||||
|
@ -33944,8 +33977,8 @@
|
||||||
// bitmap handling
|
// bitmap handling
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = function (_ref17) {
|
reader.onloadend = function (_ref19) {
|
||||||
var result = _ref17.target.result;
|
var result = _ref19.target.result;
|
||||||
|
|
||||||
// let's insert the new image until we know its dimensions
|
// let's insert the new image until we know its dimensions
|
||||||
var insertNewImage = function insertNewImage(width, height) {
|
var insertNewImage = function insertNewImage(width, height) {
|
||||||
|
@ -34025,6 +34058,7 @@
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute('title', revnums);
|
// $('#copyright')[0].setAttribute('title', revnums);
|
||||||
|
|
||||||
|
var loadedExtensionNames = [];
|
||||||
/**
|
/**
|
||||||
* @function module:SVGEditor.setLang
|
* @function module:SVGEditor.setLang
|
||||||
* @param {string} lang The language code
|
* @param {string} lang The language code
|
||||||
|
@ -34060,6 +34094,7 @@
|
||||||
if (extsPreLang.length) {
|
if (extsPreLang.length) {
|
||||||
while (extsPreLang.length) {
|
while (extsPreLang.length) {
|
||||||
var ext = extsPreLang.shift();
|
var ext = extsPreLang.shift();
|
||||||
|
loadedExtensionNames.push(ext.name);
|
||||||
ext.langReady({
|
ext.langReady({
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1,
|
uiStrings: uiStrings$1,
|
||||||
|
@ -34070,11 +34105,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
loadedExtensionNames.forEach(function (loadedExtensionName) {
|
||||||
svgCanvas.runExtensions('langReady',
|
svgCanvas.runExtensions('langReady',
|
||||||
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
/** @type {module:svgcanvas.SvgCanvas#event:ext-langReady} */
|
||||||
{
|
{
|
||||||
lang: lang,
|
lang: lang,
|
||||||
uiStrings: uiStrings$1
|
uiStrings: uiStrings$1,
|
||||||
|
importLocale: getImportLocale({
|
||||||
|
defaultLang: lang,
|
||||||
|
defaultName: loadedExtensionName
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34306,9 +34347,9 @@
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var messageListener = function messageListener(_ref18) {
|
var messageListener = function messageListener(_ref20) {
|
||||||
var data = _ref18.data,
|
var data = _ref20.data,
|
||||||
origin = _ref18.origin;
|
origin = _ref20.origin;
|
||||||
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
// console.log('data, origin, extensionsAdded', data, origin, extensionsAdded);
|
||||||
var messageObj = {
|
var messageObj = {
|
||||||
data: data,
|
data: data,
|
||||||
|
|
Loading…
Reference in New Issue