plugin.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or http://ckeditor.com/license
  4. */
  5. CKEDITOR.plugins.add( 'find', {
  6. requires: 'dialog',
  7. // jscs:disable maximumLineLength
  8. lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
  9. // jscs:enable maximumLineLength
  10. icons: 'find,find-rtl,replace', // %REMOVE_LINE_CORE%
  11. hidpi: true, // %REMOVE_LINE_CORE%
  12. init: function( editor ) {
  13. var findCommand = editor.addCommand( 'find', new CKEDITOR.dialogCommand( 'find' ) );
  14. findCommand.canUndo = false;
  15. findCommand.readOnly = 1;
  16. var replaceCommand = editor.addCommand( 'replace', new CKEDITOR.dialogCommand( 'replace' ) );
  17. replaceCommand.canUndo = false;
  18. if ( editor.ui.addButton ) {
  19. editor.ui.addButton( 'Find', {
  20. label: editor.lang.find.find,
  21. command: 'find',
  22. toolbar: 'find,10'
  23. } );
  24. editor.ui.addButton( 'Replace', {
  25. label: editor.lang.find.replace,
  26. command: 'replace',
  27. toolbar: 'find,20'
  28. } );
  29. }
  30. CKEDITOR.dialog.add( 'find', this.path + 'dialogs/find.js' );
  31. CKEDITOR.dialog.add( 'replace', this.path + 'dialogs/find.js' );
  32. }
  33. } );
  34. /**
  35. * Defines the style to be used to highlight results with the find dialog.
  36. *
  37. * // Highlight search results with blue on yellow.
  38. * config.find_highlight = {
  39. * element: 'span',
  40. * styles: { 'background-color': '#ff0', color: '#00f' }
  41. * };
  42. *
  43. * @cfg
  44. * @member CKEDITOR.config
  45. */
  46. CKEDITOR.config.find_highlight = { element: 'span', styles: { 'background-color': '#004', color: '#fff' } };