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 comment:

  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

    ReplyDelete