[6] | 1 | /** |
---|
| 2 | * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ |
---|
| 3 | * |
---|
| 4 | * @author Moxiecode |
---|
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | (function() { |
---|
| 9 | tinymce.create('tinymce.plugins.SearchReplacePlugin', { |
---|
| 10 | init : function(ed, url) { |
---|
| 11 | function open(m) { |
---|
| 12 | ed.windowManager.open({ |
---|
| 13 | file : url + '/searchreplace.htm', |
---|
| 14 | width : 400 + parseInt(ed.getLang('searchreplace.delta_width', 0)), |
---|
| 15 | height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)), |
---|
| 16 | inline : 1 |
---|
| 17 | }, { |
---|
| 18 | mode : m, |
---|
| 19 | search_string : ed.selection.getContent({format : 'text'}), |
---|
| 20 | plugin_url : url |
---|
| 21 | }); |
---|
| 22 | }; |
---|
| 23 | |
---|
| 24 | // Register commands |
---|
| 25 | ed.addCommand('mceSearch', function() { |
---|
| 26 | open('search'); |
---|
| 27 | }); |
---|
| 28 | |
---|
| 29 | ed.addCommand('mceReplace', function() { |
---|
| 30 | open('replace'); |
---|
| 31 | }); |
---|
| 32 | |
---|
| 33 | // Register buttons |
---|
| 34 | ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); |
---|
| 35 | ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); |
---|
| 36 | |
---|
| 37 | ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); |
---|
| 38 | }, |
---|
| 39 | |
---|
| 40 | getInfo : function() { |
---|
| 41 | return { |
---|
| 42 | longname : 'Search/Replace', |
---|
| 43 | author : 'Moxiecode Systems AB', |
---|
| 44 | authorurl : 'http://tinymce.moxiecode.com', |
---|
| 45 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', |
---|
| 46 | version : tinymce.majorVersion + "." + tinymce.minorVersion |
---|
| 47 | }; |
---|
| 48 | } |
---|
| 49 | }); |
---|
| 50 | |
---|
| 51 | // Register plugin |
---|
| 52 | tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); |
---|
| 53 | })(); |
---|