August 2006


Finally, as no one expressed concerns in the mailing list, I just had my work of the enhanced editor2 widget merged into svn. You should be able to use it without any effort: just a svn up should bring you up-to-speed with the latest extensible version of Editor2. And you should be able to test it in the nightly build of dojo as well (of course you have to wait until tomorrow for that).

I admit the committed version has a very limitted toolbar, which lacks a lot compared to the FCKeditor one I ported for testing purpose. I think I can add more buttons to the standard toolbar as a reference of how to use all the available features.

Along the way, I also fixed more than 5 bugs filed on Editor2 (including the old Editor).

Although committed, I still feel not so comfortable with the dialog loading system. I will try to come up with a better approach and migrate the existing dialogs to that. On the other hand, some usability issues will be sorted out: such as warnings for the cut/copy/paste command issue in Mozilla/Firefox.

More document about how to use/customize and extend the editor is required as well. I already started a page in the dojo wiki, but for now it is only meant to be a placeholder ;)

If you are interested in extending the new editor2, you can look at the built-in plugins. Currently we already have 5 of them, which should cover all the possible ways of extending the editor2: add new commands, add new toolbar items, add new context menu items and change behaviors of the toolbar. They also demonstrate how to write a popup dialog for the editor2. However, as I mentioned in this post, the integration of the dialog support will likely to be change in near future to a better/more dojo-ish way.

Not all the 5 plugins are loaded by default: only the contextmenu plugin is loaded. You can make a simple "dojo.require" to include additional plugins (before you initialize an editor2).

As this is the last week of the SoC, I feel the urgent of pushing my modification into svn trunk.

The latest patch is attached to ticket #1046. This patch is meant for merging into svn directly. Due to license incompatibility, the FCKeditor look & feel toolbar is not included in this patch: instead the original look & feel is retained and the template file is updated to work with the new editor. (So you can not see in the online demo as many functionality as before, but the code is there, just not shown in the toolbar)

The notable differences in the online demo from the svn trunk, is that the createlink and insertimage are working now. Context menu support was also added, which itself resides in its own plugin and this context menu implementation can handle plugable menu items, so that other plugins can add items to the context menu.

Unlike the previous patches, this latest patch should contain all the changes and you can apply it to the latest svn check out to try it yourself. However, due to a latest bug in the svn trunk, you may experience some errors when loading the test page. I already proposed a patch for it but still I am waiting for reviewing. Before I can commit it, please try the online demo.

As my primary mentor for the SoC task is moving house and has no time so far to review my patch, we have to wait longer before this can be merged into svn trunk. Meanwhile, implementing the remaining functionalities kept my busy.

This time, all the buttons (except the anchor button) in the online demo toolbar should actually do something. Most notably, the insertimage and inserttable buttons are working with full undo support in FF and activeX mode IE. In addition, the find dialog works in IE as well (FF is already supported).

Other changes are already merged into the RichText widget in dojo svn:
  • More activex mode IE support was added: strikethrough and inserthorizontalrule commands are implemented
  • Pre content filter support is added
  • Pre/Post DOM filter support isadded, which take a dom node as the parameter instead of a string
  • External style sheets loading is implemented: now it is possible to customize the editing area appearance with external css files

This week the first patch intended to be merged into svn was released for review. The patch has already implemented all the necessary infrastructures needed to make editor2 widget in dojo an extensible WYSIWYG editor.

The plan for next week is to have the first patch merged into svn and try to implement context menu support (which could be done in a plugin). In addition, I would also look into improve current available commands.

The patch for enhanced editor2 for dojo with all the infrastructures finished is just merged to the online demo (The patch does not contain all the files to run the online demo, as it only contains text modifications). By infrastructural, it is meant that all the basic frameworks to make an extensible/flexible Editor2 (along with Editor2Toolbar) are in place, but not all the features are implemented, although the current feature set is already a super-set of the original Editor2.

The infrastructures include:

  • Extensible command
  • Flexible/Extensible toolbar item
  • Plugins support for Editors, in which Command/Toolbar Item can be defined
For each of the above mentioned items, several implementation is in place:
  • Browser built-in commands are almost covered
  • Complex toolbar items, such as dropdown menu (like the one in FCKeditor) are realized. In addition, popup windows (dialogs, in fact, they are FloatingPanes) are introduced as well: the createlink button is an instance of this. (yes, insert/edit link should work ok now)
  • Three plugins are written to demonstrate how to hook additional commands/toolbar items to the editor, which include:
    • AlwaysShowToolbar: fully implemented, replace the original built-in feature of Editor2
    • ToolbarDndSupport: demonstrating plugin, lack some features, but DnD is working as expected (in the online demo, this plugin is disabled)
    • FindReplace: this plugin implements the Find and Replace commands and toolbar items. Find has a primitive implemented FF, while IE Find support and Replace haven’t been achieved yet. This plugin also demonstrate how to popup a none-modal dialog to ask users for more information.

The only missing feature planned for this enhanced editor2 is context menu support. I’d like to have this patch reviewed and committed into svn before trying to implement that.

Other changes include migrating selection manipulation in RichText to dojo.html.selection and improved the latter one. These code has already been committed into svn.

Currently, the plugins are located at src/widget/Editor2Plugin dir and template files for Editor2 are placed in src/widget/template/Editor2.

As the theme shown in the demo was ported from FCKeditor, which has no chance to be merged in to dojo svn due to license incompatibility, I will have to write a new one instead, or rather porting the original template file/css file. (This is only meant for review purpose, and the theme I will commit would be our own.)

Feedback and suggestions are welcome.

This week, I advanced in the enhanced editor direction further (see latest online live demo):

  • A new look and feel of the toolbar is ported from FCKeditor.
  • Fontsize/Fontname and blockformat can be set/displayed correctly now.
  • A new feature, DND support in the toolbar was also introduced (meanwhile I improved the dnd code in dojo as well): now you can drag the handler in the toolbar to move it. It would be good to be able to drag individual buttons/items in the toolbar as well, but this will be delayed until I implement storing the order of the toolbar and restoring the order from saved information.
  • Plugin framework is largely done, but need more testing and more plugins.
  • Implemented first plugin for the Editor: AlwaysVisibleToolbar which contains the code originally in the editor source code.

Next, I plan to do the following things (ordered based on priority):

  1. Migrate all the selection manipluation code in editor2/richtext to use dojo.html.selection
  2. Make use of Dialog widget for commands which require more options, such as inserting links/tables.
  3. Move DND support into separate plugin and support DND of individual toolbar items. Figure out a way to store/restore the order of toolbars/items. Implement a button to enable/disable DND support in the toolbar. Figure out a way to clean up the DND code when not required.

The IE undo issue under none-activeX mode and the htmltoggle issue need to be sorted out as well.

As plugins for Editor2 will be committed into svn, each of which is a separate file, I’d like to propose a directory rearrangement: like the case in treev3, I’d like to create src/widget/Editor2 to hold all the Editor2 related stuffs, such as Editor2.js, Editor2Toolbar.js, and a sub dir Plugins to hold all the built-in plugin files. The same goes for a new dir tests/widget/Editor2.