<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technotrance, Illusions and Perspectives &#187; syntaxhighlighter</title>
	<atom:link href="http://myblog.shriharisc.com/tag/syntaxhighlighter/feed/" rel="self" type="application/rss+xml" />
	<link>http://myblog.shriharisc.com</link>
	<description>A dose of everyday bruises with Java/JEE</description>
	<lastBuildDate>Mon, 02 Aug 2010 17:45:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Code Syntaxhiglighter plugin to Richfaces text editor</title>
		<link>http://myblog.shriharisc.com/2009/09/12/adding-code-syntaxhiglighter-plugin-to-richfaces-text-editor/</link>
		<comments>http://myblog.shriharisc.com/2009/09/12/adding-code-syntaxhiglighter-plugin-to-richfaces-text-editor/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 18:01:47 +0000</pubDate>
		<dc:creator>Shrihari</dc:creator>
				<category><![CDATA[jee-light]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[syntaxhighlighter]]></category>

		<guid isPermaLink="false">http://schakrap.wordpress.com/?p=107</guid>
		<description><![CDATA[Exadel&#8217;s Richfaces Rich text editor integrates with TinyMCE javascript plugin to provide the rich text editor functions present in any document processing application. However often would be a need where we have to embed source code from a particular programming  language. In order to support  embedding code in the richtext editor, the code should [...]]]></description>
			<content:encoded><![CDATA[<p>Exadel&#8217;s Richfaces <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/tlddoc/rich/editor.html">Rich text editor</a> integrates with <a href="http://tinymce.moxiecode.com/">TinyMCE javascript plugin</a> to provide the rich text editor functions present in any document processing application. However often would be a need where we have to embed source code from a particular programming  language. In order to support  embedding code in the richtext editor, the code should be surrounded wuth appropriate &#8220;pre&#8221; tags with options for the selected programming language. This particular tip explores integrating a <a href="http://github.com/RichGuk/syntaxhl/tree/master">SyntaxHighlighter plugin</a> with Richfaces rich text editor, enabling the editor support for source code editing:</p>
<p>1) Download the sources from <a href="http://github.com/RichGuk/syntaxhl/tree/master">site</a>.</p>
<p>2) Create a folder under ${contextroot}/js/tinymceplugins/syntaxhighlight and extract all the contents of the downloaded zip/sources here. Remember that the folder name should be &#8216;tinymceplugin&#8217; as the TinyMCE javascript plugin looks for this folder for additional plugins if configured. Also note that ${contextroot} is your web application context root.</p>
<p>3) The different languages you need to support are present under ${contextroot}/js/tinymceplugins/syntaxhighlight/dialog.htm, where you retain only the relevant ones. For XML/XHTML support, you may need to add 2 additional lines, which would convert the XML tags to respective character equivalents in ${contextroot}/js/tinymceplugins/syntaxhighlight/js/dialog.js</p>
<pre class="brush: javascript">
content_text = f.syntaxhl_code.value.replace(/&lt;/g,&quot;&amp;lt;&quot;);
 content_text = content_text.replace(/&gt;/g,&quot;&amp;gt;&quot;);
 textarea_output +=  content_text;
</pre>
<p>4) Create a properties file rteplugins.properties (name with custom plugins are resolved) with a property containing full path (relative with regard to ${contextroot}) of the editor_plugin.js from the downloaded sources as given below.  Remember that property name used here (syntaxhl) is the plugin name used in the richtext editor configuration</p>
<pre class="brush: xml">
syntaxhl=/js/tinymceplugins/syntaxhighlight/editor_plugin.js
</pre>
<p>5) The richfaces text editor configuration should be modified as below:</p>
<pre class="brush: xml">
&lt;rich:editor id=&quot;description&quot; width=&quot;750&quot; height=&quot;250&quot; value=&quot;#{mybackingbean.description}&quot;
 theme=&quot;advanced&quot; viewMode=&quot;visual&quot;  customPlugins=&quot;rteplugins&quot; plugins=&quot;media,fullscreen,syntaxhl&quot;&gt;
          &lt;f:param name=&quot;theme_advanced_buttons1&quot;  value=&quot;code,bold,italic,underline,fullscreen,justifyleft,justifycenter,justifyright,
                                    fontselect,fontsizeselect,styleprops,tablecontrols,syntaxhl,
                                    search,replace,selectall,media,forecolor,backcolor,cut,copy,paste&quot;/&gt;
          &lt;f:param name=&quot;theme_advanced_toolbar_location&quot; value=&quot;top&quot; /&gt;
          &lt;f:param name=&quot;theme_advanced_toolbar_align&quot; value=&quot;left&quot; /&gt;
          &lt;f:param name=&quot;extended_valid_elements&quot; value=&quot;pre[name|class]&quot;/&gt;
 &lt;/rich:editor&gt;
</pre>
<p>Note: parameter &#8216;extended_valid_elements&#8217; identifies valid tags that can be present in the text in raw HTML form.</p>
<p>Well now you are ready to use the rich text editor to contain code snippets. Lets also try to look at how to view code in highlighted format in the next tip.</p>
]]></content:encoded>
			<wfw:commentRss>http://myblog.shriharisc.com/2009/09/12/adding-code-syntaxhiglighter-plugin-to-richfaces-text-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
