cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <ajuf...@sun3.oulu.fi>
Subject Re: Using textarea WYSIWYG editors?
Date Wed, 08 Jul 2009 06:00:29 GMT
Derek Hohls wrote:
> Hmm.  I did follow the instructions and was unable to get the
> toolbar to display.  Do you have any working/sample code that
> I can try on my side?

This is what I have in the final HTML send back to the client:

<script type="text/javascript">
   _editor_url  = "xinha/";
   _editor_lang = "en";
   _editor_skin = "silva";
</script>
<script type="text/javascript" src="xinha/XinhaCore.js"></script>
<script type="text/javascript"
   src="resource/external/xinha/config.js">
</script>
<script type="text/javascript">
   dojo.addOnLoad(function() {
    var instructions = document.getElementById('instructions');
    var node = document.getElementById('sopInstructions');
    instructions.value = node.innerHTML;
   });
</script>


The 'instructions' represents the piece of XHTML that is being edited. I 
use Dojo 1.2 to insert XHTML into the xinha editor (and to create the 
user interface). The 'instructions' also appear in 'config.js', which 
looks like:


xinha_editors=null;
xinha_init=null;
xinha_config=null;
xinha_plugins=null;
xinha_init=xinha_init?xinha_init:function()
{
   xinha_editors=xinha_editors?xinha_editors:["instructions","anotherOne"];
 
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","ContextMenu","SmartReplace","Stylist","Linker","SuperClean","TableOperations"];
   if(!Xinha.loadPlugins(xinha_plugins,xinha_init))
   {
     return;
   }

   xinha_config=xinha_config?xinha_config():new Xinha.Config();
   xinha_config.pageStyleSheets=[_editor_url+"Xinha.css"];
   xinha_config.getHtmlMethod="TransformInnerHTML";

   /*xinha_config.htmlRemoveTags=/br/;*/

 
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
   Xinha.startEditors(xinha_editors);
}
Xinha.addOnloadHandler(xinha_init);


That's it. The rest of xinha is placed in a separate jar. In the sitemap 
I also have:

<map:match pattern="xinha/**">
  <map:read src="resource://xinha/{1}" />
</map:match>

which is placed AFTER

<map:match pattern="resource/external/**">
   <map:read src="resource/external/{1}"/>
</map:match>

to ensure that my config.js is used. I use cocoon 2.2, I should note.

The fact that the toolbar does not show up in your case may be caused by 
something else and has probably not so much to do with xinha itself. 
Besides xinha, do you rely on other portions of javascript that possibly 
interferes with the xinha javascript.

Hope this helps,
Andre

> 
> Thanks
> Derek
> 
>>>> Andre Juffer <ajuffer@sun3.oulu.fi> 07/07/09 1:59 PM >>>
> Derek Hohls wrote:
>> (with Cocoon 2.1.8 and higher)
>>
>> Given that htmlArea is no longer under development, does anyone have some working
example of other editors?  I have tried both xinha and tinymce and cannot get either to work...
> 
> I am using xinha and I can store the XHTML into a native XML database 
> and also place retrieved XHTML back into the editor. I have simply 
> followed the instructions on the xinha website. You should have be sure 
> that the editor returns XHTML (there is setting for this in xinha).
> 
> There is also an editor available in Dojo toolkit. I have not tried that 
>   one.
> 
>> Thanks
>> Derek
>>
> 
> 


-- 
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juffer@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StruBioCat                   | WWW: www.strubiocat.oulu.fi
NordProt                     | WWW: www.nordprot.org
Triacle Biocomputing         | WWW: www.triacle-bc.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message