diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index d923ef51..f40d68d1 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -655,7 +655,7 @@ class EditorStartup { editorObj.svgCanvas.selectOnly([ newImage ]); editorObj.svgCanvas.alignSelectedElements('m', 'page'); editorObj.svgCanvas.alignSelectedElements('c', 'page'); - editorObj.topPanelHandlers.updateContextPanel(); + editorObj.topPanel.updateContextPanel(); document.getElementById('se-prompt-dialog').setAttribute('close', true); }; // create dummy img so we know the default dimensions diff --git a/src/svgcanvas/svg-exec.js b/src/svgcanvas/svg-exec.js index cf825ccb..766d0bd4 100644 --- a/src/svgcanvas/svg-exec.js +++ b/src/svgcanvas/svg-exec.js @@ -351,7 +351,7 @@ export const setSvgString = function (xmlString, preventUndo) { const elements = content.querySelectorAll('image'); Array.prototype.forEach.call(elements, function (image) { preventClickDefault(image); - const val = svgContext_.getCanvas().getHref(this); + const val = svgContext_.getCanvas().getHref(image); if (val) { if (val.startsWith('data:')) { // Check if an SVG-edit data URI diff --git a/src/svgcanvas/utilities.js b/src/svgcanvas/utilities.js index 1a7c54e5..38ff9f7e 100644 --- a/src/svgcanvas/utilities.js +++ b/src/svgcanvas/utilities.js @@ -1324,11 +1324,8 @@ export const snapToGrid = function (value) { * @returns {void} */ export const preventClickDefault = function (img) { - const elements = document.querySelectorAll(img); - Array.from(elements).forEach(function (element) { - element.addEventListener('click', function (e) { - e.preventDefault(); - }); + img.addEventListener('click', function (e) { + e.preventDefault(); }); };