-
Notifications
You must be signed in to change notification settings - Fork 504
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
generic "backend" save/load plugin #50
Comments
I'm currently trying to implement Mosaico in our CRM as a newsletter editor, working with the plugin posted in issue #73. If I were implementing back-end saving in Mosaico, I would do it differently. Instead of providing different urls in the config for image uploading, downloading, saving, I would use callbacks. That would give the developer a lot more flexibility. For example, there could be a
If for nothing else, do it for saving. That way the dev can choose if they want to use html or json, provide a unique ID, or whatever. Also consider the fact that a lot of back end websites these days don't use relative URLs, but use routing for everything. I had to cobble together some messy code to satisfy the relative URL requirements. That's just my two cents, based on my experiences with the numerous other plugins I've used. That said, this is a very impressive plugin, and I salute its creator for making it open source! |
At this time mosaico doesn't provide a "save" backend, so there is no configuration for "saving" (not an url nor a callback). Image upload instead needs an URL because it also deals with "progress" and "drag & drop" and I don't think it would be easy to be implemented by callback. You can define your own command buttons and their callbacks via plugin like this comment explain: #73 (comment) So, you already have a way to define your own callbacks for the "top-right" buttons and it is not so hard to do (this doesn't apply to "image upload backend" as I already explained). Placing an "onSave" in the "Mosaico.init" gives "Mosaico" a knowledge it currently doesn't have/need, so I prefer to leave it in a plugin until I identify a better solution. Also having a single callback would be sub-optimal if you want to store the JSON: generating the output html have an high cost, while generating the JSON is much lightweight.. it wouldn't make sense to generate the HTML when the user wants to save only the JSON. I didn't get your "relative urls" issue: Mosaico is already used in production in environmens where routes are used. Please open a specific issue with details if you think there is an issue. |
Stefano wrote:
We probably can deploy a generic "backend" save/load plugin that takes
an url to be invoked at load and another to POST saves, but I don't
know what is "generic" (a single save POST with both the metadata and
the generated html? 2 different methods to save the metadata and to
"export" the generated html?). We'll have to see some people embed
use-case in order to better understand this and make some better
plugin to help future integration.
I open this issue in order to discuss the methods for such a plugin. Here are the initial proposals. I will update the issue from time to time based on the discussion.
simple version
advance mode
The text was updated successfully, but these errors were encountered: