Friday, 18 June 2010

Alfresco 3.1.1 and paragraph tags

Right now I am getting to grips with the finer details of an Alfresco v3.1.1 installation. It has been fun*.

Today's quest was all about stopping the TinyMCE plugin that Alfresco uses from wrapping absolutely everything in a <p> tag. Usually I love <p> tags. Way more than I love <br>tags. But not all content entered through a CMS should be wrapped in them.

I found this bug report, which mentioned a rather drastic way of fixing it, but also gave some clues as to another, less invasive, way. The hunt was on. A few hours later (it would have been a few minutes if I had thought to clear my browser cache), I came up with the following:

(DISCLAIMER: The following changes will be lost if you upgrade/replace your Alfresco installation. But since this issue doesn't occur in any other version of Alfresco, that should be ok.)

Step 1: Open up <tomcat>/webapps/alfresco/scripts/ajax/xforms.js

Step 2: Find the definition of alfresco.constants.TINY_MCE_DEFAULT_SETTINGS (it is near the end) and change it to be:

alfresco.constants.TINY_MCE_DEFAULT_SETTINGS =
theme: "advanced",
mode: "exact",
plugins: alfresco.constants.TINY_MCE_DEFAULT_PLUGINS,
width: -1,
height: -1,
auto_resize: false,
force_p_newlines: false,
encoding: "UTF-8",
entity_encoding: "raw",
add_unload_trigger: false,
add_form_submit_trigger: false,
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_buttons1: "",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
urlconverter_callback: "alfresco_TinyMCE_urlconverter_callback",
file_browser_callback: "alfresco_TinyMCE_file_browser_callback",
forced_root_block: false,
force_br_newlines: true

Note the two last lines.

When you are done, all you need to do is clear your browser's cache, and go edit some web content in Alfresco. Anything you create from now on will no longer be wrapped in the usually wonderful <p> tags.

*This depends on your definition of fun.


  1. Today, we can’t simply ignore the importance of the video and movie streaming applications as we have been more dependent on our smartphones.
    And talking about the video streaming applications, SnapTube is by far the most famous and downloaded streaming application of the current time.
    So want more insight on the SnapTube app? Check out this website SnapTube Apk Latest Version

  2. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

  3. Please visit my app's site cinemabox app anndroid, it is an app made to fight boredom and show movies for free. it has a lot of potiental of giving a tight competition to amazon prime videos and netflix too. please download the app andd tell us how we can improve it cinema box app android