tui.image-editor
tui.image-editor copied to clipboard
Exposing fabricjs canvas object within ImageEditor class
Exposing the FabricJS canvas object and the loadFromJSON
FabricJS function via the core imageEditor
class
http://fabricjs.com/docs/fabric.Canvas.html#loadFromJSON
Exporting Canvas example:
import ImageEditor from '@toast-ui/react-image-editor';
var canvasData = imageEditor.getCanvas();
console.log(canvasData);
After storing the whole Canvas
object inside a variable, it can then be saved to MongoDB. In theory, you can then fetch this object from MongoDB and it can be restored using the loadFromJSON FabricJS function which is exposed via the imageEditor
class.
Example:
import ImageEditor from '@toast-ui/react-image-editor';
const canvasData = someFunction.getCanvasFromMongoDB()
imageEditor.loadCanvas(canvasData);
FYI this is completely experimental and has not been tested. It is only for example.
@BennyG93 Thank you for suggesting this fantastic feature. It is a very necessary feature for our application. Can I add a tests?
@lja1018 Sure you can continue with this, I made this draft as a theoretical proof of concept but I have have not actually tried it in action
This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!