Use change event to be sure that file is loaded before the function

Click event can trigger the script before the user choose the file, so it will be loader on the next
Open SVG click. Change event trigger the script after the user choose the file.
master
Moliman 2019-08-03 03:05:51 -04:00
parent af52265e1f
commit 0bb9728067
3 changed files with 3 additions and 3 deletions

View File

@ -6193,7 +6193,7 @@ editor.init = function () {
workarea[0].addEventListener('dragleave', onDragLeave);
workarea[0].addEventListener('drop', importImage);
const open = $('<input type="file">').click(async function () {
const open = $('<input type="file">').change(async function (e) {
const ok = await editor.openPrep();
if (!ok) { return; }
svgCanvas.clear();

View File

@ -36368,7 +36368,7 @@
workarea[0].addEventListener('dragover', onDragOver);
workarea[0].addEventListener('dragleave', onDragLeave);
workarea[0].addEventListener('drop', importImage);
var open = $$b('<input type="file">').click(
var open = $$b('<input type="file">').change(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/

View File

@ -36368,7 +36368,7 @@
workarea[0].addEventListener('dragover', onDragOver);
workarea[0].addEventListener('dragleave', onDragLeave);
workarea[0].addEventListener('drop', importImage);
var open = $$b('<input type="file">').click(
var open = $$b('<input type="file">').change(
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/