MediaWiki:Xwiki/Plugins

From wiki
Jump to: navigation, search

Adding Plugins to the Toolbar


This brief example shows how to add or remove plugins from the WYSIWYG editor's toolbar. The current plugins to be added will be the 'justify' and 'color' plugins.


Locate and edit the templates/macros.vm file under the $TOMCAT_HOME/webapps/xwiki directory.


Use your favorite editor; in the demonstrations' case I will be using the nano editor that can be installed with any version of UNIX operating system.


Press ^W in order to access the search mode and type 'plugins' then hit Return:


Plugins.png


Add 'justify' and 'color' to the plugins section and add each toolbar feature to the toolbar section located just under the plugins section. The current toolbar items are: backcolor, forecolor | justifyleft, justifycenter, justifyright, and justifyfull:


Pgedit.png Pgtoolbar.png


Example Changes


Change:

plugins: '$xwiki.getXWikiPreference("wysiwyg.plugins", "submit line separator text list/
indent history format symbol link image table macro importer#if($full && $request.sync)/ 
sync#end")',

To:

plugins: '$xwiki.getXWikiPreference("wysiwyg.plugins", "submit line separator text color/
list indent history format symbol link image table macro importer#if($full && /
$request.sync) sync#end")',

Also change:

toolbar: '$xwiki.getXWikiPreference("wysiwyg.toolbar", "bold italic underline /
strikethrough | subscript superscript | unorderedlist orderedlist | outdent indent | undo/
redo | hr symbol")',

To:

toolbar: '$xwiki.getXWikiPreference("wysiwyg.toolbar", "bold italic underline /
strikethrough | subscript superscript | unorderedlist orderedlist | outdent indent | undo/
redo | hr symbol | backcolor  forecolor | justifyleft  justifycenter  justifyright  /
justifyfull")',


Removing Plugins from the Toolbar


This can be essentially done by doing the reverse or reciprocal of the above. By removing the equivalent plugin and toolbar items the menu can completely be 'leaned' out according to what is desired.


Example


By undoing what was done above the 'color' statement gets removed from the plugins section and as such the 'backcolor' and 'forecolor' statements from the toolbar section. This provides us with the same unchanged code above:

plugins: '$xwiki.getXWikiPreference("wysiwyg.plugins", "submit line separator text list/
indent history format symbol link image table macro importer#if($full && $request.sync)/ 
sync#end")',
toolbar: '$xwiki.getXWikiPreference("wysiwyg.toolbar", "bold italic underline /
strikethrough | subscript superscript | unorderedlist orderedlist | outdent indent | undo/
redo | hr symbol")',




More information about the current plugins available can be found here at the Xwiki website.