WYSIWYG-Editor

The standard Magento editor TinyMCE that is installed by default unfortunately does not always behave according to the user's wishes.

Especially when attempting to wrap a div element with an a tag, the results are rather limited. Changing the editor settings and adjusting the parameters "extended_valid_elements" and "valid_children" does not help much either. By default, TinyMCE deletes all "empty" a tags (e.g. <a></a> or <a><div></div></a>) within the file \js\tiny_mce\tiny_mce.js (source for better readability: \js\tiny_mce\tiny_mce_src.js). Not only empty a tags are filtered out here, but also several other empty elements (ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr). Therefore, in \js\tiny_mce\tiny_mce.js, simply replace

ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr

with

ol,ul,sub,sup,blockquote,span,font,table,tbody,tr

.

However, with a few additions to the file \js\german\localepackde\setup.js (or, if the language pack is missing, the corresponding file js\mage\adminhtml\wysiwyg\tiny_mce\setup.js):

force_br_newlines : true,
force_p_newlines : false,
forced_root_block : false,

(within the variable assignment "var settings ="), you can then work with the Magento standard editor without any problems.

... back to the blog