After dicussion with Alex, we agreed that the commands implementation in Editor2 is not ideal. Currently, commands are global, which means all instances of Editor2 share the same command objects. As a result, for each command, it can not hold any properties which is specific to an Editor2 instance, if it wants to save such kind of information, it has to attach that it to the Editor2 itself, which is no good.

In addition to that, bug #1505 will be fixed along the way when I migrate commands to be per instance objects.

This modification will not be API compatible with previous version (0.4.0 Editor2) with regards to how external commands are handled (including registration and retrieval). This is against rules to be merged into a point release, so it can be argued that this should not be merged into 0.4.1. However, as the new Editor2 is just released with 0.4.0 (which happened one week ago), and 0.4.1 will be soon (in 2 weeks time), so I’d like to push it into trunk for it to be included in 0.4.1, but we’ll see what the consensus is.

I will probably document how to migrate Editor2 plugins from 0.4.0 format to the new one later in another post.

For reference about how to make use of the fontsize/fontname menus in the new dojo Editor2, the FCKeditor style toolbar template is attached here.

In order to make use of this, you need to:

  1. unzip the file under src/widget/templates/Editor2
  2. pass these two parameters when creating an Editor2 instance:
    toolbarTemplatePath: dojo.uri.dojoUri("src/widget/templates/Editor2/EditorToolbarFCKStyle.html"),
    toolbarTemplateCssPath: dojo.uri.dojoUri("src/widget/templates/Editor2/FCKDefault/EditorToolbarFCKStyle.css")

When setuping trac on a server, I encountered a strange issue: the python binding of subversion can not be loaded by python, I got something like this:

libsvn_ra_dav-1.so.0: undefined symbol: gss_delete_sec_context

After googling around, I found out that, someone suggested to disable neon when compiling subversion 1.4. That did do the trick, and binding works. However, with neon disabled, svn can not work with http/https repositories, which is not acceptable. So I have to find another workaround.

Google told me that gss_delete_sec_context is part of libgssapi.so, and "ldd libsvn_ra_dav-1.so.0" reveals that it does not link to any libgssapi.so at all. The obvious workaround is to explicitly specify that in the Makefile.

Edit the top Makefile in subversion 1.4.0, append "-lgssapi" to this line:

SVN_APR_LIBS = ...

(… is the actual content you will see) after installing it, everything works fine now.

It may be argued that this is not a subversion issue, rather than a neon one (it should link to gssapi). As subversion uses a bundled neon, so maybe it is more faire to call it a subversion bug.

Last night, the online shopping website of ASDA seemed to be undergoing some upgrade: the service was quite unreliable. In fact, for more than half an hour, clicking on any links on the web page did nothing.

When finally it got back to normal, seems it did not like IE any more: it was impossible for me to add any items to my shopping basket. As I had been aware that ASDA was not compatible with Firefox when checking out, I thought adding items to basket should work fine, so I opened a new tab in Firefox to access ASDA.

It turned out to work just fine under Firefox. When everything was added and we were satisfied, I just proceeded to check out under Firefox (which had not worked out of the box, I had to modify the dom tree to get ride of some broken javascript function calls to make it work). After the successful page shown up, I realized that ASDA is now compatible with Firefox, finally! That’s nifty.

Today, October 1st, is the national day of People’s Republic of China, my mother country. I don’t know how to express my emotion at this moment, but I do feel compelled to write something about this in blog to show that I am Chinese and I love my mother country from my deepest heart.

I had no idea what I could do for my country today: I am no way near of literal master to write an article about China. However, when I heard the "Today is your birthday, my China" (今天是你的生日我的中国) in a forum thread, the idea of translating the lyric to English came to me. I did try my best to translate it but please bear with my English.

(more…)

In order to support IE, which does not run reliably under linux with ie4linux, I have to stick with M$ windows when working on dojo. However, the experience with windows svn client was not pleasant: as svn+ssh protocol is used to access dojo repository (among other svn repositories I use), I had to input my password each and every time when I update/commit to it. What’s more annoying, when doing some operation, such as svn log, I am asked three times for password (or maybe twice?).

I had hoped the svn client I use, TortoiseSVN, could support Public Key Authentication for svn+ssh, just as what the svn linux client can do.

Today, I had a look at the documentation of TortoiseSVN and found out that it IS INDEED possible to configure TortoiseSVN to use Public Key Authentication. It was just my assumption, it has not implemented this support, prevented me from digging into it.

