1 /** |
1 /** |
2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ |
2 * $Id: editor_plugin_src.js 372 2007-11-11 18:38:50Z spocke $ |
3 * |
3 * |
4 * @author Moxiecode |
4 * @author Moxiecode |
5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. |
6 */ |
6 */ |
7 |
7 |
8 /* Import plugin specific language pack */ |
8 (function() { |
9 tinyMCE.importPluginLanguagePack('iespell'); |
9 tinymce.create('tinymce.plugins.IESpell', { |
|
10 init : function(ed, url) { |
|
11 var t = this, sp; |
10 |
12 |
11 var TinyMCE_IESpellPlugin = { |
13 if (!tinymce.isIE) |
12 getInfo : function() { |
14 return; |
13 return { |
|
14 longname : 'IESpell (MSIE Only)', |
|
15 author : 'Moxiecode Systems AB', |
|
16 authorurl : 'http://tinymce.moxiecode.com', |
|
17 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell', |
|
18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion |
|
19 }; |
|
20 }, |
|
21 |
15 |
22 /** |
16 t.editor = ed; |
23 * Returns the HTML contents of the iespell control. |
|
24 */ |
|
25 getControlHTML : function(cn) { |
|
26 // Is it the iespell control and is the brower MSIE. |
|
27 if (cn == "iespell" && (tinyMCE.isMSIE && !tinyMCE.isOpera)) |
|
28 return tinyMCE.getButtonHTML(cn, 'lang_iespell_desc', '{$pluginurl}/images/iespell.gif', 'mceIESpell'); |
|
29 |
17 |
30 return ""; |
18 // Register commands |
31 }, |
19 ed.addCommand('mceIESpell', function() { |
|
20 try { |
|
21 sp = new ActiveXObject("ieSpell.ieSpellExtension"); |
|
22 sp.CheckDocumentNode(ed.getDoc().documentElement); |
|
23 } catch (e) { |
|
24 if (e.number == -2146827859) { |
|
25 ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) { |
|
26 if (s) |
|
27 window.open('http://www.iespell.com/download.php', 'ieSpellDownload', ''); |
|
28 }); |
|
29 } else |
|
30 ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number); |
|
31 } |
|
32 }); |
32 |
33 |
33 /** |
34 // Register buttons |
34 * Executes the mceIESpell command. |
35 ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'}); |
35 */ |
36 }, |
36 execCommand : function(editor_id, element, command, user_interface, value) { |
|
37 // Handle ieSpellCommand |
|
38 if (command == "mceIESpell") { |
|
39 try { |
|
40 var ieSpell = new ActiveXObject("ieSpell.ieSpellExtension"); |
|
41 ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement); |
|
42 } catch (e) { |
|
43 if (e.number == -2146827859) { |
|
44 if (confirm(tinyMCE.getLang("lang_iespell_download", "", true))) |
|
45 window.open('http://www.iespell.com/download.php', 'ieSpellDownload', ''); |
|
46 } else |
|
47 alert("Error Loading ieSpell: Exception " + e.number); |
|
48 } |
|
49 |
37 |
50 return true; |
38 getInfo : function() { |
|
39 return { |
|
40 longname : 'IESpell (IE Only)', |
|
41 author : 'Moxiecode Systems AB', |
|
42 authorurl : 'http://tinymce.moxiecode.com', |
|
43 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell', |
|
44 version : tinymce.majorVersion + "." + tinymce.minorVersion |
|
45 }; |
51 } |
46 } |
|
47 }); |
52 |
48 |
53 // Pass to next handler in chain |
49 // Register plugin |
54 return false; |
50 tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell); |
55 } |
51 })(); |
56 }; |
|
57 |
|
58 tinyMCE.addPlugin("iespell", TinyMCE_IESpellPlugin); |
|