2004-01-08 10:03:17 +01:00
|
|
|
// Spell Checker Plugin for HTMLArea-3.0
|
2004-04-21 00:17:46 +02:00
|
|
|
// Sponsored by www.americanbible.org
|
|
|
|
// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
|
2004-01-08 10:03:17 +01:00
|
|
|
//
|
2004-04-21 00:17:46 +02:00
|
|
|
// (c) dynarch.com 2003.
|
|
|
|
// Distributed under the same terms as HTMLArea itself.
|
2004-01-08 10:03:17 +01:00
|
|
|
// This notice MUST stay intact for use (see license.txt).
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
function SpellChecker(editor) {
|
|
|
|
this.editor = editor;
|
|
|
|
|
|
|
|
var cfg = editor.config;
|
|
|
|
var tt = SpellChecker.I18N;
|
|
|
|
var bl = SpellChecker.btnList;
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
// register the toolbar buttons provided by this plugin
|
|
|
|
var toolbar = [];
|
2005-06-19 15:37:50 +02:00
|
|
|
for (var i in bl) {
|
2004-01-08 10:03:17 +01:00
|
|
|
var btn = bl[i];
|
|
|
|
if (!btn) {
|
|
|
|
toolbar.push("separator");
|
|
|
|
} else {
|
|
|
|
var id = "SC-" + btn[0];
|
2004-01-29 22:27:14 +01:00
|
|
|
cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "SpellChecker"), false,
|
2004-01-08 10:03:17 +01:00
|
|
|
function(editor, id) {
|
|
|
|
// dispatch button press event
|
|
|
|
self.buttonPress(editor, id);
|
|
|
|
}, btn[1]);
|
|
|
|
toolbar.push(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-19 15:37:50 +02:00
|
|
|
for (var i in toolbar) {
|
2004-01-08 10:03:17 +01:00
|
|
|
cfg.toolbar[0].push(toolbar[i]);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-01-29 22:27:14 +01:00
|
|
|
SpellChecker._pluginInfo = {
|
|
|
|
name : "SpellChecker",
|
|
|
|
version : "1.0",
|
|
|
|
developer : "Mihai Bazon",
|
|
|
|
developer_url : "http://dynarch.com/mishoo/",
|
|
|
|
c_owner : "Mihai Bazon",
|
|
|
|
sponsor : "American Bible Society",
|
|
|
|
sponsor_url : "http://www.americanbible.org",
|
|
|
|
license : "htmlArea"
|
|
|
|
};
|
|
|
|
|
2004-01-08 10:03:17 +01:00
|
|
|
SpellChecker.btnList = [
|
|
|
|
null, // separator
|
|
|
|
["spell-check"]
|
|
|
|
];
|
|
|
|
|
|
|
|
SpellChecker.prototype.buttonPress = function(editor, id) {
|
|
|
|
switch (id) {
|
|
|
|
case "SC-spell-check":
|
|
|
|
SpellChecker.editor = editor;
|
|
|
|
SpellChecker.init = true;
|
2004-01-29 22:27:14 +01:00
|
|
|
var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html";
|
2004-01-08 10:03:17 +01:00
|
|
|
var win;
|
|
|
|
if (HTMLArea.is_ie) {
|
|
|
|
win = window.open(uiurl, "SC_spell_checker",
|
|
|
|
"toolbar=no,location=no,directories=no,status=no,menubar=no," +
|
2004-04-21 00:17:46 +02:00
|
|
|
"scrollbars=no,resizable=yes,width=600,height=450");
|
2004-01-08 10:03:17 +01:00
|
|
|
} else {
|
|
|
|
win = window.open(uiurl, "SC_spell_checker",
|
2004-04-21 00:17:46 +02:00
|
|
|
"toolbar=no,menubar=no,personalbar=no,width=600,height=450," +
|
2004-01-08 10:03:17 +01:00
|
|
|
"scrollbars=no,resizable=yes");
|
|
|
|
}
|
|
|
|
win.focus();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// this needs to be global, it's accessed from spell-check-ui.html
|
|
|
|
SpellChecker.editor = null;
|