<?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>Plone Tales &#187; plone</title>
	<atom:link href="http://blog.associatie.kuleuven.be/plonetales/category/plone/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.associatie.kuleuven.be/plonetales</link>
	<description>Working with Plone related technologies at K.U.Leuven ICTS</description>
	<lastBuildDate>Tue, 13 Mar 2012 10:47:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding TinyMCE settings to your Plone package</title>
		<link>http://blog.associatie.kuleuven.be/plonetales/adding-tinymce-settings-to-your-plone-package-2/</link>
		<comments>http://blog.associatie.kuleuven.be/plonetales/adding-tinymce-settings-to-your-plone-package-2/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 11:58:27 +0000</pubDate>
		<dc:creator>Kim Paulissen</dc:creator>
				<category><![CDATA[plone]]></category>

		<guid isPermaLink="false">http://blog.associatie.kuleuven.be/plonetales/?p=43</guid>
		<description><![CDATA[It&#8217;s quite easy to customize the basic settings of Products.TinyMCE for your own setup. Most of this is already explained on http://plone.org/products/tinymce/documentation/how-to/how-to-use-genericsetup-to-export-and-import-tinymce-settings-for-a-plone-site. This is some more info on how we did it on our setup. In our case, for the K.U.Leuven, we created a package called kuleuven.tinymce using zopeskel, based on a theme package template [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s quite easy to customize the basic settings of Products.TinyMCE for your own setup. Most of this is already explained on <a href="http://plone.org/products/tinymce/documentation/how-to/how-to-use-genericsetup-to-export-and-import-tinymce-settings-for-a-plone-site" target="_blank">http://plone.org/products/tinymce/documentation/how-to/how-to-use-genericsetup-to-export-and-import-tinymce-settings-for-a-plone-site</a>. This is some more info on how we did it on our setup.</p>
<p>In our case, for the K.U.Leuven, we created a package called kuleuven.tinymce using zopeskel, based on a theme package template</p>
<pre>paster create -t plone3_theme kuleuven.tinymce</pre>
<p>Just to start with, whatever package you wish to put the  customized   settings in, you should add Products.TinyMCE as a dependency  of that   package.  Of course it&#8217;s a default dependency of Plone itself,  but for   testing purposes it should be added in the package you&#8217;re working in.</p>
<p>Setting up the dependency:</p>
<ul>
<li>setup.py: add
<pre>Products.TinyMCE</pre>
<p>to the install_requires section</li>
<li>configure.zcml: add
<pre>&lt;include package="Products.TinyMCE" /&gt;</pre>
</li>
<li>profiles/default/metadata.xml: add
<pre>&lt;dependencies&gt;
  &lt;dependency&gt;profile-Products.TinyMCE:TinyMCE&lt;/dependency&gt;
&lt;/dependencies&gt;</pre>
</li>
</ul>
<p>In this post we&#8217;ll concentrate on the changes that you can do by just  changing the default xml settings for tinymce. With these you can  already:</p>
<ul>
<li>add your own custom css classes (styles) that can be applied via the style or format dropdown in the visual editor</li>
<li>customize which buttons should be shown in the toolbar</li>
</ul>
<p>If you would like to see all the xml settings that Products.TinyMCE has:</p>
<ul>
<li>go to the ZMI of a standard Plone site</li>
<li>portal_setup &#8211; tab Export</li>
<li>select TinyMCE settings and click &#8216;Export selected steps&#8217; at the bottom of the page</li>
<li>This will save a setup_tool-somedateandtime.tar.gz file containing the tinymce.xml file to your computer</li>
</ul>
<p>An example of the default full xml, can be found as an attachment of this blog (<a href="../files/2011/10/tinymce.zip">tinymce.xml.default</a>)</p>
<h3>Adding the custom setting to your package</h3>
<ul>
<li>Make a copy of the tinymce.xml file and place this inside the profiles/default directory inside your package</li>
<li>Remove all settings irrelevant to your setup (the sections you  remove will automatically be taken from the Products.TinyMCE default  tinymce.xml file)</li>
<li>In attachtment you&#8217;ll also find an example of a full custom tinymce.xml file (<a href="../files/2011/10/tinymce.zip">tinymce.xml.kuleuven</a>)</li>
<li>Note: this file should always be called <strong>tinymce.xml </strong>in your packages<strong><br />
</strong></li>
</ul>
<h3>Adding your own styles</h3>
<p>Customizing the styles can be done via the  &lt;styles&gt; section inside the  &lt;layout&gt; section of the tinymce.xml file.</p>
<pre>&lt;layout&gt;
  &lt;styles purge="True"&gt;
    &lt;element value="Heading2|h2"/&gt;
    &lt;element value="Heading3|h3"/&gt;
    &lt;element value="Heading4|h4"/&gt;
    &lt;element value="Literal|pre"/&gt;
    &lt;element value="Blockquote|blockquote"/&gt;
    &lt;element value="Heading cell|th|"/&gt;
    &lt;element value="Lightblue row|tr|alttablecolor"/&gt;
    &lt;element value="Lightblue cell|td|alttablecolor"/&gt;
  &lt;/styles&gt;
&lt;/layout&gt;</pre>
<p>You can either add to the existing styles of Products.TinyMCE, or remove all the default ones and only set your own.<br />
To override the existing ones and just use your own styles, use the <em>purge=&#8221;True&#8221;</em> inside the styles. To add to the existing ones, set <em>purge=&#8221;False&#8221;</em>.<br />
You can adjust the section &lt;tablestyles&gt; in the same way.</p>
<h3>Hiding/showing buttons</h3>
<p>Customizing which buttons to show can be done via the &lt;toolbar&gt; section the tinymce.xml file.</p>
<pre>&lt;toolbar&gt;
&lt;toolbar_anchor value="True"/&gt;
&lt;toolbar_hr value="True"/&gt;
&lt;toolbar_cut value="True"/&gt;
&lt;toolbar_paste value="True"/&gt;
&lt;toolbar_justifyleft value="True"/&gt;
&lt;toolbar_justifright value="True"/&gt;
&lt;toolbar_justifycenter value="True"/&gt;
&lt;toolbar_inserttime value="False"/&gt;
&lt;toolbar_tablecontrols value="True"/&gt;
&lt;toolbar_undo value="True"/&gt;
&lt;toolbar_redo value="True"/&gt;
&lt;toolbar_image value="True"/&gt;
&lt;toolbar_save value="True"/&gt;
...
&lt;/toolbar&gt;</pre>
<ul>
<li>For every button you want to <strong>show</strong>, give it a <strong>value=&#8221;True&#8221;</strong> in the xml.<br />
For every button you want to<strong> hide</strong> from the toolbar, give it a <strong>value=&#8221;False&#8221;</strong>.</li>
</ul>
<p>The purge setting for this hasn&#8217;t been tested by us, however you  might want to be careful setting it, since you need to set the default  setting for each button separately. If you want to hide a button that&#8217;s  shown by default, you need to remove the default button (which has the  value=&#8221;True&#8221; setting- and addthe button in your custom list with the  value=&#8221;False&#8221; setting. In combo with purge=&#8221;False&#8221; you would just have  both buttons, each with a different value, and that value can&#8217;t be true  and false at the same time. Hope this makes sense, but feel free to test  it and correct me if I&#8217;m wrong.</p>
<p>We just added all buttons again, and set the value of each one according to our preference.</p>
<h3>Plone Control Panel options and an easy export of customized settings</h3>
<p>The reason we made our own package including these settings, is that  we needed to have the same settings installed over dozens of Plone  sites. If you have only one site, you can just adjust all this via the  TinyMCE section in the plone_control_panel.</p>
<p>If you decide later that you do want to have the same tinymce  settings on several sites, you can just export the settings you did in  the plone_control_panel.</p>
<ul>
<li>go to the ZMI &#8211; portal_setup &#8211; tab Export</li>
<li>select TinyMCE settings and click &#8216;Export selected steps&#8217; at the bottom of the page</li>
<li>This will save a setup_tool-somedateandtime.tar.gz file containing the tinymce.xml file to your computer</li>
<li>copy this file to your package (profiles/default or upgradeprofile)</li>
</ul>
<p>If you&#8217;re used to working with GenericSetup: you can also just make a  compare of xml differences using the Snapshots and Comparison tab in  the portal_setup, to help with deciding which sections you actually need  in your own tinymce.xml. More info on this can be found at <a title="Compare xml" href="http://plone.org/documentation/kb/genericsetup/exports-snapshots-and-comparisons" target="_blank">http://plone.org/documentation/kb/genericsetup/exports-snapshots-and-comparisons</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.associatie.kuleuven.be/plonetales/adding-tinymce-settings-to-your-plone-package-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
