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