Mailtrain-org / mailtrain

Self hosted newsletter app
GNU General Public License v3.0
5.52k stars 692 forks source link

Bug: Save / Update button for templates not showing after switching from code view #66

Closed LufoX11 closed 7 years ago

LufoX11 commented 8 years ago

Hi. I'm exporting templates from MailChimp. After switching to code view, pasting the code, and switching back, the action buttons at the bottom are hidden (I can see the container row in Chrome dev tools, but it has a margin issue). mailer After saving and opening again to edit it, the buttons are still hidden. I'm attaching the html I'm using. example.html.zip

Thanks.

andris9 commented 8 years ago

The html code editor might mess up html headers, so you should probably disable the entire wysiwyg editor in the Settings page if using more complex html templates

LufoX11 commented 8 years ago

If I do that, I won't be able to replace images for uploaded local ones, since there's no option for creating albums and get the source. Maybe using a more robust/complete wysiwyg editor? I know it's not easy to implement, but maybe it's an opportunity to improve the editor and fix a big issue.

LufoX11 commented 8 years ago

Sorry to insist, but this is a very annoying bug (I have to use debugger tools every time I need to save the doc). Would it be possible for you to add those command buttons at the top of the page too? It's a common practice to have command buttons at the beginning and at the end of the same page. I'd really appreciate it. Thank you!

andris9 commented 8 years ago

I haven't veen able to replicate this myself. Maybe you would like to check what is going on and make a pull request to fix this? I would like to keep the page layout as it is though

witzig commented 7 years ago

I too can't replicate this myself. Please re-open the ticket if the issue still persists for you.

HLFH commented 7 years ago

Same issue.

witzig commented 7 years ago

@HLFH, what browser are you using? And could you quickly try with a different one? Thanks.

HLFH commented 7 years ago

@witzig

OS: Windows 10 x64. Browser 1: Chrome 58.0.3029.81 (64-bit). Browser 2: Firefox 53.0 (32 bits). Same issue. I will send you the HTML code via email built with MJML.

EDIT: done.

It does not seem that I have any logs around this issue. Could you reopen. I am sure you can reproduce it with the sample I gave you.

I am using Node 6.10.2 On systemd, this is my mailtrain.service:

[Unit]
Description=Mailtrain
After=network-online.target mailtrain.service

[Service]
User=mailtrain
Group=mailtrain
WorkingDirectory=/var/www/mailtrain/
Environment=NODE_ENV=production
Environment=ROOT_URL=https://mailtrain.example.com
Environment=NODE_VERSION=6.10.2
ExecStart=/home/mailtrain/.nvm/nvm-exec npm start

[Install]
WantedBy=multi-user.target
witzig commented 7 years ago

Thanks, @HLFH. With the template you sent via email I'm able to reproduce the issue.

The cause is your inline style getting applied to Mailtrain. It's a known summernote behaviour.

    body {
      margin: 0;
      padding: 0;
      -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
    }

I guess we could get around this by using an iframe, which wouldn't however solve the other problem of summernote removing your HTML tag.

Thus for complex html templates you probably want to create a Mailtrain template using "Code Editor" as the editor, or disable the entire wysiwyg editor in the settings page like Andris suggested.

Maybe we should open another issue on how to improve the "Code Editor", perhaps just a preview mode would do.

HLFH commented 7 years ago

@witzig I created also some issues here: https://github.com/artf/grapesjs-preset-newsletter/issues/3 https://github.com/summernote/summernote/issues/2295 It would be great in some way, that Mailtrain supports MJML.

witzig commented 7 years ago

Hey @HLFH, this issue is totally unrelated with GrapeJS and also not actually a bug in Summernote.

If you want to use complex HTML templates in Mailtrain you should use ACE, the built in "Code Editor".

HLFH commented 7 years ago

But it seems we can't switch from one editor to another. Let's say that to build the template, we need ACE. And that after, some marketing guys want to edit the template on a simpler one like GrapesJS, they can't switch. Am I right?

witzig commented 7 years ago

Correct. Currently you'll have to convert MJML to HTML yourself, then use the HTML code with ACE. Your marketing guys will have to edit the HTML in ACE or you could teach them your current MJML workflow.

I'm afraid, but the HTML generated by MJML is quite 'complex' and should not be edited with GrapeJS or Summernote.

HLFH commented 7 years ago

@witzig Ok. Thank you!