source: trunk/plugins/SpellChecker/spell-checker.js @ 856

Last change on this file since 856 was 856, checked in by wymsy, 12 years ago

Change namespace from HTMLArea to Xinha in all the plugins - ref ticket #916

  • Property svn:eol-style set to native
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 2.2 KB
Line 
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$
10
11Xinha.Config.prototype.SpellChecker = { 'backend': 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_GB', 'utf8_to_entities' : true };
12
13function SpellChecker(editor) {
14  this.editor = editor;
15
16  var cfg = editor.config;
17  var bl = SpellChecker.btnList;
18  var self = this;
19
20  // see if we can find the mode switch button, insert this before that
21  var id = "SC-spell-check";
22  cfg.registerButton(id, this._lc("Spell-check"), editor.imgURL("spell-check.gif", "SpellChecker"), false,
23             function(editor, id) {
24               // dispatch button press event
25               self.buttonPress(editor, id);
26             });
27
28  cfg.addToolbarElement("SC-spell-check", "htmlmode", 1);
29}
30
31SpellChecker._pluginInfo = {
32  name          : "SpellChecker",
33  version       : "1.0",
34  developer     : "Mihai Bazon",
35  developer_url : "http://dynarch.com/mishoo/",
36  c_owner       : "Mihai Bazon",
37  sponsor       : "American Bible Society",
38  sponsor_url   : "http://www.americanbible.org",
39  license       : "htmlArea"
40};
41
42SpellChecker.prototype._lc = function(string) {
43    return Xinha._lc(string, 'SpellChecker');
44};
45
46SpellChecker.btnList = [
47  null, // separator
48  ["spell-check"]
49  ];
50
51SpellChecker.prototype.buttonPress = function(editor, id) {
52  switch (id) {
53      case "SC-spell-check":
54    SpellChecker.editor = editor;
55    SpellChecker.init = true;
56    var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html";
57    var win;
58    if (Xinha.is_ie) {
59      win = window.open(uiurl, "SC_spell_checker",
60            "toolbar=no,location=no,directories=no,status=no,menubar=no," +
61            "scrollbars=no,resizable=yes,width=600,height=450");
62    } else {
63      win = window.open(uiurl, "SC_spell_checker",
64            "toolbar=no,menubar=no,personalbar=no,width=600,height=450," +
65            "scrollbars=no,resizable=yes");
66    }
67    win.focus();
68    break;
69  }
70};
71
72// this needs to be global, it's accessed from spell-check-ui.html
73SpellChecker.editor = null;
Note: See TracBrowser for help on using the repository browser.