JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2.2
[ckeditor.git] / _source / plugins / liststyle / plugin.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 (function()\r
7 {\r
8         CKEDITOR.plugins.liststyle =\r
9         {\r
10                 init : function( editor )\r
11                 {\r
12 \r
13                         editor.addCommand( 'numberedListStyle', new CKEDITOR.dialogCommand( 'numberedListStyle' ) );\r
14                         CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );\r
15                         editor.addCommand( 'bulletedListStyle', new CKEDITOR.dialogCommand( 'bulletedListStyle' ) );\r
16                         CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );\r
17 \r
18                         //Register map group;\r
19                         editor.addMenuGroup("list", 108);\r
20                         // If the "menu" plugin is loaded, register the menu items.\r
21                         if ( editor.addMenuItems )\r
22                         {\r
23                                 editor.addMenuItems(\r
24                                         {\r
25                                                 numberedlist :\r
26                                                 {\r
27                                                         label : editor.lang.list.numberedTitle,\r
28                                                         group : 'list',\r
29                                                         command: 'numberedListStyle'\r
30                                                 },\r
31                                                 bulletedlist :\r
32                                                 {\r
33                                                         label : editor.lang.list.bulletedTitle,\r
34                                                         group : 'list',\r
35                                                         command: 'bulletedListStyle'\r
36                                                 }\r
37                                         });\r
38                         }\r
39 \r
40                         // If the "contextmenu" plugin is loaded, register the listeners.\r
41                         if ( editor.contextMenu )\r
42                         {\r
43                                 editor.contextMenu.addListener( function( element, selection )\r
44                                         {\r
45                                                 if ( !element )\r
46                                                         return null;\r
47 \r
48                                                 if ( element.getAscendant( 'ol') )\r
49                                                         return { numberedlist: CKEDITOR.TRISTATE_OFF };\r
50 \r
51                                                 if ( element.getAscendant( 'ul' ) )\r
52                                                         return { bulletedlist: CKEDITOR.TRISTATE_OFF };\r
53                                         });\r
54                         }\r
55                 }\r
56         };\r
57 \r
58         CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );\r
59 })();\r