Mautic Community Forums

Custom HTML being stripped from landing pages

I have spent the last 2 days tracking down this problem and finally figured out what it happening. It was a pain in the ass to find exactly what was going on.



When using the common marketing automation softwares out there (I have used them all), they allow you to create custom landing pages, just like Mautic does. More often than not, the landing pages are created outside the software and the HTML is pasted directly into the marketing automation software. No other software modifies the HTML, ever.



Mautic is changing the HTML that gets pasted in through the “Source” button – CKEditor modifies the HTML. I spent so much time trying to figure out what was going on because this was the last thing I would have expected.



If you have an empty class, like you would do in Font Awesome,

Code:

The editor strips the code out completely. There is a lot of talk on StackOverflow and various forums. Under no circumstances should you be modifying HTML code we paste in!!

I see this has been brought up before:
https://github.com/mautic/mautic/pull/847

This is a nightmare to diagnose.

I have tried modifying the CKEditor config.js file - https://github.com/mautic/mautic/blob/staging/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/config.js

How can I make it so that CKEditor NEVER changes HTML posted in, whether it be while creating an email or a landing page? If this can't be done, what other solutions will allow me to just paste in HTML in a simple text box without anything that is going to mess with my carefully crafted HTML?



I have spent the last 2 days tracking down this problem and finally figured out what it happening. It was a pain in the ass to find exactly what was going on.

When using the common marketing automation softwares out there (I have used them all), they allow you to create custom landing pages, just like Mautic does. More often than not, the landing pages are created outside the software and the HTML is pasted directly into the marketing automation software. No other software modifies the HTML, ever.

Mautic is changing the HTML that gets pasted in through the “Source” button – CKEditor modifies the HTML. I spent so much time trying to figure out what was going on because this was the last thing I would have expected.

If you have an empty class, like you would do in Font Awesome,

<i class="fa fa-play-circle"></i> 

The editor strips the code out completely. There is a lot of talk on StackOverflow and various forums. Under no circumstances should you be modifying HTML code we paste in!!

I see this has been brought up before:
https://github.com/mautic/mautic/pull/847

This is a nightmare to diagnose.

I have tried modifying the CKEditor config.js file - https://github.com/mautic/mautic/blob/staging/app/bundles/CoreBundle/Assets/js/libraries/ckeditor/config.js

How can I make it so that CKEditor NEVER changes HTML posted in, whether it be while creating an email or a landing page? If this can’t be done, what other solutions will allow me to just paste in HTML in a simple text box without anything that is going to mess with my carefully crafted HTML?

BTW - on the CKEditor config file, I added this line to no avail:

config.allowedContent = true;

The editor isn’t doing us any favors by modifying the HTML code we paste in. There shouldn’t be malicious things happening here. With how difficult it is to craft standards compliant landing pages that render pixel perfect on all devices, the HTML should not be modified.

@alanhartless @escopecz ??

Would this fix work for you? https://github.com/mautic/mautic/pull/1736

It will not, because CKEditor is stripping out tags. In addition to that, it changes the formatting of the HTML.

The best solution for this would be to have a real “source” view that is ONLY the source. When you go into that mode, do not show the WYSIWYG editor.

It should be a truly source view that has absolutely no modifications being made to it on the front end or via CKEditor

I have a completely different workflow than using any of the builders you have. The builder and WYSIWYG isn’t part of my work flow at all.

Big companies are run the same way - a lot of the templates are built outside the marketing automation software.

@escopecz btw, thank you for the great software! and your help!!

@escopecz should I put an issue up on github?

Sure, you don’t have to have my permission :slight_smile: But check if it’s not there already to avoid duplicates

https://github.com/mautic/mautic/issues?utf8=✓&q=is%3Aissue+is%3Aopen+editor

Posted an issue:

https://github.com/mautic/mautic/issues/1746

And a proposed fix that works on my end.