I have successfully imported the nodes by importing it from a json file. However, it doesn't work because I try to modify(transform,remove) the nodes I brought. What should I do?
Here is code. Thank you!
function setFile() {
const files = document.querySelector('.selectFile').files;
if (files.length <= 0) {
return false;
}
const fr = new FileReader();
fr.onload = function(e) {
const result = JSON.parse(e.target.result);
const formatted = JSON.stringify(result, null, 2);
console.log(formatted)
layer.destroyChildren();
stage = Konva.Node.create(formatted, 'container');
stage.draw()
}
fr.readAsText(files.item(0))
}
I think you missed adding layer to the stage