Ticket #4358: 4358_2.patch

File 4358_2.patch, 8.4 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                circle                          : 'Circle',
     200                disc                            : 'Disc',
     201                square                          : 'Square',
     202                none                            : 'None',
     203                inherit                         : 'Inherit',
     204                armenian                        : 'Armenian',
     205                georgian                        : 'Georgian',
     206                lowerRoman                      : 'Lower Roman',
     207                upperRoman                      : 'Upper Roman',
     208                lowerAlpha                      : 'Lower alpha',
     209                upperAlpha                      : 'Upper alpha',
     210                lowerLatin                      : 'Lower Latin',
     211                upperLatin                      : 'Upper Latin',
     212                lowerGreek                      : 'Lower Greek',
     213                decimal                         : 'Decimal',
     214                decimalLeadingZero      : 'Decimal leading zero'
     215        },
     216       
    192217        // Find And Replace Dialog
    193218        findAndReplace :
    194219        {
  • _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                                                                style: 'width: 150px; margin: auto',
     31                                                                items :
     32                                                                [
     33                                                                        [ editor.lang.list.circle, 'circle' ],
     34                                                                        [ editor.lang.list.disc,  'disc' ],
     35                                                                        [ editor.lang.list.square, 'square' ]
     36                                                                ],
     37                                                                setup : function( element )
     38                                                                {
     39                                                                        var value = element.getStyle( 'list-style-type' ) || 'disc';
     40                                                                        this.setValue( value );
     41                                                                },
     42                                                                commit : function( element )
     43                                                                {
     44                                                                        element.setStyle( 'list-style-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                                                                                style: 'width: 100%',
     100                                                                                items :
     101                                                                                [
     102                                                                                        [ editor.lang.list.inherit, 'inherit' ],
     103                                                                                        [ editor.lang.list.armenian, 'armenian' ],
     104                                                                                        [ editor.lang.list.georgian, 'georgian' ],
     105                                                                                        [ editor.lang.list.lowerRoman, 'lower-roman' ],
     106                                                                                        [ editor.lang.list.upperRoman, 'upper-roman' ],
     107                                                                                        [ editor.lang.list.lowerAlpha, 'lower-alpha' ],
     108                                                                                        [ editor.lang.list.upperAlpha, 'upper-alpha' ],
     109                                                                                        [ editor.lang.list.lowerLatin, 'lower-latin' ],
     110                                                                                        [ editor.lang.list.upperLatin, 'upper-latin' ],
     111                                                                                        [ editor.lang.list.lowerGreek, 'lower-greek' ],
     112                                                                                        [ editor.lang.list.decimal, 'decimal' ],
     113                                                                                        [ editor.lang.list.decimalLeadingZero, 'decimal-leading-zero' ]
     114                                                                                ],
     115                                                                                setup : function( element )
     116                                                                                {
     117                                                                                        var value = element.getStyle( 'list-style-type' ) || 'inherit';
     118                                                                                        this.setValue( value );
     119                                                                                },
     120                                                                                commit : function( element )
     121                                                                                {
     122                                                                                        element.setStyle( 'list-style-type', this.getValue() );
     123                                                                                }
     124                                                                        }
     125                                                                ]
     126                                                        }
     127                                                ]
     128                                        }
     129                                ],
     130                                onShow: function()
     131                                {
     132                                        var editor = this.getParentEditor(),
     133                                                element = getListElement( editor, 'ol' );
     134
     135                                        element && this.setupContent( element );
     136                                },
     137                                onOk: function()
     138                                {
     139                                        var editor = this.getParentEditor(),
     140                                                element = getListElement( editor, 'ol' );
     141                                       
     142                                        element && this.commitContent( element );
     143                                }
     144                        }
     145                }
     146        };
     147       
     148        CKEDITOR.dialog.add( 'numberedListStyle', function( editor )
     149                {
     150                        return listStyle( editor, 'numberedListStyle' );
     151                });
     152
     153        CKEDITOR.dialog.add( 'bulletedListStyle', function( editor )
     154                {
     155                        return listStyle( editor, 'bulletedListStyle' );
     156                });
     157})();
     158 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