Ticket #4358: 4358.patch

File 4358.patch, 7.6 KB (added by Minh Nguyen, 14 years ago)
  • _source/lang/en.js

     
    188188                name            : 'Anchor Name',
    189189                errorName       : 'Please type the anchor name'
    190190        },
    191 
     191       
     192        // List style dialog
     193        list:
     194        {
     195                numberedTitle           : 'Numbered List Properties',
     196                bulletedTitle           : 'Bulleted List Properties',
     197                type                            : 'Type',
     198                start                           : 'Start',
     199                style_1                         : 'Numbers (1, 2, 3)',
     200                style_a                         : 'Lowercase Letters (a, b, c)',                       
     201                style_A                         : 'Uppercase Letters (A, B, C)',                       
     202                style_i                         : 'Small Roman Numerals (i, ii, iii)',                 
     203                style_I                         : 'Large Roman Numerals (I, II, III)',                 
     204        },
     205       
    192206        // Find And Replace Dialog
    193207        findAndReplace :
    194208        {
  • _source/plugins/liststyle/dialogs/liststyle.js

    Property changes on: _source\plugins\liststyle
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.fckeditor.net/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
    
    Property changes on: _source\plugins\liststyle\dialogs
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.fckeditor.net/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
     
     1(function()
     2{
     3        function getListElement( editor, listTag )
     4        {
     5                var range;
     6                try { range  = editor.getSelection().getRanges()[ 0 ]; }
     7                catch( e ) { return null; }
     8                               
     9                range.shrink( CKEDITOR.SHRINK_TEXT );
     10                return range.getCommonAncestor().getAscendant( listTag, true );
     11        }
     12       
     13        function listStyle( editor, startupPage )
     14        {
     15                if ( startupPage == 'bulletedListStyle' )
     16                {
     17                        return {
     18                                title : editor.lang.list.bulletedTitle,
     19                                minWidth : 300,
     20                                minHeight : 50,
     21                                contents :
     22                                [
     23                                        {
     24                                                elements :
     25                                                [
     26                                                        {
     27                                                                type : 'select',
     28                                                                label : editor.lang.list.type,
     29                                                                id: 'type',
     30                                                                width: '100px',
     31                                                                items :
     32                                                                [
     33                                                                        [ 'Circle' ],
     34                                                                        [ 'Disc' ],
     35                                                                        [ 'Square' ]
     36                                                                ],
     37                                                                setup : function( element )
     38                                                                {
     39                                                                        var value = element.getAttribute( 'type' ) || 'Disc';
     40                                                                        this.setValue( value );
     41                                                                },
     42                                                                commit : function( element )
     43                                                                {
     44                                                                        element.setAttribute( 'type', this.getValue() );
     45                                                                }
     46                                                        }
     47                                                ]
     48                                        }
     49                                ],
     50                                onShow: function()
     51                                {
     52                                        var editor = this.getParentEditor(),
     53                                                element = getListElement( editor, 'ul' );
     54                                       
     55                                        element && this.setupContent( element );
     56                                },
     57                                onOk: function()
     58                                {
     59                                        var editor = this.getParentEditor(),
     60                                                element = getListElement( editor, 'ul' );
     61                                       
     62                                        element && this.commitContent( element );
     63                                }
     64                        }
     65                }
     66                else if ( startupPage == 'numberedListStyle'  )
     67                {
     68                        return {
     69                                title : editor.lang.list.numberedTitle,
     70                                minWidth : 300,
     71                                minHeight : 50,
     72                                contents :
     73                                [
     74                                        {
     75                                                elements :
     76                                                [
     77                                                        {
     78                                                                type : 'hbox',
     79                                                                widths : [ '25%', '75%' ],
     80                                                                children :
     81                                                                [
     82                                                                        {
     83                                                                                label: editor.lang.list.start,
     84                                                                                id: 'start',
     85                                                                                type: 'text',
     86                                                                                setup : function( element )
     87                                                                                {
     88                                                                                        var value = element.getAttribute( 'start' ) || 1;
     89                                                                                        value && this.setValue( value );
     90                                                                                },
     91                                                                                commit : function( element )
     92                                                                                {
     93                                                                                        element.setAttribute( 'start', this.getValue() );
     94                                                                                }
     95                                                                        },
     96                                                                        {
     97                                                                                type : 'select',
     98                                                                                label : editor.lang.list.type,
     99                                                                                width: '100%',
     100                                                                                items :
     101                                                                                [
     102                                                                                        [ editor.lang.list.style_1 , '1' ],
     103                                                                                        [ editor.lang.list.style_a , 'a' ],
     104                                                                                        [ editor.lang.list.style_A , 'A' ],
     105                                                                                        [ editor.lang.list.style_i , 'i' ],
     106                                                                                        [ editor.lang.list.style_I , 'I' ]
     107                                                                                ],
     108                                                                                setup : function( element )
     109                                                                                {
     110                                                                                        var value = element.getAttribute( 'type' ) || '1';
     111                                                                                        this.setValue( value );
     112                                                                                },
     113                                                                                commit : function( element )
     114                                                                                {
     115                                                                                        element.setAttribute( 'type', this.getValue() );
     116                                                                                }
     117                                                                        }
     118                                                                ]
     119                                                        }
     120                                                ]
     121                                        }
     122                                ],
     123                                onShow: function()
     124                                {
     125                                        var editor = this.getParentEditor(),
     126                                                element = getListElement( editor, 'ol' );
     127
     128                                        element && this.setupContent( element );
     129                                },
     130                                onOk: function()
     131                                {
     132                                        var editor = this.getParentEditor(),
     133                                                element = getListElement( editor, 'ol' );
     134                                       
     135                                        element && this.commitContent( element );
     136                                }
     137                        }
     138                }
     139        };
     140       
     141        CKEDITOR.dialog.add( 'numberedListStyle', function( editor )
     142                {
     143                        return listStyle( editor, 'numberedListStyle' );
     144                });
     145
     146        CKEDITOR.dialog.add( 'bulletedListStyle', function( editor )
     147                {
     148                        return listStyle( editor, 'bulletedListStyle' );
     149                });
     150})();
     151 No newline at end of file
  • _source/plugins/liststyle/plugin.js

     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6(function()
     7{
     8        CKEDITOR.plugins.liststyle =
     9        {
     10                init : function( editor )
     11                {
     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                        //Register map group;
     19                        editor.addMenuGroup("list", 108);
     20                        // If the "menu" plugin is loaded, register the menu items.
     21                        if ( editor.addMenuItems )
     22                        {
     23                                editor.addMenuItems(
     24                                        {
     25                                                numberedlist :
     26                                                {
     27                                                        label : editor.lang.list.numberedTitle,
     28                                                        group : 'list',
     29                                                        command: 'numberedListStyle'
     30                                                },
     31                                                bulletedlist :
     32                                                {
     33                                                        label : editor.lang.list.bulletedTitle,
     34                                                        group : 'list',
     35                                                        command: 'bulletedListStyle'
     36                                                }
     37                                        });
     38                        }
     39               
     40                        // If the "contextmenu" plugin is loaded, register the listeners.
     41                        if ( editor.contextMenu )
     42                        {
     43                                editor.contextMenu.addListener( function( element, selection )
     44                                        {
     45                                                if ( !element )
     46                                                        return null;
     47                                               
     48                                                if ( element.getAscendant( 'ol') ) {
     49                                                        return { numberedlist: CKEDITOR.TRISTATE_OFF }
     50                                                }
     51                                                if ( element.getAscendant( 'ul' ) ) {
     52                                                        return { bulletedlist: CKEDITOR.TRISTATE_OFF }
     53                                                }
     54                                        } );
     55                        }
     56                }
     57
     58        };
     59       
     60        CKEDITOR.plugins.add( 'liststyle', CKEDITOR.plugins.liststyle );
     61})();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy