| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* 2 * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 * For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 (function() 7 { 8 function getListElement( editor, listTag ) 9 { 10 var range; 11 try { range = editor.getSelection().getRanges()[ 0 ]; } 12 catch( e ) { return null; } 13 14 range.shrink( CKEDITOR.SHRINK_TEXT ); 15 return range.getCommonAncestor().getAscendant( listTag, true ); 16 } 17 18 var mapListStyle = { 19 'a' : 'lower-alpha', 20 'A' : 'upper-alpha', 21 'i' : 'lower-roman', 22 'I' : 'upper-roman', 23 '1' : 'decimal', 24 'disc' : 'disc', 25 'circle': 'circle', 26 'square' : 'square' 27 }; 28 29 function listStyle( editor, startupPage ) 30 { 31 if ( startupPage == 'bulletedListStyle' ) 32 { 33 return { 34 title : editor.lang.list.bulletedTitle, 35 minWidth : 300, 36 minHeight : 50, 37 contents : 38 [ 39 { 40 id : 'info', 41 accessKey : 'I', 42 elements : 43 [ 44 { 45 type : 'select', 46 label : editor.lang.list.type, 47 id : 'type', 48 style : 'width: 150px; margin: auto;', 49 items : 50 [ 51 [ editor.lang.list.notset, '' ], 52 [ editor.lang.list.circle, 'circle' ], 53 [ editor.lang.list.disc, 'disc' ], 54 [ editor.lang.list.square, 'square' ] 55 ], 56 setup : function( element ) 57 { 58 var value = element.getStyle( 'list-style-type' ) 59 || mapListStyle[ element.getAttribute( 'type' ) ] 60 || element.getAttribute( 'type' ) 61 || ''; 62 63 this.setValue( value ); 64 }, 65 commit : function( element ) 66 { 67 var value = this.getValue(); 68 if ( value ) 69 element.setStyle( 'list-style-type', value ); 70 else 71 element.removeStyle( 'list-style-type' ); 72 } 73 } 74 ] 75 } 76 ], 77 onShow: function() 78 { 79 var editor = this.getParentEditor(), 80 element = getListElement( editor, 'ul' ); 81 82 element && this.setupContent( element ); 83 }, 84 onOk: function() 85 { 86 var editor = this.getParentEditor(), 87 element = getListElement( editor, 'ul' ); 88 89 element && this.commitContent( element ); 90 } 91 }; 92 } 93 else if ( startupPage == 'numberedListStyle' ) 94 { 95 96 var listStyleOptions = 97 [ 98 [ editor.lang.list.notset, '' ], 99 [ editor.lang.list.lowerRoman, 'lower-roman' ], 100 [ editor.lang.list.upperRoman, 'upper-roman' ], 101 [ editor.lang.list.lowerAlpha, 'lower-alpha' ], 102 [ editor.lang.list.upperAlpha, 'upper-alpha' ], 103 [ editor.lang.list.decimal, 'decimal' ] 104 ]; 105 106 if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 7 ) 107 { 108 listStyleOptions.concat( [ 109 [ editor.lang.list.armenian, 'armenian' ], 110 [ editor.lang.list.decimalLeadingZero, 'decimal-leading-zero' ], 111 [ editor.lang.list.georgian, 'georgian' ], 112 [ editor.lang.list.lowerGreek, 'lower-greek' ] 113 ]); 114 } 115 116 return { 117 title : editor.lang.list.numberedTitle, 118 minWidth : 300, 119 minHeight : 50, 120 contents : 121 [ 122 { 123 id : 'info', 124 accessKey : 'I', 125 elements : 126 [ 127 { 128 type : 'hbox', 129 widths : [ '25%', '75%' ], 130 children : 131 [ 132 { 133 label : editor.lang.list.start, 134 type : 'text', 135 id : 'start', 136 validate : CKEDITOR.dialog.validate.integer( editor.lang.list.validateStartNumber ), 137 setup : function( element ) 138 { 139 var value = element.getAttribute( 'start' ) || 1; 140 value && this.setValue( value ); 141 }, 142 commit : function( element ) 143 { 144 element.setAttribute( 'start', this.getValue() ); 145 } 146 }, 147 { 148 type : 'select', 149 label : editor.lang.list.type, 150 id : 'type', 151 style : 'width: 100%;', 152 items : listStyleOptions, 153 setup : function( element ) 154 { 155 var value = element.getStyle( 'list-style-type' ) 156 || mapListStyle[ element.getAttribute( 'type' ) ] 157 || element.getAttribute( 'type' ) 158 || ''; 159 160 this.setValue( value ); 161 }, 162 commit : function( element ) 163 { 164 var value = this.getValue(); 165 if ( value ) 166 element.setStyle( 'list-style-type', value ); 167 else 168 element.removeStyle( 'list-style-type' ); 169 } 170 } 171 ] 172 } 173 ] 174 } 175 ], 176 onShow: function() 177 { 178 var editor = this.getParentEditor(), 179 element = getListElement( editor, 'ol' ); 180 181 element && this.setupContent( element ); 182 }, 183 onOk: function() 184 { 185 var editor = this.getParentEditor(), 186 element = getListElement( editor, 'ol' ); 187 188 element && this.commitContent( element ); 189 } 190 }; 191 } 192 } 193 194 CKEDITOR.dialog.add( 'numberedListStyle', function( editor ) 195 { 196 return listStyle( editor, 'numberedListStyle' ); 197 }); 198 199 CKEDITOR.dialog.add( 'bulletedListStyle', function( editor ) 200 { 201 return listStyle( editor, 'bulletedListStyle' ); 202 }); 203 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |