Prestashop TinyMCE editor full options + all html tags support

Default TinyMCE editor (wysiwyg - what you see is what you get) uses only several available in this editor tools. Today i want to show you how to increase number of available tools and how to change the source code to support all HTML tags + javascript. It's important, because by default this editor doesn't allow to use javascript + several html tags. In this tutorial i described step by step how to achieve that with modification of the PrestaShop files. If you don't want to edit files you can take a look on module:  tinyMCE pro - extended rich text editor in PrestaShop - it does everything automatically and includes some additional features.


 Simple Prestashop tinymce editor

tinymce simple prestashop



 TinyMCE extended version

TinyMce extended prestashop



open the file: _ADMIN_DIR_/themes/default/template/helpers/form/form.tpl near the line ~400 you've got something like:

		{block name="autoload_tinyMCE"}
				editor_selector :"autoload_rte"

This is a code where we have got tinyMCE editor object definition. We have to change tinySetup({ }) function. Change whole code to:


		{block name="autoload_tinyMCE"}
				editor_selector :"autoload_rte",
                                  theme_advanced_buttons1 : "save,newdocument,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect, fontselect,fontsizeselect",
                                  theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,search,replace,bullist,numlist,outdent,indent,blockquote,undo,redo,link,unlink,anchor,image,cleanup,help,codemagic,insertdate,inserttime,preview,forecolor,backcolor",
                                  theme_advanced_buttons3 : "code,tablecontrols,hr,removeformat,visualaid,sub,sup,charmap,emotions,iespell,media,advhr,print,ltr,rtl,fullscreen",
                                  theme_advanced_buttons4 : "styleprops,cite,abbr,acronym,del,ins,attribs,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
                                  theme_advanced_toolbar_location : "top",
                                  theme_advanced_toolbar_align : "left",
                                  theme_advanced_statusbar_location : "bottom",
                                  theme_advanced_resizing : false,
                                                    extended_valid_elements: 'pre[*],script[*],style[*]',
                                                    valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
                                                    valid_elements : '*[*]',
                                                    force_p_newlines : false,
                                                    cleanup: false,
                                                    forced_root_block : false,
                                                    force_br_newlines : true

This code will allow you to use extended version of the tinyMCE editor + editor will accept javascripts and additional html tags. That's all! Save changes and enjoy the changes! :)



Prestashop in version 1.5+ has got new validation function, in this case it is also necessary to change Validate.php class, you can read about it here: validation class change - Lookig for tutorial about extending tinymce featured on product edit page? check this tutorial: full featured editor on product edit page




Module that does everything + new fancy features

Module that does everything automatically + includes some additional features not available in this article.

If you're interested in solution that will add font awesome icons, youtube videos insert tool or some other additonal things,

check official page of this module, it's available here: tinyMCE pro - extended rich text editor in PrestaShop


tinyMCE pro - extended version of editor






author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim