Magento 1.4 comes built in with a wysiwyg editor that is there to make it easy for less savvy users to edit rich content on their store’s home page, content pages, product descriptions etc without HTML knowledge.
There is also an option to hide the editor in case you want to use external code and paste it there or if you want to edit the HTML directly.
If you know HTML, you’ll probably want to use your favorite editor and only paste the code in the admin when you’re done (with the editor hidden). The problem is that the editor gets very buggy if you do that and then try to make a small edit directly in the admin – or even if you load the edit page in the admin and save again! That’s because the editor is not hidden by default and when loaded it adds <p> tags everywhere and removes empty divs. Depending on the code you have this will either destroy your content’s formatting on the front-end or make it disappear altogether.
Keep reading for a simple way to solve this annoying issue with the Magento editor!
3 simple steps to fix this problem:
1. Adding <div></div> tags around the entire HTML prevents the <p> tags from automatically being added
2. Putting the image path inside brackets like this: src="{{skin url="images/d5-splash.png"}}" will prevent images from disappearing
3. Adding inside empty divs will prevent them for disappearing (for example if you use an empty div with a "clear" class)
That’s it! Do you have a Magento questions? Feel free to submit it in the comments below.
Don’t forget! Subscribe and follow!
Be sure to subscribe to the feed and follow us on Twitter for more tips, resources, and giveaways!
3 Comments
Magento News
May 28, 2010 at 3:30 amIt was time someone posted a solution to this nagging issue!! Thanks so much – it worked for me.
David
October 2, 2011 at 1:51 pmVery useful, those div tags are great to remove the annoying P tag.
Paul
February 12, 2013 at 7:48 amVery clear article – very annoying problem.
Thanks