Login Register

Latest improvements in the Editor2

Some improvements are just committed to dojo Editor2 in trunk. Although dojo 0.4.1 release (which is the trunk will be) generally should not break API compatibilities, as these changes only affect the new part of the Editor2 API (compared to 0.3.1 Editor2), and which is just released with dojo 0.4.0 one week ago, so we decided that an exception can be made for the Editor2 in this case.

As dicussed in my previous blog, some significant modification are merged in with the patch. I will briefly go through the steps required to port an Editor2 plugin written for 0.4 to the latest trunk format, then state other improvements introduced with this commit.

Porting External Commands from 0.4 format to trunk format

The constructor has a new parameter (now the first one), editor, that specifys which editor this command is associated with. In the command class, this._editor can be used to access this associated editor.

dojo.widget.Editor2Manager.registerCommand is removed, while dojo.widget.Editor2Manager.registerHandler should be used instead. Please have a look at the modification to dojo.widget.Editor2Plugin.FindReplace for details.

Signature of dojo.widget.Editor2Manager.getCommand() is changed as well. Now Editor2.getCommand() should be used to replace any old references to dojo.widget.Editor2Manager.getCommand (If you want to find a command in the currently focused instance of Editor2, call dojo.widget.Editor2Manager.getCurrentInstance() first to get the editor and then call getCommand() on it)

Improved shared Toolbar Support

The original implementation of shared toolbar in Editor2 does not allow sharing more than one toolbar in the same page: if you have 4 instances of Editor2 in a page, and want the first two share one toolbar while the other two share another one, it is not supported.

Along with fixing bug #1505, now this is fully supported (see demo). Each Editor2 instance may belong to a toolbar group. A new string property in Editor2 is introduced, called toolbarGroup, which specifys the toolbar group name. All the Editor2 instances with the same toolbarGroup share the same toolbar (the toolbar is created as child of the first instance of Editor2 within this share group, and this first instance should be last destroyed.)

If toolbarGroup is empty (the default), then the toolbar for this Editor2 instance is standalone (won't be shared with others). As a result, shareToolbar (of type boolean) is now deprecated in favor of this more powerful sharing mechanism.

New shared Context Menu Support

Sharing of Context Menu is now possible, in addition specifying different menu content for different Editor2 instances is also made available. For more details please read the inline doc, and try the test page out.

Due to lacking of shared support, the context menu used to be per instance. Now different Editor2 instances share the same Context Menu object if they use the same set of menu content.

Other minor changes

Property of focusOnLoad in RichText widget is now set to false, rather than true. If you want to focus one instance of Editor2 on page load, you have to set focusOnLoad to true on it.

the demo page/test file

the demo page/test file won't be accessible until tomorrow

Hi Team Dojo, I looked for

Hi Team Dojo, I looked for what Dojo meant at wikipedia and then understood the Japanese Martial arts angle: "place of the Way". Much like "Home of The Force" ? So, why not just write that on the wiki (I'm assuming the jotspot wiki FAQ is the current maintained one) - adds a nice hacker-fantasy angle :-) Everyone is not as inclined to open another tab and search wikipedia for "Dojo" - (er.... a usability issue ? ;-) just kidding, of course ) And surely you've discussed over "Dynamic Opensource Javascript Objects"? or maybe "Distributed Opensource Javascript Objects"? or maybe "Delightfully Original Juicy Oranges"? ok ok I think that shoudl be enough rambling. Great job, folks! Thanks for a great set of oranges :-). Very very juicy :-) Joe PS: Howz this: "Dummy/Dumbo Oriented Javascript OO/Objects" ..... since all we developers have got to do is reuse with a little glue code. :-)

In this test there is a bug,

In this test there is a bug, not works in the toolbar the icon "InsertImage" , after i added the: dojo.require("dojo.widget.Editor2Plugin.InsertImageDialog"); it not works too.. any help ? Thanks a lot Mike

Does Editor2 provide a

Does Editor2 provide a programmatic way to insert text/html, other than an image or table via the dialogs, at the last known caret position and/or to replace the last known selected text?