1 | /**
|
---|
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 | // Keep IE from writing out the f/r character to the editor
|
---|
16 | // instance while initializing a new dialog. See: #3131190
|
---|
17 | window.focus();
|
---|
18 |
|
---|
19 | ed.windowManager.open({
|
---|
20 | file : url + '/searchreplace.htm',
|
---|
21 | width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
|
---|
22 | height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
|
---|
23 | inline : 1,
|
---|
24 | auto_focus : 0
|
---|
25 | }, {
|
---|
26 | mode : m,
|
---|
27 | search_string : ed.selection.getContent({format : 'text'}),
|
---|
28 | plugin_url : url
|
---|
29 | });
|
---|
30 | };
|
---|
31 |
|
---|
32 | // Register commands
|
---|
33 | ed.addCommand('mceSearch', function() {
|
---|
34 | open('search');
|
---|
35 | });
|
---|
36 |
|
---|
37 | ed.addCommand('mceReplace', function() {
|
---|
38 | open('replace');
|
---|
39 | });
|
---|
40 |
|
---|
41 | // Register buttons
|
---|
42 | ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
|
---|
43 | ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
|
---|
44 |
|
---|
45 | ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
|
---|
46 | },
|
---|
47 |
|
---|
48 | getInfo : function() {
|
---|
49 | return {
|
---|
50 | longname : 'Search/Replace',
|
---|
51 | author : 'Moxiecode Systems AB',
|
---|
52 | authorurl : 'http://tinymce.moxiecode.com',
|
---|
53 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
|
---|
54 | version : tinymce.majorVersion + "." + tinymce.minorVersion
|
---|
55 | };
|
---|
56 | }
|
---|
57 | });
|
---|
58 |
|
---|
59 | // Register plugin
|
---|
60 | tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
|
---|
61 | })(); |
---|