cancel
Showing results for 
Search instead for 
Did you mean: 

TinyMCE - strip out <script> tag

lesoft
Champ in-the-making
Champ in-the-making
Hi -

I am experiencing an issue when copy and paste a block of JavaScript code into a TinyMCE field. It seems that TinyMCE stripping out <script> tag.

For example, the following block of JS code get copied into HTML TinyMCE field

<div id="row3-movie1" class="sub-module-a">
   <script language="JavaScript1.1">
   <!–
      var soPromoC1 = new SWFObject("/home/07/flash/promoc.swf?promoIndex=0&anim=0", "movie", "182", "182", "8", "#232833");
      soPromoC1.addVariable('sDataLoc', sDataLoc);
      soPromoC1.addParam('allowScriptAccess', 'always');
    }
   //–>
   </script>
</div>

The render template outputs


<div id="row3-movie1" class="sub-module-a">
  <!–
  var soPromoC1 = new SWFObject("/home/07/flash/promoc.swf?promoIndex=0&anim=0", "movie", "182", "182", "8", "#232833");
  soPromoC1.addVariable('sDataLoc', sDataLoc);
  soPromoC1.addParam('allowScriptAccess', 'always');
  }
//–>
</div>

Notice that there is no <script> tag surrounding the generated code.

Here is my XSD schema

<xs:element name="html" type="xs:string">
   <xs:annotation>
       <xs:appinfo>
   <alf:label>Content</alf:label>
   <alf:appearance>full</alf:appearance>
       </xs:appinfo>
    </xs:annotation>
</xs:element>

In XSLT template I tell it to DOE as in the code below


<div id="content-main">
   <xsl:value-of select="./fox:html" disable-output-escaping="yes"/>
</div>

I hope someone can shed somelight on the issue.  Also, I found a message in TinyMCE forum that suggested to add the support tag in TinyMCE configuration file. If that is so, where is the TinyMCE configuration file in Alfresco environment.

Thanks for your time.
Tuan
1 REPLY 1

pmonks
Star Contributor
Star Contributor
As of 2.1, TinyMCE is configured via /alfresco/web-client-config-wcm.xml file (with overrides / customisation in /alfresco/extension/web-client-config-custom.xml) - this is touched on at http://wiki.alfresco.com/wiki/Configuring_XForms_Widgets#RichTextEditor_configuration.

The bigger question is whether TinyMCE supports more granular configuration of its HTML cleansing functionality.  I'm not overly familiar with that part of TinyMCE, but you should be able to find out more at http://wiki.moxiecode.com/index.php/TinyMCE:Configuration.

Cheers,
Peter