/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

  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. (function() {
  8. tinymce.create('tinymce.plugins.SearchReplacePlugin', {
  9. init : function(ed, url) {
  10. function open(m) {
  11. ed.windowManager.open({
  12. file : url + '/searchreplace.htm',
  13. width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
  14. height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
  15. inline : 1,
  16. auto_focus : 0
  17. }, {
  18. mode : m,
  19. search_string : ed.selection.getContent({format : 'text'}),
  20. plugin_url : url
  21. });
  22. };
  23. // Register commands
  24. ed.addCommand('mceSearch', function() {
  25. open('search');
  26. });
  27. ed.addCommand('mceReplace', function() {
  28. open('replace');
  29. });
  30. // Register buttons
  31. ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
  32. ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
  33. ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
  34. },
  35. getInfo : function() {
  36. return {
  37. longname : 'Search/Replace',
  38. author : 'Moxiecode Systems AB',
  39. authorurl : 'http://tinymce.moxiecode.com',
  40. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
  41. version : tinymce.majorVersion + "." + tinymce.minorVersion
  42. };
  43. }
  44. });
  45. // Register plugin
  46. tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
  47. })();