Line # Revision Author
1 3 ahitrov@rambler.ru /**
2 * editor_plugin_src.js
3 *
4 * Copyright 2009, Moxiecode Systems AB
5 * Released under LGPL License.
6 *
7 * License: http://tinymce.moxiecode.com/license
8 * Contributing: http://tinymce.moxiecode.com/contributing
9 */
10
11 (function() {
12 tinymce.create('tinymce.plugins.SearchReplacePlugin', {
13 init : function(ed, url) {
14 function open(m) {
15 ed.windowManager.open({
16 file : url + '/searchreplace.htm',
17 width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
18 height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
19 inline : 1,
20 auto_focus : 0
21 }, {
22 mode : m,
23 search_string : ed.selection.getContent({format : 'text'}),
24 plugin_url : url
25 });
26 };
27
28 // Register commands
29 ed.addCommand('mceSearch', function() {
30 open('search');
31 });
32
33 ed.addCommand('mceReplace', function() {
34 open('replace');
35 });
36
37 // Register buttons
38 ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
39 ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
40
41 ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
42 },
43
44 getInfo : function() {
45 return {
46 longname : 'Search/Replace',
47 author : 'Moxiecode Systems AB',
48 authorurl : 'http://tinymce.moxiecode.com',
49 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
50 version : tinymce.majorVersion + "." + tinymce.minorVersion
51 };
52 }
53 });
54
55 // Register plugin
56 tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
57 })();