Thanks for the answers! Regards: Norbi 2010.01.30. 11:46 keltezéssel, Marius Dumitru Florea írta: > Hi Norbert, > > Norbert Sándor wrote: > >> Hello, >> >> I'm experimenting with the RichTextArea (RTA) in a separate application, >> not in XWiki. >> I checked out the xwiki-gwt-dom and xwiki-gwt-user, and RTA seems to >> work well. (Until now I've created only a small demo application, with >> an RTA and some buttons to execute various commands.) >> > Cool! > > >> My questions are: >> >> 1. Pressing ENTER creates a BR element by default, is it possible to >> create a P instead? >> > AFAIK there's no built-in command (like insertbronreturn) to trigger > this behavior. We have written a RTA plugin for this, which you can find > at http://tinyurl.com/yacr2l8 . All RTA plugins are for the moment in > platform/web/wysiwyg module. The line plugin is pretty much generic so > you could try to reuse it. > > >> (The behaviour of the ENTER key inside a P can be set by executing >> the insertbronreturn command, but the default document always >> contains a BR, and if I set the initial content to<p></p>, I >> cannot navigate the cursor inside the P...) >> > You can place the caret inside the empty paragraph using the selection > API but you have to make sure the user can't leave the body element > empty (e.g. in Firefox if the user selects all content and deletes it > you're back to the initial BR). > > >> 2. Is there a way to listen to selection events? >> (I want to enable/disable some buttons based on the current >> selection.) >> > Unfortunately no. AFAIK only IE has a native event for selection change. > We overcome this by listening to key up, mouse up and command events > on the RTA. You can take a look at http://tinyurl.com/yas4fxn . > AbstractStatefulPlugin listens to this events and schedules updates of > its state using a DeferredUpdater (only the most recent update is > executed). In our editor we adopted this strategy: each plugin is > responsible for updating its state (e.g. detect bold style) and the > editor is responsible to enabling/disabling features based on some rules. > > >> 3. Are there any extensions to the default RTA in the other parts of >> XWiki? >> (I mean for example commands and controls for editing TABLEs >> visually, toolbars that are enabled/disabled based on the content >> of the RTA, etc. - I haven't looked at all the source code yet, >> it's huge :) >> > platform/web/wysiwyg module contains plugins built on top of the RTA > (from xwiki-gwt-user module) and they use the DOM and Selection API from > xwiki-gwt-dom module. Some of the plugins overwrite the default RTA > commands with their improved version. For instance TextPlugin ( > http://tinyurl.com/y8eoh2f ) registers custom executables for default > RTA command like bold and italic. In the same way FormatPlugin > overwrites the removeformat command. Most of this plugins are generic. > Some are XWiki specific: link, image, import and macro. > > We have a table plugin, but it offers basic features like insert row > after or delete column. > > Hope this helps. > Marius > > >> That's for a starter :) >> Thanks for your help in advance! >> >> Best regards: >> -- >> Norbert Sándor >> http://jvminside.blogspot.com/ >> _______________________________________________ >> devs mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/devs >> > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.733 / Virus Database: 271.1.1/2655 - Release Date: 01/29/10 > 10:08:00 > >
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

