Subversion Repositories Applications.papyrus

Rev

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