Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Details | Compare with Previous | 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.SimpleSignalCommands");
14
dojo.require("dojo.widget.Editor2");
15
dojo.declare("dojo.widget.Editor2Plugin.SimpleSignalCommand", dojo.widget.Editor2Command, function (editor, name) {
16
	if (dojo.widget.Editor2.prototype[name] == undefined) {
17
		dojo.widget.Editor2.prototype[name] = function () {
18
		};
19
	}
20
}, {execute:function () {
21
	this._editor[this._name]();
22
}});
23
if (dojo.widget.Editor2Plugin["SimpleSignalCommands"]) {
24
	dojo.widget.Editor2Plugin["_SimpleSignalCommands"] = dojo.widget.Editor2Plugin["SimpleSignalCommands"];
25
}
26
dojo.widget.Editor2Plugin.SimpleSignalCommands = {signals:["save", "insertImage"], Handler:function (name) {
27
	if (name.toLowerCase() == "save") {
28
		return new dojo.widget.Editor2ToolbarButton("Save");
29
	} else {
30
		if (name.toLowerCase() == "insertimage") {
31
			return new dojo.widget.Editor2ToolbarButton("InsertImage");
32
		}
33
	}
34
}, getCommand:function (editor, name) {
35
	var signal;
36
	dojo.lang.every(this.signals, function (s) {
37
		if (s.toLowerCase() == name.toLowerCase()) {
38
			signal = s;
39
			return false;
40
		}
41
		return true;
42
	});
43
	if (signal) {
44
		return new dojo.widget.Editor2Plugin.SimpleSignalCommand(editor, signal);
45
	}
46
}};
47
if (dojo.widget.Editor2Plugin["_SimpleSignalCommands"]) {
48
	dojo.lang.mixin(dojo.widget.Editor2Plugin.SimpleSignalCommands, dojo.widget.Editor2Plugin["_SimpleSignalCommands"]);
49
}
50
dojo.widget.Editor2Manager.registerHandler(dojo.widget.Editor2Plugin.SimpleSignalCommands, "getCommand");
51
dojo.widget.Editor2ToolbarItemManager.registerHandler(dojo.widget.Editor2Plugin.SimpleSignalCommands.Handler);
52