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