2 * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
3 * For licensing, see LICENSE.html or http://ckeditor.com/license
\r
8 function getListElement( editor, listTag )
\r
11 try { range = editor.getSelection().getRanges()[ 0 ]; }
\r
12 catch( e ) { return null; }
\r
14 range.shrink( CKEDITOR.SHRINK_TEXT );
\r
15 return range.getCommonAncestor().getAscendant( listTag, true );
\r
18 var mapListStyle = {
\r
19 'a' : 'lower-alpha',
\r
20 'A' : 'upper-alpha',
\r
21 'i' : 'lower-roman',
\r
22 'I' : 'upper-roman',
\r
29 function listStyle( editor, startupPage )
\r
31 if ( startupPage == 'bulletedListStyle' )
\r
34 title : editor.lang.list.bulletedTitle,
\r
46 label : editor.lang.list.type,
\r
48 style : 'width: 150px; margin: auto;',
\r
51 [ editor.lang.list.notset, '' ],
\r
52 [ editor.lang.list.circle, 'circle' ],
\r
53 [ editor.lang.list.disc, 'disc' ],
\r
54 [ editor.lang.list.square, 'square' ]
\r
56 setup : function( element )
\r
58 var value = element.getStyle( 'list-style-type' )
\r
59 || mapListStyle[ element.getAttribute( 'type' ) ]
\r
60 || element.getAttribute( 'type' )
\r
63 this.setValue( value );
\r
65 commit : function( element )
\r
67 var value = this.getValue();
\r
69 element.setStyle( 'list-style-type', value );
\r
71 element.removeStyle( 'list-style-type' );
\r
79 var editor = this.getParentEditor(),
\r
80 element = getListElement( editor, 'ul' );
\r
82 element && this.setupContent( element );
\r
86 var editor = this.getParentEditor(),
\r
87 element = getListElement( editor, 'ul' );
\r
89 element && this.commitContent( element );
\r
93 else if ( startupPage == 'numberedListStyle' )
\r
96 var listStyleOptions =
\r
98 [ editor.lang.list.notset, '' ],
\r
99 [ editor.lang.list.lowerRoman, 'lower-roman' ],
\r
100 [ editor.lang.list.upperRoman, 'upper-roman' ],
\r
101 [ editor.lang.list.lowerAlpha, 'lower-alpha' ],
\r
102 [ editor.lang.list.upperAlpha, 'upper-alpha' ],
\r
103 [ editor.lang.list.decimal, 'decimal' ]
\r
106 if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 7 )
\r
108 listStyleOptions.concat( [
\r
109 [ editor.lang.list.armenian, 'armenian' ],
\r
110 [ editor.lang.list.decimalLeadingZero, 'decimal-leading-zero' ],
\r
111 [ editor.lang.list.georgian, 'georgian' ],
\r
112 [ editor.lang.list.lowerGreek, 'lower-greek' ]
\r
117 title : editor.lang.list.numberedTitle,
\r
129 widths : [ '25%', '75%' ],
\r
133 label : editor.lang.list.start,
\r
136 validate : CKEDITOR.dialog.validate.integer( editor.lang.list.validateStartNumber ),
\r
137 setup : function( element )
\r
139 var value = element.getAttribute( 'start' ) || 1;
\r
140 value && this.setValue( value );
\r
142 commit : function( element )
\r
144 element.setAttribute( 'start', this.getValue() );
\r
149 label : editor.lang.list.type,
\r
151 style : 'width: 100%;',
\r
152 items : listStyleOptions,
\r
153 setup : function( element )
\r
155 var value = element.getStyle( 'list-style-type' )
\r
156 || mapListStyle[ element.getAttribute( 'type' ) ]
\r
157 || element.getAttribute( 'type' )
\r
160 this.setValue( value );
\r
162 commit : function( element )
\r
164 var value = this.getValue();
\r
166 element.setStyle( 'list-style-type', value );
\r
168 element.removeStyle( 'list-style-type' );
\r
178 var editor = this.getParentEditor(),
\r
179 element = getListElement( editor, 'ol' );
\r
181 element && this.setupContent( element );
\r
185 var editor = this.getParentEditor(),
\r
186 element = getListElement( editor, 'ol' );
\r
188 element && this.commitContent( element );
\r
194 CKEDITOR.dialog.add( 'numberedListStyle', function( editor )
\r
196 return listStyle( editor, 'numberedListStyle' );
\r
199 CKEDITOR.dialog.add( 'bulletedListStyle', function( editor )
\r
201 return listStyle( editor, 'bulletedListStyle' );
\r