Ticket #4358: 4358_4.patch

File 4358_4.patch, 9.4 KB (added by m.nguyen, 22 months 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                circle                          : 'Circle', 
     200                disc                            : 'Disc', 
     201                square                          : 'Square', 
     202                none                            : 'None', 
     203                notset                          : '<not set>', 
     204                'default'                       : 'Default', 
     205                armenian                        : 'Armenian numbering', 
     206                georgian                        : 'Georgian numbering (an, ban, gan, etc.)', 
     207                lowerRoman                      : 'Lower Roman (i, ii, iii, iv, v, etc.)', 
     208                upperRoman                      : 'Upper Roman (I, II, III, IV, V, etc.)', 
     209                lowerAlpha                      : 'Lower Alpha (a, b, c, d, e, etc.)', 
     210                upperAlpha                      : 'Upper Alpha (A, B, C, D, E, etc.)', 
     211                lowerGreek                      : 'Lower Greek (alpha, beta, gamma, etc.)', 
     212                decimal                         : 'Decimal (1, 2, 3, etc.)', 
     213                decimalLeadingZero      : 'Decimal leading zero (01, 02, 03, etc.)' 
     214        }, 
     215         
    192216        // Find And Replace Dialog 
    193217        findAndReplace : 
    194218        { 
  • _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                'lower-alpha' : 'a', 
     15                'upper-alpha' : 'A', 
     16                'lower-roman' : 'i', 
     17                'upper-roman' : 'I', 
     18                'decimal' : 1, 
     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                                                                                                element.getAttribute( 'type' ) ||  ''; 
     53 
     54                                                                        this.setValue( value ); 
     55                                                                }, 
     56                                                                commit : function( element ) 
     57                                                                { 
     58                                                                        var value = this.getValue(); 
     59                                                                        if ( value != '' ) 
     60                                                                        { 
     61                                                                                element.setStyle( 'list-style-type', value ); 
     62                                                                                if ( value in mapListStyle ) 
     63                                                                                        element.setAttribute( 'type', value ); 
     64                                                                        }  
     65                                                                        else  
     66                                                                        { 
     67                                                                                element.removeAttribute( 'type' ); 
     68                                                                                element.removeStyle( 'list-style-type' ); 
     69                                                                        } 
     70                                                                } 
     71                                                        } 
     72                                                ] 
     73                                        } 
     74                                ], 
     75                                onShow: function()  
     76                                { 
     77                                        var editor = this.getParentEditor(), 
     78                                                element = getListElement( editor, 'ul' ); 
     79                                         
     80                                        element && this.setupContent( element ); 
     81                                }, 
     82                                onOk: function() 
     83                                { 
     84                                        var editor = this.getParentEditor(), 
     85                                                element = getListElement( editor, 'ul' ); 
     86                                         
     87                                        element && this.commitContent( element ); 
     88                                } 
     89                        } 
     90                } 
     91                else if ( startupPage == 'numberedListStyle'  ) 
     92                { 
     93                        return { 
     94                                title : editor.lang.list.numberedTitle, 
     95                                minWidth : 300, 
     96                                minHeight : 50, 
     97                                contents : 
     98                                [ 
     99                                        { 
     100                                                elements : 
     101                                                [ 
     102                                                        { 
     103                                                                type : 'hbox', 
     104                                                                widths : [ '25%', '75%' ], 
     105                                                                children : 
     106                                                                [ 
     107                                                                        { 
     108                                                                                label: editor.lang.list.start, 
     109                                                                                type: 'text', 
     110                                                                                setup : function( element ) 
     111                                                                                { 
     112                                                                                        var value = element.getAttribute( 'start' ) || 1; 
     113                                                                                        value && this.setValue( value ); 
     114                                                                                }, 
     115                                                                                commit : function( element ) 
     116                                                                                { 
     117                                                                                        element.setAttribute( 'start', this.getValue() ); 
     118                                                                                } 
     119                                                                        }, 
     120                                                                        { 
     121                                                                                type : 'select', 
     122                                                                                label : editor.lang.list.type, 
     123                                                                                style: 'width: 100%;', 
     124                                                                                items : 
     125                                                                                [ 
     126                                                                                        [ editor.lang.list.notset, '' ], 
     127                                                                                        [ editor.lang.list.armenian, 'armenian' ], 
     128                                                                                        [ editor.lang.list.georgian, 'georgian' ], 
     129                                                                                        [ editor.lang.list.lowerRoman, 'lower-roman' ], 
     130                                                                                        [ editor.lang.list.upperRoman, 'upper-roman' ], 
     131                                                                                        [ editor.lang.list.lowerAlpha, 'lower-alpha' ], 
     132                                                                                        [ editor.lang.list.upperAlpha, 'upper-alpha' ], 
     133                                                                                        [ editor.lang.list.lowerGreek, 'lower-greek' ], 
     134                                                                                        [ editor.lang.list.decimal, 'decimal' ], 
     135                                                                                        [ editor.lang.list.decimalLeadingZero, 'decimal-leading-zero' ], 
     136                                                                                ], 
     137                                                                                setup : function( element ) 
     138                                                                                { 
     139                                                                                        var value = element.getStyle( 'list-style-type' ) || 
     140                                                                                                                element.getAttribute( 'type' ) ||  ''; 
     141 
     142                                                                                        this.setValue( value ); 
     143                                                                                }, 
     144                                                                                commit : function( element ) 
     145                                                                                { 
     146                                                                                        var value = this.getValue(); 
     147                                                                                        // Reset style. 
     148                                                                                        element.removeAttribute( 'type' ); 
     149                                                                                        element.removeStyle( 'list-style-type' ); 
     150                                                                                         
     151                                                                                        if ( value != '' ) 
     152                                                                                                element.setStyle( 'list-style-type', value ); 
     153                                                                                         
     154                                                                                        if ( value in mapListStyle ) 
     155                                                                                                element.setAttribute( 'type', mapListStyle[value] ); 
     156                                                                                         
     157                                                                                } 
     158                                                                        } 
     159                                                                ] 
     160                                                        } 
     161                                                ] 
     162                                        } 
     163                                ], 
     164                                onShow: function()  
     165                                { 
     166                                        var editor = this.getParentEditor(), 
     167                                                element = getListElement( editor, 'ol' ); 
     168 
     169                                        element && this.setupContent( element ); 
     170                                }, 
     171                                onOk: function() 
     172                                { 
     173                                        var editor = this.getParentEditor(), 
     174                                                element = getListElement( editor, 'ol' ); 
     175                                         
     176                                        element && this.commitContent( element ); 
     177                                } 
     178                        } 
     179                } 
     180        }; 
     181         
     182        CKEDITOR.dialog.add( 'numberedListStyle', function( editor ) 
     183                { 
     184                        return listStyle( editor, 'numberedListStyle' ); 
     185                }); 
     186 
     187        CKEDITOR.dialog.add( 'bulletedListStyle', function( editor ) 
     188                { 
     189                        return listStyle( editor, 'bulletedListStyle' ); 
     190                }); 
     191})(); 
     192 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