Closed milancxe closed 6 years ago
1) don't try to use jquery.. you CAN'T manipulate the template on your own altering the DOM as mosaico won't get that and you'll break everything.
2) What's wrong with the first step?
<center
style="background-image: url(https://www.example.com/logo_en.jpg); -ko-background-image: url(@[backgroundSrc]);">
This way you should see a backgroundSrc property in your content tab for the template and if you fill it you should see this image in your html and in the export.
If you want to change this value via a function you do:
viewModel.setBackgroundImage = function(url) {
viewModel.content().backgroundSrc('https://newurl');
};
or maybe you simply put onfile: $root.viewModel.content().backgroundSrc
instead of onfile: $root.setBackgroundImage
(even if I didn't understand where you tried to add this content.
I saw that jquey manipulation is nearly impossible :)... Thanks for answer. As for the $root.setBackgroundImage I have put that in toolbox.tmpl.html. I was trying in the wrong way to change backgroundSrc. Now I have that, thanks a lot !
For A single block: Add an Icon to open a upload zone in tool box File : /src/tmpl/block-wysiwyg.tmpl.html `
<!-- /ko -->`
FILE : /src/tmpl/toolbox.tmpl.html
`
@bago
i also tried to do set background image. And somehow i am able to do this with your sharing code: <center style="background-image: url(https://www.example.com/logo_en.jpg); -ko-background-image: url(@[backgroundSrc]);">
But i am facing an issue there is that i am not able to change background image from a button. I am able to do this with background image input field from the left panel with complete url of an image that not make sense. Can you please help me out this?
I tried to add this code:
But its not working for me. Thanks!
Hello, I want to support background image in my template that is 99% like versafix. Idea is that user uploads image and I use it as a background for his email. So I found somewhere in your old issues and tried to use this tag to create support for background image:
In style tab I have added image upload selection like this:
When image is uploaded I am calling my function ($root.setBackgroundImage) and I set external background color to transparent. So, everything works fine up until this point. I manage to set externalBackgroundColor to all blocks, but when I set background image and background they are set for me in preview. When I download my template or send email. Instead to use my background image, template sends the default one. (the one set in template : https://www.example.com/logo_en.jpg) I have tried to set background image in multiple ways:
Now, can you help me with some hints on how to make template use my background image ? I have read your instructions on wiki for templating language on this link:
https://github.com/voidlabs/mosaico/wiki/Template-language#-ko-properties-as-css-styles
I am new to knockout, so that makes things difficult for me too...
I would be very thankful if you can help me since I'm stuck on this for some time... Any kind of explanation or hint is very much helpful ! :)