The key point is to understand this: TortoiseSVN makes use of putty behind the scenes (more specifically, it uses a derivate work of plink, a windows ssh command client). You can tell putty to login ssh with Public Key Authentication: just go to Connection -> SSH -> Auth, select the a private key file for the authentication. Under Connection -> Data, you may also fill in Auto-login username, so that you don’t need to specify the username every time you login.

If you do not already have a pair of your own private/public keys, then you may want to check out PuTTYgen and Using public keys for SSH authentication.

If you come from linux world, like me, and already have your own private/public keys, just import it with PuTTYgen and save the private key to a format putty recognize, then select this saved private key in the place mentioned before. You have to save the session under a name, such as dojo, in order to make it accessible to other ssh dependent applications, such as TortoiseSVN.

Don’t forget to add your public key to file ~/.ssh/authorized_keys in your subversion server.

After that, you should be able to ssh to your remote server without input your password. Next step is to tell TortoiseSVN to make use this Public Key Authentication. You don’t need to explicitly teach TortoiseSVN to use putty for ssh connection. All you need to do is in the checkout dialog of TortoiseSVN, instead of the normal host of the svn repository server, you just specify the session name (in this case, it is dojo). So instead of checking out dojo from this address:

svn+ssh://liucougar@svn.dojotoolkit.org/var/src/dojo/trunk

just use this:

svn+ssh://dojo/var/src/dojo/trunk

That’s all. TortoiseSVN can make use all the information you saved in that session for ssh connection, and you don’t need to type in password any more. That’s neat.

(As how TortoiseSVN knows about session saved in putty, here is my guess: putty stores all information of sessions in windows register, so that’s can be accessed by TortoiseSVN.)

After Tom reviewed the patch, I went ahead and committed the enhanced widgetsInTemplates support (which used to be called enableSubWidgets).

In my previous blog post, I introduced what the support can achieve. Here I’d like to state some limitations of this patch:

  • See the second test in the widgetsInTemplates test file: if a widget template file contains its own type of widget as a child widget (not matter directly or indirectly), it will lead to a infinite loop. It would be good to detect this, however I can not come up with a decent and fast way, so I just left it as it is.
  • This kind of syntax for widgets in template file is not supported (if this syntax is used, the widget can be rendered, but attachPoint and attachEvent won’t work):
    <dojo:button .../>
    instead, please use this syntax:
    <input dojoType="dojo:Button" .../> 
    this limitation is also due to lack of decent ways of detecting the first syntax.
Some sample of how to use this, besides the test file, includes Editor2DialogContent widget defined in Editor2.js.

When I worked on dialog support for the new Editor2 (which is already committed to dojo svn), I wanted to use other dojo widgets in the template of the various dialogs: so instead of plain checkboxes/buttons, the more eyecandy widgets in dojo could be used.

Unfortunately, no widgets in widget template was supported by then. There indeed was a patch submitted for this very issue, but no official ways to achieve that.

After invesigating the code in the patch, I decided to write my own widget to support this. I took a slightly different approach. After asking Bill to review the first draft of the widget, we decided that merging the code into the DomWidget widget (the base widget for all HtmlWidgets) directly would be better. That was the origin of the enableSubWidgets patch.

Some days later, Morris pinged me and asked whether it would be possible to add more features to the subwidgets support. As I did not foresee the requirements Morris has for the more advanced usage, it tool several days for us to discuss/understand/implement new features. The final output is that we decided to rename enableSubWidgets to widgetsInTemplates, and a new patch.

A bit of doc about this patch is provided in the ticket, which I’d like to quote here as well:

  1. It allows you to define widgets within your template markup. The feature must be enabled for the widget by defining widgetsInTemplate:true in your widget javascript (similar to how isContainer:true works)
  2. It allows you to attach those subwidgets to your widget - just use dojoAttachPoint on the widget definition node and the code does the rest of the magic
  3. It allows you to attach events from the subwidgets to your widget - just use dojoAttachEvents
  4. It allows you to ‘wrap’ subwidgets that are containers, and have the subwidget act as the container within markup e.g. if you have a TabContainer widget in a template and set dojoAttachPoint="subContainerWidget" then any child widgets (in markup only) get attached to the subwidget rather than the defined widget
The patch will be reviewed soon and hopefully it can be included into the upcoming 0.4 release of dojo.

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.

« Previous PageNext Page »