Ticket #4358: 4358_5.patch

File 4358_5.patch, 9.2 KB (added by m.nguyen, 22 months ago)

Thank Garry, I have got your point.

  • _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                circle                          : 'Circle', 
     200                disc                            : 'Disc', 
     201                square                          : 'Square', 
     202                none                            : 'None', 
     203                notset                          : '<not set>', 
     204                armenian                        : 'Armenian numbering', 
     205                georgian                        : 'Georgian numbering (an, ban, gan, etc.)', 
     206                lowerRoman                      : 'Lower Roman (i, ii, iii, iv, v, etc.)', 
     207                upperRoman                      : 'Upper Roman (I, II, III, IV, V, etc.)', 
     208                lowerAlpha                      : 'Lower Alpha (a, b, c, d, e, etc.)', 
     209                upperAlpha                      : 'Upper Alpha (A, B, C, D, E, etc.)', 
     210                lowerGreek                      : 'Lower Greek (alpha, beta, gamma, etc.)', 
     211                decimal                         : 'Decimal (1, 2, 3, etc.)', 
     212                decimalLeadingZero      : 'Decimal leading zero (01, 02, 03, etc.)' 
     213        }, 
     214         
    192215        // Find And Replace Dialog 
    193216        findAndReplace : 
    194217        { 
  • _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        var mapListStyle = { 
     14                'a' : 'lower-alpha', 
     15                'A' : 'upper-alpha', 
     16                'i' : 'lower-roman', 
     17                'I' : 'upper-roman', 
     18                '1' : 'decimal', 
     19                'disc' : 'disc', 
     20                'circle': 'circle', 
     21                'square' : 'square' 
     22        }; 
     23         
     24        function listStyle( editor, startupPage ) 
     25        { 
     26                if ( startupPage == 'bulletedListStyle' ) 
     27                { 
     28                        return { 
     29                                title : editor.lang.list.bulletedTitle, 
     30                                minWidth : 300, 
     31                                minHeight : 50, 
     32                                contents : 
     33                                [ 
     34                                        { 
     35                                                elements : 
     36                                                [ 
     37                                                        { 
     38                                                                type : 'select', 
     39                                                                label : editor.lang.list.type, 
     40                                                                id: 'type', 
     41                                                                style: 'width: 150px; margin: auto;', 
     42                                                                items : 
     43                                                                [ 
     44                                                                        [ editor.lang.list.notset, '' ], 
     45                                                                        [ editor.lang.list.circle, 'circle' ], 
     46                                                                        [ editor.lang.list.disc,  'disc' ], 
     47                                                                        [ editor.lang.list.square, 'square' ] 
     48                                                                ], 
     49                                                                setup : function( element ) 
     50                                                                { 
     51                                                                        var value = element.getStyle( 'list-style-type' ) 
     52                                                                                                || mapListStyle[ element.getAttribute( 'type' ) ] 
     53                                                                                                || element.getAttribute( 'type' ) 
     54                                                                                                || ''; 
     55 
     56                                                                        this.setValue( value ); 
     57                                                                }, 
     58                                                                commit : function( element ) 
     59                                                                { 
     60                                                                        var value = this.getValue(); 
     61                                                                        if ( value != '' ) 
     62                                                                                element.setStyle( 'list-style-type', value ); 
     63                                                                        else  
     64                                                                                element.removeStyle( 'list-style-type' ); 
     65                                                                } 
     66                                                        } 
     67                                                ] 
     68                                        } 
     69                                ], 
     70                                onShow: function()  
     71                                { 
     72                                        var editor = this.getParentEditor(), 
     73                                                element = getListElement( editor, 'ul' ); 
     74                                         
     75                                        element && this.setupContent( element ); 
     76                                }, 
     77                                onOk: function() 
     78                                { 
     79                                        var editor = this.getParentEditor(), 
     80                                                element = getListElement( editor, 'ul' ); 
     81                                         
     82                                        element && this.commitContent( element ); 
     83                                } 
     84                        } 
     85                } 
     86                else if ( startupPage == 'numberedListStyle'  ) 
     87                { 
     88                        return { 
     89                                title : editor.lang.list.numberedTitle, 
     90                                minWidth : 300, 
     91                                minHeight : 50, 
     92                                contents : 
     93                                [ 
     94                                        { 
     95                                                elements : 
     96                                                [ 
     97                                                        { 
     98                                                                type : 'hbox', 
     99                                                                widths : [ '25%', '75%' ], 
     100                                                                children : 
     101                                                                [ 
     102                                                                        { 
     103                                                                                label: editor.lang.list.start, 
     104                                                                                type: 'text', 
     105                                                                                setup : function( element ) 
     106                                                                                { 
     107                                                                                        var value = element.getAttribute( 'start' ) || 1; 
     108                                                                                        value && this.setValue( value ); 
     109                                                                                }, 
     110                                                                                commit : function( element ) 
     111                                                                                { 
     112                                                                                        element.setAttribute( 'start', this.getValue() ); 
     113                                                                                } 
     114                                                                        }, 
     115                                                                        { 
     116                                                                                type : 'select', 
     117                                                                                label : editor.lang.list.type, 
     118                                                                                style: 'width: 100%;', 
     119                                                                                items : 
     120                                                                                [ 
     121                                                                                        [ editor.lang.list.notset, '' ], 
     122                                                                                        [ editor.lang.list.armenian, 'armenian' ], 
     123                                                                                        [ editor.lang.list.georgian, 'georgian' ], 
     124                                                                                        [ editor.lang.list.lowerRoman, 'lower-roman' ], 
     125                                                                                        [ editor.lang.list.upperRoman, 'upper-roman' ], 
     126                                                                                        [ editor.lang.list.lowerAlpha, 'lower-alpha' ], 
     127                                                                                        [ editor.lang.list.upperAlpha, 'upper-alpha' ], 
     128                                                                                        [ editor.lang.list.lowerGreek, 'lower-greek' ], 
     129                                                                                        [ editor.lang.list.decimal, 'decimal' ], 
     130                                                                                        [ editor.lang.list.decimalLeadingZero, 'decimal-leading-zero' ], 
     131                                                                                ], 
     132                                                                                setup : function( element ) 
     133                                                                                { 
     134                                                                                        var value = element.getStyle( 'list-style-type' ) 
     135                                                                                                || mapListStyle[ element.getAttribute( 'type' ) ] 
     136                                                                                                || element.getAttribute( 'type' ) 
     137                                                                                                || ''; 
     138 
     139                                                                                        this.setValue( value ); 
     140                                                                                }, 
     141                                                                                commit : function( element ) 
     142                                                                                { 
     143                                                                                        var value = this.getValue(); 
     144                                                                                        if ( value != '' )  
     145                                                                                                element.setStyle( 'list-style-type', value ); 
     146                                                                                        else  
     147                                                                                                element.removeStyle( 'list-style-type' ); 
     148                                                                                } 
     149                                                                        } 
     150                                                                ] 
     151                                                        } 
     152                                                ] 
     153                                        } 
     154                                ], 
     155                                onShow: function()  
     156                                { 
     157                                        var editor = this.getParentEditor(), 
     158                                                element = getListElement( editor, 'ol' ); 
     159 
     160                                        element && this.setupContent( element ); 
     161                                }, 
     162                                onOk: function() 
     163                                { 
     164                                        var editor = this.getParentEditor(), 
     165                                                element = getListElement( editor, 'ol' ); 
     166                                         
     167                                        element && this.commitContent( element ); 
     168                                } 
     169                        } 
     170                } 
     171        }; 
     172         
     173        CKEDITOR.dialog.add( 'numberedListStyle', function( editor ) 
     174                { 
     175                        return listStyle( editor, 'numberedListStyle' ); 
     176                }); 
     177 
     178        CKEDITOR.dialog.add( 'bulletedListStyle', function( editor ) 
     179                { 
     180                        return listStyle( editor, 'bulletedListStyle' ); 
     181                }); 
     182})(); 
     183 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 – 2011 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy