当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Export to and import from JSON fabricjs

问题描述:

I have created a fabric canvas and have many images on it. What i want to be able to do is to save progress or export to JSON and re-import on another PC.

JSfiddle

I am using the code below to get the code (nr bottom of my fiddle)

 $("#canvas2json").click(function(){

canvas.isDrawingMode = false;

if(!window.localStorage){

alert("This function is not supported by your browser.");

return;

}

var json = JSON.stringify(canvas);

//canvas.renderAll();

$("#myTextArea").text(json);

});

But I dont know how to load from the textarea or show an updated code if the user makes changes.

Could anyone help. the idea of my fiddle is a planner that they can play with and share the code (or pref a URL, the smaller the share code the better) so anyone can give advice on the design, changing it if needed.

分享给朋友:
您可能感兴趣的文章:
随机阅读: