includes/clientside/tinymce/plugins/searchreplace/editor_plugin_src.js
changeset 1344 dc96d6c5cd1e
parent 1343 2a31905a567d
child 1345 1de01205143b
equal deleted inserted replaced
1343:2a31905a567d 1344:dc96d6c5cd1e
     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 })();