Replies: 45 comments
-
I don't know if my solution is the best, i started hacking mosaico 2 weeks back and i made some improvements. |
Beta Was this translation helpful? Give feedback.
-
Did you do this in index.html? Do you have a repository or a gist to show how you did this? How do you handle "save" button of mosaico? |
Beta Was this translation helpful? Give feedback.
-
Refer to @bago comment on #18 . I followed his advice. and |
Beta Was this translation helpful? Give feedback.
-
We probably can make this simpler by merging metadata+content in a single object and by providing a simple "storage" plugin solution for which "localstorage" is the bundled implementation but it should be easier to plug-in a custom implementation (most people will have to do that). But I'm also happy that we didn't have anything "pluggable" so that some people have to put their hands in the code! I'm happy to see how other developers hack in the code and understand what they expect there ;-) |
Beta Was this translation helpful? Give feedback.
-
This is by far my implementation. I implemented the Save button as plugin. This implementation does not involve localstorage which means don't put hash in your url like: http://youurl.com/editor.html#hashere, just the http://youurl.com/editor.html. it's because mosaico automatically loads the localstorage plugin whenever they found a hash in the url. I hope this helps.
|
Beta Was this translation helpful? Give feedback.
-
This feature alone would make this application 100x more useful. |
Beta Was this translation helpful? Give feedback.
-
@jbaltero Thank you for posting that plugin, it is a lifesaver and super educational. |
Beta Was this translation helpful? Give feedback.
-
@jbaltero you can use Mosaico.start method instead of Mosaico.init if you don't want to enable the "localstorage" built-in plugin login. |
Beta Was this translation helpful? Give feedback.
-
Newbie dev here. How do I implement this plugin? Should I just replace the |
Beta Was this translation helpful? Give feedback.
-
@GLenotre I was just working on this myself. You're supposed to put it in your editor.html file where Mosaico gets initialized. See line 40 where the plugins variable is commented out. Put the plugins array right there, and it will be included when Mosaico is initialized. BUT I was actually having trouble getting it to work. The save button still isn't firing the plugin function, and I'm getting no errors. I don't know if there's anything further you have to do to get it to fire beyond what's posted up there, but any help from @jbaltero or @bago would be infinitely appreciated. |
Beta Was this translation helpful? Give feedback.
-
@GLenotre , @CaptainHypertext is right, go check editor.html line 40 and you should be able to get how it was implemented. @CaptainHypertext what do you mean by save button isn't firing the plugin function? You mean the ajax? Have you debugged it by a simple jquery alert();? |
Beta Was this translation helpful? Give feedback.
-
Thanks for replying,
Mosaico is loading just like normal, and when I click Save, it seems to just do the normal save function, and fires no ajax, and logs no |
Beta Was this translation helpful? Give feedback.
-
@CaptainHypertext Have you checked your URL? make sure it doesn't contain a hash character like http://youurl.com/editor.html#hashere. |
Beta Was this translation helpful? Give feedback.
-
If you don't want the "localStorage" plugin in the way just use Mosaico.start instead of Mosaico.init. Mosaico.start({ yourmosaicooptions }, 'yourtemplatepath', undefined /* metadata */, undefined /* model */, extensions); |
Beta Was this translation helpful? Give feedback.
-
Ah, yes, thanks guys. I think I'm starting to understand this a bit better. Yes, I was still using the hash in the url. I removed that and started using the On the other hand, I've lost the Test and Download buttons (I can live without them for now, though). |
Beta Was this translation helpful? Give feedback.
-
Do you see the download button? Does everything else works? Do you see errors in the browser javascript console? Add a console log after "viewModel.download = downloadCmd;" so you know that the code is executed. |
Beta Was this translation helpful? Give feedback.
-
@ShahVivek |
Beta Was this translation helpful? Give feedback.
-
@notchris I checked your code , but actually i am implementing it in .net. |
Beta Was this translation helpful? Give feedback.
-
@bago I am not able to see download button. Everything else is works fine. I added console log after "viewModel.download = downloadCmd;" and it prints successfully.
|
Beta Was this translation helpful? Give feedback.
-
You probably altered the template code and broke it: "found unexpected -ko- attribute in compiled template sideArticleBlock-show". Don't mix too many changes if you want to be able to debug. So, try altering the save button without altering the rest of mosaico or the template. |
Beta Was this translation helpful? Give feedback.
-
If I take the time to write a tutorial for implementation with different backends, can it be posted on the main page? |
Beta Was this translation helpful? Give feedback.
-
Can't promise anything before I see the result. |
Beta Was this translation helpful? Give feedback.
-
I have successfully implemented a full PHP backend with saving and loading all done server side. I will issue a pull-request next week after some more testing. |
Beta Was this translation helpful? Give feedback.
-
Do you have this backend? |
Beta Was this translation helpful? Give feedback.
-
+1 Also interested in the php backend with storage |
Beta Was this translation helpful? Give feedback.
-
My example is a working php backend with storage @janober @webportpl |
Beta Was this translation helpful? Give feedback.
-
@mattghall I will be interested in who you successfully implemented a full PHP backend with saving and loading all done server side. |
Beta Was this translation helpful? Give feedback.
-
When I try using the and tracked it back to this error: My code is as follows:
Any help much appreciated |
Beta Was this translation helpful? Give feedback.
-
You are just awesome . Did the most of it and that was a quick starter. |
Beta Was this translation helpful? Give feedback.
-
@athulhere Glad it helped! I haven't updated it in years so I'm happy it is still working. |
Beta Was this translation helpful? Give feedback.
-
What would be the easiest way to replace localstorage by a backend
As far as I can see, it requires following steps
It appears to me that the latter issue needs to be done in index.html as well as in mosaico respectively in editor.html. Could we find another appraoch, for example:
Of course beyond these basic things, one could think of more advanced scenarios, but this might be discussed #50 resp. #59
Beta Was this translation helpful? Give feedback.
All reactions