Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
// Spell Checker Plugin for HTMLArea-3.0
2
// Sponsored by www.americanbible.org
3
// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
4
//
5
// (c) dynarch.com 2003.
6
// Distributed under the same terms as HTMLArea itself.
7
// This notice MUST stay intact for use (see license.txt).
8
//
9
// $Id: spell-checker.js 42 2007-04-18 10:07:34Z tiefland $
10
 
11
function SpellChecker(editor) {
12
	this.editor = editor;
13
 
14
	var cfg = editor.config;
15
	var tt = SpellChecker.I18N;
16
	var bl = SpellChecker.btnList;
17
	var self = this;
18
 
19
	// register the toolbar buttons provided by this plugin
20
	var toolbar = [];
21
	for (var i in bl) {
22
		var btn = bl[i];
23
		if (!btn) {
24
			toolbar.push("separator");
25
		} else {
26
			var id = "SC-" + btn[0];
27
			cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "SpellChecker"), false,
28
					   function(editor, id) {
29
						   // dispatch button press event
30
						   self.buttonPress(editor, id);
31
					   }, btn[1]);
32
			toolbar.push(id);
33
		}
34
	}
35
 
36
	for (var i in toolbar) {
37
		cfg.toolbar[0].push(toolbar[i]);
38
	}
39
};
40
 
41
SpellChecker._pluginInfo = {
42
	name          : "SpellChecker",
43
	version       : "1.0",
44
	developer     : "Mihai Bazon",
45
	developer_url : "http://dynarch.com/mishoo/",
46
	c_owner       : "Mihai Bazon",
47
	sponsor       : "American Bible Society",
48
	sponsor_url   : "http://www.americanbible.org",
49
	license       : "htmlArea"
50
};
51
 
52
SpellChecker.btnList = [
53
	null, // separator
54
	["spell-check"]
55
	];
56
 
57
SpellChecker.prototype.buttonPress = function(editor, id) {
58
	switch (id) {
59
	    case "SC-spell-check":
60
		SpellChecker.editor = editor;
61
		SpellChecker.init = true;
62
		var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html";
63
		var win;
64
		if (HTMLArea.is_ie) {
65
			win = window.open(uiurl, "SC_spell_checker",
66
					  "toolbar=no,location=no,directories=no,status=no,menubar=no," +
67
					  "scrollbars=no,resizable=yes,width=600,height=450");
68
		} else {
69
			win = window.open(uiurl, "SC_spell_checker",
70
					  "toolbar=no,menubar=no,personalbar=no,width=600,height=450," +
71
					  "scrollbars=no,resizable=yes");
72
		}
73
		win.focus();
74
		break;
75
	}
76
};
77
 
78
// this needs to be global, it's accessed from spell-check-ui.html
79
SpellChecker.editor = null;