Forum OpenACS Development: Supporting tinymce in xowiki

Collapse
Posted by Dave Bauer on
I am looking into supporting tinymce. I have it working for acs-templating in general integrated with the new Zen master templates.

I updated the new simplified file/link/image plugins I wrote with it.

I would also like to be able to configure xowiki to use it. It should replace all of the uses of xinha except for the stylist plugin which doesn't seem to have a replacement for tinymce (although it should be possible to create one.)

It looks like what would be needed is two parameers, one for the richtext editor to use, and one for the list of plugins to load.

I am going to test out this theory and see how far I get.

The reason to use TinyMCE is 1) it does not break the back button and 2) It reportedly can produce valid xhtml.

Collapse
Posted by Nima Mazloumi on
How extensible and modular is it? With xinha you can configure the toolbar for instance.
Collapse
Posted by Dave Bauer on
TinyMCE appears to be as extenible and configurable as Xinha, but better maintained, and the code is much easier to read and understand.
Collapse
Posted by Gustaf Neumann on
is your intention to replace xinha completely by TinyMCE?

why new parameters. you should be able to use {options {editor EDITOR plugins {YOURPLUGINS}} in the richtext widget.
https://openacs.org/api-doc/proc-view?proc=template%3a%3awidget%3a%3arichtext

what is the problem with the back-button in xinha? OpenACS 5.3.1 uses HTML 4.01 Transitional, not xhtml.

Collapse
Posted by Dave Bauer on
Gustaf,

I would like to make tinymce an option alongside xinha. I'd like it to be consistent with xowiki and the rest of the richtext areas across the site. To do that I'd need to change the code that generates the form in xowiki-form-procs.tcl It seems pretty easy to do that flexibly.

The back button problem is subtle. If you are editing content and for exmaple, you browser session expires. You may be reidrected to login when you submit the form. In xinha, if you then hit the back button to go back to the screen to edit the content, the xinha textarea is empty.

TinyMCE handles this correctly. I submitted a bug for Xinha but it has not been fixed yet.

Collapse
Posted by Dave Bauer on
I just changed this line of code:

{text:richtext(richtext),nospell,optional
{label #xowiki.content#}
{options {editor [parameter::get -parameter "RichTextEditor" -p\
ackage_id [apm_package_id_from_key "acs-templating"] -default "xinha"] plugins {
[parameter::get -parameter "XowikiXinhaDefaultPlugins" -default [parameter::get\
_from_package_key -package_key "acs-templating" -parameter "XinhaDefaultPlugins\
"]]

to check the acs-templating parameter instead of always using Xinha. Perhaps we need an expression in there to fallback to xinha or tinymce if RTE is choosen? How many people are still using RTE?

I guess it would make sense to change the parameters form XinhaDefaultPlugins to RichtextEditorDefaultPlugins? I will look into documenting the available plugins and choosing defaults for TinyMCE as well.

Collapse
Posted by Tom Jackson on
I can't add anything intelligent to the discussion about xinha or TinyMCE, but anyone considering XHTML should read this:

http://www.hixie.ch/advocacy/xhtml

The conclusion is that producing valid XHTML is nearly useless, and I would argue that in the context of OpenACS or any similar application which displays user supplied markup, it is impossible to do it.

Collapse
Posted by Dave Bauer on
I have a request from a client to make the entire config object for TinyMCE available as a parameter.

I think it makes sense to modify the Xinha support to work in a similar way, instead of having a parameter for each seperate attribute of the config object. Right now Xinha config has two parameters, for plugins and toolbar buttons.

The basic structure would be a tcl list in array format of the attribute name and value.

I decided on a list after noticing that the current xinha support allows overriding the config with a parameter passed to the ad_form element delcaration. This way it would be possible to override the default config attributes on an individual basis for one richtext element by specifying a list of attribute names and values for that element. Then when the richtext widget is created it will be posible to loop through the default config and replace any overridden attributes with the element specific ones.

I should have an implementation of this by the beginning of next week, for review.

If anyone has a better idea please share. This seemed like the most flexible way to handle it that supports the current richtext requirements and allows more general support for TinyMCE and Xinha.

Collapse
Posted by Dave Bauer on
Hey everyone,

I got Tinymce 2.1.3 working on HEAD (can merge into 5.4 if people want).

BUT

Because tinymce requires a little different style of configuration, I really want to put the entire config object in a parameter, instead of just the plugins.

I can reuse the XinhaDefaultPlugins parameter and just stick the config into that.

Alternatively I cna adda new paremter

RichtextConfig or someting along those lines.

For now we have a reasonable deafault setup that seems to work ok.

I am checking in the code to HEAD using XinhaDefaultPlugins as the parameter for now.

Collapse
Posted by Gustaf Neumann on
If people want to switch between Xinha and tinymce, it looks as a bad idea to use the same parameter with different content for Xinha and TinyMCE. How about introducing a parameter TinyMCE_Config?
Collapse
Posted by Don Baccus on
I agree with Gustaf.
Collapse
Posted by Emmanuelle Raffenne on
Hi Dave,

I had a look at TinyMCE and I liked it a lot, nice work!. I had to tweak it a bit to make the "openacs" theme work on HEAD (committed) but couldn't make the oacsimage and oacslink plugins work. It will need some HTML strict cleanup too.

Tinymce on HEAD is version 2.1.3, the last one available is 3.1.1. I think we should upgrade, I can help with that. Right now, only english is available but if we upgrade, we'll be able to provide all the available languages (http://services.moxiecode.com/i18n/). The downside is that the API has changed in version 3.x so we'd have to adapt the oacs plugins and openacs theme, but it won't require too much effort I guess.

I agree that new parameter(s) should be created to hold the tinymce configuration. It may be worth to separate the different section of the configuration into different parameters (see http://wiki.moxiecode.com/index.php/TinyMCE:Configuration for reference): one parameter for the theme configuration, one for plugins, and one for general stuff. One might want to use the openacs theme but not the oacs plugins, in this case, the default would be kept for the theme parameters and the user would have to edit the plugins one only.