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 theme specific language pack */ |
8 (function() { |
9 tinyMCE.importPluginLanguagePack('print'); |
9 tinymce.create('tinymce.plugins.Print', { |
|
10 init : function(ed, url) { |
|
11 ed.addCommand('mcePrint', function() { |
|
12 ed.getWin().print(); |
|
13 }); |
10 |
14 |
11 var TinyMCE_PrintPlugin = { |
15 ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'}); |
12 getInfo : function() { |
16 }, |
13 return { |
|
14 longname : 'Print', |
|
15 author : 'Moxiecode Systems AB', |
|
16 authorurl : 'http://tinymce.moxiecode.com', |
|
17 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
|
18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion |
|
19 }; |
|
20 }, |
|
21 |
17 |
22 getControlHTML : function(cn) { |
18 getInfo : function() { |
23 switch (cn) { |
19 return { |
24 case "print": |
20 longname : 'Print', |
25 return tinyMCE.getButtonHTML(cn, 'lang_print_desc', '{$pluginurl}/images/print.gif', 'mcePrint'); |
21 author : 'Moxiecode Systems AB', |
|
22 authorurl : 'http://tinymce.moxiecode.com', |
|
23 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', |
|
24 version : tinymce.majorVersion + "." + tinymce.minorVersion |
|
25 }; |
26 } |
26 } |
|
27 }); |
27 |
28 |
28 return ""; |
29 // Register plugin |
29 }, |
30 tinymce.PluginManager.add('print', tinymce.plugins.Print); |
30 |
31 })(); |
31 /** |
|
32 * Executes the search/replace commands. |
|
33 */ |
|
34 execCommand : function(editor_id, element, command, user_interface, value) { |
|
35 // Handle commands |
|
36 switch (command) { |
|
37 case "mcePrint": |
|
38 tinyMCE.getInstanceById(editor_id).contentWindow.print(); |
|
39 return true; |
|
40 } |
|
41 |
|
42 // Pass to next handler in chain |
|
43 return false; |
|
44 } |
|
45 }; |
|
46 |
|
47 tinyMCE.addPlugin("print", TinyMCE_PrintPlugin); |
|