PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 0ms app.codeStats 0ms

/media/jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js

https://bitbucket.org/chuns/cms
JavaScript | 54 lines | 38 code | 7 blank | 9 comment | 0 complexity | 5ad5add90f775dc9ba17022f38d0acea MD5 | raw file
Possible License(s): LGPL-2.1
 1/**
 2 * $Id: editor_plugin_src.js 686 2008-03-09 18:13:49Z 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 : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
15					height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
16					inline : 1,
17					auto_focus : 0
18				}, {
19					mode : m,
20					search_string : ed.selection.getContent({format : 'text'}),
21					plugin_url : url
22				});
23			};
24
25			// Register commands
26			ed.addCommand('mceSearch', function() {
27				open('search');
28			});
29
30			ed.addCommand('mceReplace', function() {
31				open('replace');
32			});
33
34			// Register buttons
35			ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
36			ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
37
38			ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
39		},
40
41		getInfo : function() {
42			return {
43				longname : 'Search/Replace',
44				author : 'Moxiecode Systems AB',
45				authorurl : 'http://tinymce.moxiecode.com',
46				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
47				version : tinymce.majorVersion + "." + tinymce.minorVersion
48			};
49		}
50	});
51
52	// Register plugin
53	tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
54})();