Wed 1 Nov 2006
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.
RSS feed for comments on this post. TrackBack this post
November 1st, 2006 at 5:50 pm
the demo page/test file won’t be accessible until tomorrow
November 1st, 2006 at 5:53 pm
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 Edi…
November 3rd, 2006 at 2:19 pm
What’s with a custom itemset for each Editor2 instance. The following code isn’t working:
var editorArgs = {
inheritWidth: true,
items: ["bold", "italic", "underline", "strikethrough"]
};
var editor = dojo.widget.createWidget(”Editor2″, editorArgs, e.currentTarget);
November 3rd, 2006 at 2:56 pm
That was with old Editor2 in dojo 0.3.x
With the new one in 0.4.x, you have to customize the default template file for the toolbar to specify which buttons/items you want
November 3rd, 2006 at 3:05 pm
… i guess that means that i can’t set a custom template for each editor instance…
November 4th, 2006 at 12:04 am
not the case if you use latest trunk (which will soon become dojo 0.4.1): I fixed that in dojo trunk as well
In fact, in the nightly demos, you can noticed that the toolbars in the page are not the same.
November 6th, 2006 at 10:14 am
Thanks for the feedback!
Apparently the savebutton of the template isn’t working (it’s commented in the distribution):
DEBUG: dojo.widget.Editor2ToolbarItemManager.getToolbarItem: Unknown toolbar item: save
Are there workarounds/fixes?
November 6th, 2006 at 2:15 pm
try to enable SimpleSignalCommands plugin and look at the comment in it
November 15th, 2006 at 2:54 pm
haven’t tried that.. added my own custom button. Everything works fine now… thanks again!
December 5th, 2006 at 2:44 pm
Hello Cougar,
I extended your Editor2-widget to support adding of options to a custom drop-down field and hiding/showing this select-box.
I used inheritance to define my own Editor2Vis.
It works fine in FF2 but not in IE6.
Do you have any Idea what the problem is?
Thanks a lot!
Ralf
****************
dojo.provide(”dojo.widget.Editor2Vis”);
dojo.require(”dojo.lfx.toggle”);
dojo.require(”dojo.widget.*”);
dojo.require(”dojo.widget.Editor2″);
dojo.widget.defineWidget(
“dojo.widget.Editor2Vis”,
dojo.widget.Editor2,
{
// Object: dojo.uri.Uri object to specify the template file for the toolbar
toolbarTemplatePath: dojo.uri.dojoUri(”src/widget/templates/EditorToolbarVis.html”),
findToolbarItem: function(/*String*/itemName)
{
//debugger;
var nodes = dojo.html.getElementsByClass(”dojoEditorToolbarItem”, this.domNode/*, this.itemNodeType*/);
this.items = {};
for(var x=0; x
December 5th, 2006 at 2:47 pm
…continued…
for(var x=0; x
December 5th, 2006 at 2:49 pm
ha, it doesn´t like the <nodes… part
October 11th, 2007 at 11:20 pm
Xanax without prescription….
Xanax no prescription overnight delivery. Buy xanax without prescription in usa. Buy xanax no prescription. No prescription xanax generic….