- Fix: Delay icon setting until locales available (fixes #323)

master
Brett Zamir 2019-03-05 22:55:02 +08:00
parent d7a4c01c04
commit bc2e1ef725
10 changed files with 1397 additions and 1343 deletions

View File

@ -2,6 +2,7 @@
## ?
- Fix: Delay icon setting until locales available (fixes #323)
- Fix: Extension with no `placement` to be added to end;
for #326 (@sjernigan)
- Optimization fix: Properly run code conditionally on browser check;

31
dist/index-es.js vendored
View File

@ -29420,8 +29420,10 @@ editor.init = function () {
ok: ok,
cancel: cancel
});
_context3.prev = 9;
_context3.next = 12;
setIcons(); // Wait for dbox as needed for i18n
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map(
/*#__PURE__*/
function () {
@ -29495,7 +29497,7 @@ editor.init = function () {
};
}()));
case 12:
case 13:
svgCanvas.bind('extensions_added',
/**
* @param {external:Window} win
@ -29525,21 +29527,21 @@ editor.init = function () {
});
});
svgCanvas.call('extensions_added');
_context3.next = 19;
_context3.next = 20;
break;
case 16:
_context3.prev = 16;
_context3.t0 = _context3["catch"](9);
case 17:
_context3.prev = 17;
_context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console
case 19:
case 20:
case "end":
return _context3.stop();
}
}
}, _callee3, this, [[9, 16]]);
}, _callee3, this, [[10, 17]]);
}));
return function extAndLocaleFunc() {
@ -29846,7 +29848,12 @@ editor.init = function () {
setFlyoutPositions();
};
/**
* Setup SVG icons
*/
function setIcons() {
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
@ -30135,11 +30142,13 @@ editor.init = function () {
return callback;
}()
});
}
/**
* @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas}
*/
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36145,7 +36154,9 @@ editor.init = function () {
if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100);
} else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this)
// Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc();
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

31
dist/index-umd.js vendored
View File

@ -29426,8 +29426,10 @@
ok: ok,
cancel: cancel
});
_context3.prev = 9;
_context3.next = 12;
setIcons(); // Wait for dbox as needed for i18n
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map(
/*#__PURE__*/
function () {
@ -29501,7 +29503,7 @@
};
}()));
case 12:
case 13:
svgCanvas.bind('extensions_added',
/**
* @param {external:Window} win
@ -29531,21 +29533,21 @@
});
});
svgCanvas.call('extensions_added');
_context3.next = 19;
_context3.next = 20;
break;
case 16:
_context3.prev = 16;
_context3.t0 = _context3["catch"](9);
case 17:
_context3.prev = 17;
_context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console
case 19:
case 20:
case "end":
return _context3.stop();
}
}
}, _callee3, this, [[9, 16]]);
}, _callee3, this, [[10, 17]]);
}));
return function extAndLocaleFunc() {
@ -29852,7 +29854,12 @@
setFlyoutPositions();
};
/**
* Setup SVG icons
*/
function setIcons() {
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
@ -30141,11 +30148,13 @@
return callback;
}()
});
}
/**
* @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas}
*/
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36151,7 +36160,9 @@
if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100);
} else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this)
// Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc();
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -808,6 +808,8 @@ editor.init = function () {
const {ok, cancel} = uiStrings.common;
jQueryPluginDBox($, {ok, cancel});
setIcons(); // Wait for dbox as needed for i18n
try {
await Promise.all(
curConfig.extensions.map(async (extname) => {
@ -1163,6 +1165,11 @@ editor.init = function () {
setFlyoutPositions();
};
/**
* Setup SVG icons
*/
function setIcons () {
$.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24, h: 24,
id_match: false,
@ -1433,7 +1440,7 @@ editor.init = function () {
await editor.runCallbacks();
}
});
}
/**
* @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas}
@ -6294,7 +6301,9 @@ editor.init = function () {
if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100);
} else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this)
// Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc();
}
};

View File

@ -29423,8 +29423,10 @@
ok: ok,
cancel: cancel
});
_context3.prev = 9;
_context3.next = 12;
setIcons(); // Wait for dbox as needed for i18n
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map(
/*#__PURE__*/
function () {
@ -29498,7 +29500,7 @@
};
}()));
case 12:
case 13:
svgCanvas.bind('extensions_added',
/**
* @param {external:Window} win
@ -29528,21 +29530,21 @@
});
});
svgCanvas.call('extensions_added');
_context3.next = 19;
_context3.next = 20;
break;
case 16:
_context3.prev = 16;
_context3.t0 = _context3["catch"](9);
case 17:
_context3.prev = 17;
_context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console
case 19:
case 20:
case "end":
return _context3.stop();
}
}
}, _callee3, this, [[9, 16]]);
}, _callee3, this, [[10, 17]]);
}));
return function extAndLocaleFunc() {
@ -29849,7 +29851,12 @@
setFlyoutPositions();
};
/**
* Setup SVG icons
*/
function setIcons() {
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
@ -30138,11 +30145,13 @@
return callback;
}()
});
}
/**
* @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas}
*/
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36148,7 +36157,9 @@
if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100);
} else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this)
// Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc();
}
};

View File

@ -29423,8 +29423,10 @@
ok: ok,
cancel: cancel
});
_context3.prev = 9;
_context3.next = 12;
setIcons(); // Wait for dbox as needed for i18n
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map(
/*#__PURE__*/
function () {
@ -29498,7 +29500,7 @@
};
}()));
case 12:
case 13:
svgCanvas.bind('extensions_added',
/**
* @param {external:Window} win
@ -29528,21 +29530,21 @@
});
});
svgCanvas.call('extensions_added');
_context3.next = 19;
_context3.next = 20;
break;
case 16:
_context3.prev = 16;
_context3.t0 = _context3["catch"](9);
case 17:
_context3.prev = 17;
_context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console
case 19:
case 20:
case "end":
return _context3.stop();
}
}
}, _callee3, this, [[9, 16]]);
}, _callee3, this, [[10, 17]]);
}));
return function extAndLocaleFunc() {
@ -29849,7 +29851,12 @@
setFlyoutPositions();
};
/**
* Setup SVG icons
*/
function setIcons() {
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
@ -30138,11 +30145,13 @@
return callback;
}()
});
}
/**
* @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas}
*/
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36148,7 +36157,9 @@
if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100);
} else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this)
// Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc();
}
};