JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.3.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                 requires : [ 'dialog' ],\r
11                 init : function( editor )\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                         // If the "menu" plugin is loaded, register the menu items.\r
19                         if ( editor.addMenuItems )\r
20                         {\r
21                                 //Register map group;\r
22                                 editor.addMenuGroup("list", 108);\r
23 \r
24                                 editor.addMenuItems(\r
25                                         {\r
26                                                 numberedlist :\r
27                                                 {\r
28                                                         label : editor.lang.list.numberedTitle,\r
29                                                         group : 'list',\r
30                                                         command: 'numberedListStyle'\r
31                                                 },\r
32                                                 bulletedlist :\r
33                                                 {\r
34                                                         label : editor.lang.list.bulletedTitle,\r
35                                                         group : 'list',\r
36                                                         command: 'bulletedListStyle'\r
37                                                 }\r
38                                         });\r
39                         }\r
40 \r
41                         // If the "contextmenu" plugin is loaded, register the listeners.\r
42                         if ( editor.contextMenu )\r
43                         {\r
44                                 editor.contextMenu.addListener( function( element, selection )\r
45                                         {\r
46                                                 while ( element )\r
47                                                 {\r
48                                                         var name = element.getName();\r
49                                                         if ( name == 'ol' )\r
50                                                                 return { numberedlist: CKEDITOR.TRISTATE_OFF };\r
51                                                         else if ( name == 'ul' )\r
52                                                                 return { bulletedlist: CKEDITOR.TRISTATE_OFF };\r
53 \r
54                                                         element = element.getParent();\r
55                                                 }\r
56                                                 return null;\r
57                                         });\r
58                         }\r
59                 }\r
60         };\r
61 \r
62         CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );\r
63 })();\r