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 |
|
|
|
11 |
dojo.provide("dojo.widget.Editor2Plugin.ToolbarDndSupport");
|
|
|
12 |
dojo.require("dojo.dnd.*");
|
|
|
13 |
dojo.event.topic.subscribe("dojo.widget.Editor2::preLoadingToolbar", function (editor) {
|
|
|
14 |
dojo.dnd.dragManager.nestedTargets = true;
|
|
|
15 |
var p = new dojo.widget.Editor2Plugin.ToolbarDndSupport(editor);
|
|
|
16 |
});
|
|
|
17 |
dojo.declare("dojo.widget.Editor2Plugin.ToolbarDndSupport", null, {lookForClass:"dojoEditorToolbarDnd TB_ToolbarSet TB_Toolbar", initializer:function (editor) {
|
|
|
18 |
this.editor = editor;
|
|
|
19 |
dojo.event.connect(this.editor, "toolbarLoaded", this, "setup");
|
|
|
20 |
this.editor.registerLoadedPlugin(this);
|
|
|
21 |
}, setup:function () {
|
|
|
22 |
dojo.event.disconnect(this.editor, "toolbarLoaded", this, "setup");
|
|
|
23 |
var tbw = this.editor.toolbarWidget;
|
|
|
24 |
dojo.event.connect("before", tbw, "destroy", this, "destroy");
|
|
|
25 |
var nodes = dojo.html.getElementsByClass(this.lookForClass, tbw.domNode, null, dojo.html.classMatchType.ContainsAny);
|
|
|
26 |
if (!nodes) {
|
|
|
27 |
dojo.debug("dojo.widget.Editor2Plugin.ToolbarDndSupport: No dom node with class in " + this.lookForClass);
|
|
|
28 |
return;
|
|
|
29 |
}
|
|
|
30 |
for (var i = 0; i < nodes.length; i++) {
|
|
|
31 |
var node = nodes[i];
|
|
|
32 |
var droptarget = node.getAttribute("dojoETDropTarget");
|
|
|
33 |
if (droptarget) {
|
|
|
34 |
(new dojo.dnd.HtmlDropTarget(node, [droptarget + tbw.widgetId])).vertical = true;
|
|
|
35 |
}
|
|
|
36 |
var dragsource = node.getAttribute("dojoETDragSource");
|
|
|
37 |
if (dragsource) {
|
|
|
38 |
new dojo.dnd.HtmlDragSource(node, dragsource + tbw.widgetId);
|
|
|
39 |
}
|
|
|
40 |
}
|
|
|
41 |
}, destroy:function () {
|
|
|
42 |
this.editor.unregisterLoadedPlugin(this);
|
|
|
43 |
}});
|
|
|
44 |
|