Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
dojo.provide("dojo.widget.Editor2Plugin.ToolbarDndSupport");
14
dojo.require("dojo.dnd.*");
15
dojo.event.topic.subscribe("dojo.widget.Editor2::preLoadingToolbar", function (editor) {
16
	dojo.dnd.dragManager.nestedTargets = true;
17
	var p = new dojo.widget.Editor2Plugin.ToolbarDndSupport(editor);
18
});
19
dojo.declare("dojo.widget.Editor2Plugin.ToolbarDndSupport", null, {lookForClass:"dojoEditorToolbarDnd TB_ToolbarSet TB_Toolbar", initializer:function (editor) {
20
	this.editor = editor;
21
	dojo.event.connect(this.editor, "toolbarLoaded", this, "setup");
22
	this.editor.registerLoadedPlugin(this);
23
}, setup:function () {
24
	dojo.event.disconnect(this.editor, "toolbarLoaded", this, "setup");
25
	var tbw = this.editor.toolbarWidget;
26
	dojo.event.connect("before", tbw, "destroy", this, "destroy");
27
	var nodes = dojo.html.getElementsByClass(this.lookForClass, tbw.domNode, null, dojo.html.classMatchType.ContainsAny);
28
	if (!nodes) {
29
		dojo.debug("dojo.widget.Editor2Plugin.ToolbarDndSupport: No dom node with class in " + this.lookForClass);
30
		return;
31
	}
32
	for (var i = 0; i < nodes.length; i++) {
33
		var node = nodes[i];
34
		var droptarget = node.getAttribute("dojoETDropTarget");
35
		if (droptarget) {
36
			(new dojo.dnd.HtmlDropTarget(node, [droptarget + tbw.widgetId])).vertical = true;
37
		}
38
		var dragsource = node.getAttribute("dojoETDragSource");
39
		if (dragsource) {
40
			new dojo.dnd.HtmlDragSource(node, dragsource + tbw.widgetId);
41
		}
42
	}
43
}, destroy:function () {
44
	this.editor.unregisterLoadedPlugin(this);
45
}});
46