tbolis / react-sketch

Sketch Tool for React-based applications, backed up by FabricJS
http://tbolis.github.io/showcase/react-sketch/
MIT License
678 stars 230 forks source link

I wanted to Export the value of SketchField #158

Open yadavendra15 opened 2 years ago

yadavendra15 commented 2 years ago

Hi @tbolis,

Just wanted to know, Where can I get the value of the whiteboard after drawing.. something like exporting or is there any way to get the value of the SketchField whatever it stores.

I need a data on export like this file data.json.controlled.js have. So, that I can load that data at any time.. i.e., <SketchField width='1024px' height='768px' tool={Tools.Pencil} lineColor='black' lineWidth={3} value={something} /> Can you please help me in this.

Thanks in advance.

huy-lv commented 2 years ago

Try this:

<SketchField ref={sketchRef} />
...
const drawnObjects = sketchRef.current.toJSON()