liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
 
(function()
{
    CKEDITOR.plugins.liststyle =
    {
        requires : [ 'dialog' ],
        init : function( editor )
        {
            editor.addCommand( 'numberedListStyle', new CKEDITOR.dialogCommand( 'numberedListStyle' ) );
            CKEDITOR.dialog.add( 'numberedListStyle', this.path + 'dialogs/liststyle.js' );
            editor.addCommand( 'bulletedListStyle', new CKEDITOR.dialogCommand( 'bulletedListStyle' ) );
            CKEDITOR.dialog.add( 'bulletedListStyle', this.path + 'dialogs/liststyle.js' );
 
            // If the "menu" plugin is loaded, register the menu items.
            if ( editor.addMenuItems )
            {
                //Register map group;
                editor.addMenuGroup("list", 108);
 
                editor.addMenuItems(
                    {
                        numberedlist :
                        {
                            label : editor.lang.list.numberedTitle,
                            group : 'list',
                            command: 'numberedListStyle'
                        },
                        bulletedlist :
                        {
                            label : editor.lang.list.bulletedTitle,
                            group : 'list',
                            command: 'bulletedListStyle'
                        }
                    });
            }
 
            // If the "contextmenu" plugin is loaded, register the listeners.
            if ( editor.contextMenu )
            {
                editor.contextMenu.addListener( function( element, selection )
                    {
                        if ( !element || element.isReadOnly() )
                            return null;
 
                        while ( element )
                        {
                            var name = element.getName();
                            if ( name == 'ol' )
                                return { numberedlist: CKEDITOR.TRISTATE_OFF };
                            else if ( name == 'ul' )
                                return { bulletedlist: CKEDITOR.TRISTATE_OFF };
 
                            element = element.getParent();
                        }
                        return null;
                    });
            }
        }
    };
 
    CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );
})();