(redirecionado de Necromonger.RichEditors)
The idea is also not so new to the community, as many have tried and succeded at making a recipe for the integration of different RTEs to PmWiki in varied ways.
Some recipes were more verbose than others, some required a few dependencies, but I tried as hard as I could to find the simplest and smallest solution possible, to also follow the wiki way of doing things.
From the day I decide to do the recipe till now, I tried different approaches to the problem, studied some of the approaches posted on PmWiki site, and finally I believe I have found
the definitive a good solution for the problem, at least in theory.
From the beginning I knew that it would be something difficult for me to do, for my capacities are somewhat limited... By ignorance, and that I needed all the help I could get, and all the options, that all the parts involved could offer me.
So I decided that I would use TinyMCE as it has many features and configuration options.
It's so simple, next to everything I tried before.
It involves creating BBCode markup that corresponds to html markup, so we don't have to live with with raw html markup mixed with the gracious PmWiki markup, in the same wikipage.
For that we configure BBCode markup to match html markup. Something more or less like this:
<a> - [a]Text[/a] or [url]Text[/url] <span> - [span]Text[/span] or [line]Text[/line] <div> - [div]Text or markup[/div] or [block]Text or markup[/block] <table> - [table] .. [/table] <tr> - [tr] ... [/tr] or [cellrow] ... [/cellrow] <td> - [td] ... [/td] or [cellcol] ... [/cellcol]
And so on...
It will not only map html markup to BBcode markup but at the same time, expand the PmWiki markup set to accept constructs in html that have no correspondency in actual PmWiki markup, making the inclusion of BBCode markup to PmWiki necessary for a proper integration of the capacities of RTEs with html to PmWiki and the markup set.
Using ROE and ROS patterns, we translate back and forth both markups.
With ROE, we translate from a raw wikipage, only the BBcode markup to html and put the result inside a RTE window for manipulation.
With ROS, we translate the wikipage with raw html, manipulated by a RTE, back into BBcode markup and then we save the page.
The only new part of this solution, for me and I believe the community, is the BBCode part, that will make a representation of html elements, without tainting the PmWiki markup set and not defying some of the purposes of NOT using raw html markup directly into PmWiki pages. That are security and fine control, and also an item or two from the PmWiki philosophy.
The bbcode markup can be made in a way to reject or allow some of the attributes of html/xhtml/html5 markup easily, and also makes it easy to create ROS and ROE patterns to do the necessary translation between markups (PmWiki/html).
On the BBcode side as a replacement to html event attributes, we could have an attribute perhaps called "event" that enables the same functionality in a controlled way.
For instance we could have:
[url event=onclick.fade]Text[/url] [url event=ondblclick.animate1]Text[/url] [url event=onmouseover.decorate]Text[/url]
On the RTE side a recipe could be made to acomodate selectable event actions from a pull down list.
Also, that solution will make possible and secure, to have more markup available and be able to use a Rich Text Editor concomitantly with PmWiki's standard editor, without any problems.
I believe that this will make possible to integrate ANY RTE with pmwiki.
As a bonus from my previous choices, TinyMCE has an option for treating all the editor window as pre-formated text and the HTML tags will be treated differently. This removes the necessity of enclosing PmWiki markup in pre tags, you can see it here.
The same effect can be used with the css propertie
white-space:pre; in the parent window of any RTE editor and
white-space:normal, for all other html tags inside the window.
Soon enough I'll put myself to work on this, as I'm excited to do it and also meet the expressed desire from the community, recently on the list, for a simple solution for this problem.
The thing is that I don't know exactly how PmWiki will treat BBCode markup, and how we will have to include the BB markup in the ruleset, so it doesn't get too much interference from other rules, tags we don't want to deal with, vspace, or <p> tags included or wrapping the BB/html tags.
The RTE window using white-space:pre will bring trouble too as space between paragraphs will be treated as newlines or <br>, and space will be seen in the RTE window but not when you see the saved results.