initial commit
[namibia] / public / scripts / ckeditor / _source / plugins / liststyle / plugin.js
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
6 (function()
7 {
8         CKEDITOR.plugins.liststyle =
9         {
10                 requires : [ 'dialog' ],
11                 init : function( editor )
12                 {
13                         editor.addCommand( 'numberedListStyle', new CKEDITOR.dialogCommand( 'numberedListStyle' ) );
14                         CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );
15                         editor.addCommand( 'bulletedListStyle', new CKEDITOR.dialogCommand( 'bulletedListStyle' ) );
16                         CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );
17
18                         // If the "menu" plugin is loaded, register the menu items.
19                         if ( editor.addMenuItems )
20                         {
21                                 //Register map group;
22                                 editor.addMenuGroup("list", 108);
23
24                                 editor.addMenuItems(
25                                         {
26                                                 numberedlist :
27                                                 {
28                                                         label : editor.lang.list.numberedTitle,
29                                                         group : 'list',
30                                                         command: 'numberedListStyle'
31                                                 },
32                                                 bulletedlist :
33                                                 {
34                                                         label : editor.lang.list.bulletedTitle,
35                                                         group : 'list',
36                                                         command: 'bulletedListStyle'
37                                                 }
38                                         });
39                         }
40
41                         // If the "contextmenu" plugin is loaded, register the listeners.
42                         if ( editor.contextMenu )
43                         {
44                                 editor.contextMenu.addListener( function( element, selection )
45                                         {
46                                                 if ( !element || element.isReadOnly() )
47                                                         return null;
48
49                                                 while ( element )
50                                                 {
51                                                         var name = element.getName();
52                                                         if ( name == 'ol' )
53                                                                 return { numberedlist: CKEDITOR.TRISTATE_OFF };
54                                                         else if ( name == 'ul' )
55                                                                 return { bulletedlist: CKEDITOR.TRISTATE_OFF };
56
57                                                         element = element.getParent();
58                                                 }
59                                                 return null;
60                                         });
61                         }
62                 }
63         };
64
65         CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );
66 })();