commit | author | age
|
a0109c
|
1 |
/**
|
69d05c
|
2 |
* editor_plugin_src.js
|
a0109c
|
3 |
*
|
69d05c
|
4 |
* Copyright 2009, Moxiecode Systems AB
|
A |
5 |
* Released under LGPL License.
|
|
6 |
*
|
|
7 |
* License: http://tinymce.moxiecode.com/license
|
|
8 |
* Contributing: http://tinymce.moxiecode.com/contributing
|
a0109c
|
9 |
*/
|
S |
10 |
|
d9344f
|
11 |
(function() {
|
S |
12 |
tinymce.create('tinymce.plugins.SearchReplacePlugin', {
|
|
13 |
init : function(ed, url) {
|
|
14 |
function open(m) {
|
a9251b
|
15 |
// Keep IE from writing out the f/r character to the editor
|
T |
16 |
// instance while initializing a new dialog. See: #3131190
|
|
17 |
window.focus();
|
|
18 |
|
d9344f
|
19 |
ed.windowManager.open({
|
S |
20 |
file : url + '/searchreplace.htm',
|
|
21 |
width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
|
69d05c
|
22 |
height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
|
d9344f
|
23 |
inline : 1,
|
S |
24 |
auto_focus : 0
|
|
25 |
}, {
|
|
26 |
mode : m,
|
|
27 |
search_string : ed.selection.getContent({format : 'text'}),
|
|
28 |
plugin_url : url
|
|
29 |
});
|
|
30 |
};
|
a0109c
|
31 |
|
d9344f
|
32 |
// Register commands
|
S |
33 |
ed.addCommand('mceSearch', function() {
|
|
34 |
open('search');
|
|
35 |
});
|
a0109c
|
36 |
|
d9344f
|
37 |
ed.addCommand('mceReplace', function() {
|
S |
38 |
open('replace');
|
|
39 |
});
|
a0109c
|
40 |
|
d9344f
|
41 |
// Register buttons
|
S |
42 |
ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
|
|
43 |
ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
|
f0ea59
|
44 |
|
d9344f
|
45 |
ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
|
S |
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 |
};
|
a0109c
|
56 |
}
|
d9344f
|
57 |
});
|
f0ea59
|
58 |
|
d9344f
|
59 |
// Register plugin
|
S |
60 |
tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
|
|
61 |
})(); |