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 | |
---|
10 | function SpellChecker(editor) { |
---|
11 | this.editor = editor; |
---|
12 | |
---|
13 | var cfg = editor.config; |
---|
14 | var tt = SpellChecker.I18N; |
---|
15 | var bl = SpellChecker.btnList; |
---|
16 | var self = this; |
---|
17 | |
---|
18 | // register the toolbar buttons provided by this plugin |
---|
19 | var toolbar = []; |
---|
20 | for (var i in bl) { |
---|
21 | var btn = bl[i]; |
---|
22 | if (!btn) { |
---|
23 | toolbar.push("separator"); |
---|
24 | } else { |
---|
25 | var id = "SC-" + btn[0]; |
---|
26 | cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "SpellChecker"), false, |
---|
27 | function(editor, id) { |
---|
28 | // dispatch button press event |
---|
29 | self.buttonPress(editor, id); |
---|
30 | }, btn[1]); |
---|
31 | toolbar.push(id); |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | for (var i in toolbar) { |
---|
36 | cfg.toolbar[0].push(toolbar[i]); |
---|
37 | } |
---|
38 | }; |
---|
39 | |
---|
40 | SpellChecker._pluginInfo = { |
---|
41 | name : "SpellChecker", |
---|
42 | version : "1.0", |
---|
43 | developer : "Mihai Bazon", |
---|
44 | developer_url : "http://dynarch.com/mishoo/", |
---|
45 | c_owner : "Mihai Bazon", |
---|
46 | sponsor : "American Bible Society", |
---|
47 | sponsor_url : "http://www.americanbible.org", |
---|
48 | license : "htmlArea" |
---|
49 | }; |
---|
50 | |
---|
51 | SpellChecker.btnList = [ |
---|
52 | null, // separator |
---|
53 | ["spell-check"] |
---|
54 | ]; |
---|
55 | |
---|
56 | SpellChecker.prototype.buttonPress = function(editor, id) { |
---|
57 | switch (id) { |
---|
58 | case "SC-spell-check": |
---|
59 | SpellChecker.editor = editor; |
---|
60 | SpellChecker.init = true; |
---|
61 | var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html"; |
---|
62 | var win; |
---|
63 | if (HTMLArea.is_ie) { |
---|
64 | win = window.open(uiurl, "SC_spell_checker", |
---|
65 | "toolbar=no,location=no,directories=no,status=no,menubar=no," + |
---|
66 | "scrollbars=no,resizable=yes,width=600,height=450"); |
---|
67 | } else { |
---|
68 | win = window.open(uiurl, "SC_spell_checker", |
---|
69 | "toolbar=no,menubar=no,personalbar=no,width=600,height=450," + |
---|
70 | "scrollbars=no,resizable=yes"); |
---|
71 | } |
---|
72 | win.focus(); |
---|
73 | break; |
---|
74 | } |
---|
75 | }; |
---|
76 | |
---|
77 | // this needs to be global, it's accessed from spell-check-ui.html |
---|
78 | SpellChecker.editor = null; |
---|