plugin.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. ( function() {
  6. CKEDITOR.plugins.liststyle = {
  7. requires: 'dialog,contextmenu',
  8. // jscs:disable maximumLineLength
  9. 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%
  10. // jscs:enable maximumLineLength
  11. init: function( editor ) {
  12. if ( editor.blockless )
  13. return;
  14. var def, cmd;
  15. def = new CKEDITOR.dialogCommand( 'numberedListStyle', {
  16. requiredContent: 'ol',
  17. allowedContent: 'ol{list-style-type}[start]'
  18. } );
  19. cmd = editor.addCommand( 'numberedListStyle', def );
  20. editor.addFeature( cmd );
  21. CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );
  22. def = new CKEDITOR.dialogCommand( 'bulletedListStyle', {
  23. requiredContent: 'ul',
  24. allowedContent: 'ul{list-style-type}'
  25. } );
  26. cmd = editor.addCommand( 'bulletedListStyle', def );
  27. editor.addFeature( cmd );
  28. CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );
  29. //Register map group;
  30. editor.addMenuGroup( 'list', 108 );
  31. editor.addMenuItems( {
  32. numberedlist: {
  33. label: editor.lang.liststyle.numberedTitle,
  34. group: 'list',
  35. command: 'numberedListStyle'
  36. },
  37. bulletedlist: {
  38. label: editor.lang.liststyle.bulletedTitle,
  39. group: 'list',
  40. command: 'bulletedListStyle'
  41. }
  42. } );
  43. editor.contextMenu.addListener( function( element ) {
  44. if ( !element || element.isReadOnly() )
  45. return null;
  46. while ( element ) {
  47. var name = element.getName();
  48. if ( name == 'ol' )
  49. return { numberedlist: CKEDITOR.TRISTATE_OFF };
  50. else if ( name == 'ul' )
  51. return { bulletedlist: CKEDITOR.TRISTATE_OFF };
  52. element = element.getParent();
  53. }
  54. return null;
  55. } );
  56. }
  57. };
  58. CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );
  59. } )();