plugin.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  3. For licensing, see LICENSE.html or http://ckeditor.com/license
  4. */
  5. CKEDITOR.plugins.add( 'find',
  6. {
  7. init : function( editor )
  8. {
  9. var forms = CKEDITOR.plugins.find;
  10. editor.ui.addButton( 'Find',
  11. {
  12. label : editor.lang.findAndReplace.find,
  13. command : 'find'
  14. });
  15. var findCommand = editor.addCommand( 'find', new CKEDITOR.dialogCommand( 'find' ) );
  16. findCommand.canUndo = false;
  17. findCommand.readOnly = 1;
  18. editor.ui.addButton( 'Replace',
  19. {
  20. label : editor.lang.findAndReplace.replace,
  21. command : 'replace'
  22. });
  23. var replaceCommand = editor.addCommand( 'replace', new CKEDITOR.dialogCommand( 'replace' ) );
  24. replaceCommand.canUndo = false;
  25. CKEDITOR.dialog.add( 'find', this.path + 'dialogs/find.js' );
  26. CKEDITOR.dialog.add( 'replace', this.path + 'dialogs/find.js' );
  27. },
  28. requires : [ 'styles' ]
  29. } );
  30. /**
  31. * Defines the style to be used to highlight results with the find dialog.
  32. * @type Object
  33. * @default { element : 'span', styles : { 'background-color' : '#004', 'color' : '#fff' } }
  34. * @example
  35. * // Highlight search results with blue on yellow.
  36. * config.find_highlight =
  37. * {
  38. * element : 'span',
  39. * styles : { 'background-color' : '#ff0', 'color' : '#00f' }
  40. * };
  41. */
  42. CKEDITOR.config.find_highlight = { element : 'span', styles : { 'background-color' : '#004', 'color' : '#fff' } };