Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing fabricjs canvas object within ImageEditor class #667

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BennyG93
Copy link

@BennyG93 BennyG93 commented Oct 21, 2021

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 BennyG93 changed the title exposing fabric js canvas object within ImageEditor class Exposing fabricjs canvas object within ImageEditor class Oct 21, 2021
@BennyG93 BennyG93 marked this pull request as draft October 21, 2021 15:05
@lja1018
Copy link
Contributor

lja1018 commented Oct 27, 2021

@BennyG93
Thank you for suggesting this fantastic feature.
It is a very necessary feature for our application.
Can I add a tests?

@BennyG93
Copy link
Author

@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

@lja1018 lja1018 mentioned this pull request Nov 24, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features to implement Help Wanted 🤝
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants