Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Magento "fixing" html in static blocks

Does anyone know if there's some way to stop Magento "fixing" html that's added via static blocks?

For example, if I wanted to have a space within an existing menu for adding static blocks to, I wouldn't want to use a full < ul > list as it already exists, so I'd just want some additional < li > tags within the block.

However, Magento very helpfully decides to always add in the "missing" < ul > tags for you. Rather annoying.

I've tried tracing this back myself but just can't find where it's happening. I think it could be TinyMce related, as the fixing happens if you hide/show the editor, without a page refresh. I tried changing different instances I found of cleanup:1 to cleanup:0 but none of them so far worked.

Any ideas?

like image 559
Marlon Creative Avatar asked Nov 15 '12 09:11

Marlon Creative


2 Answers

It's not magento that is doing this cleanup but the wysiwyg editor : tiny_mce

You can desactivate this behavior by adding :

cleanup : false

in the js config file (js/mage/adminhtml/wysiwyg/tiny_mce/setup.js)

But this is totally not recommended as it can break all of your pages is an HTML bug is injected in a block or page and you don't have any other HTML tidier on your project ...

like image 73
Jscti Avatar answered Oct 21 '22 10:10

Jscti


Have a look at the tinymce configuration parameter valid_elements and valid_children. You can define li-tags as valid elements there and define that li-tags may be childs to other thml nodes.

like image 27
Thariama Avatar answered Oct 21 '22 08:10

Thariama