Changeset 2362 for FCKeditor/trunk
- Timestamp:
- 2008-08-18 12:40:37 (5 months ago)
- Location:
- FCKeditor/trunk
- Files:
-
- 60 modified
-
editor/dialog/common/fck_dialog_common.js (modified) (1 diff)
-
editor/dialog/fck_table.html (modified) (8 diffs)
-
editor/lang/af.js (modified) (1 diff)
-
editor/lang/ar.js (modified) (1 diff)
-
editor/lang/bg.js (modified) (1 diff)
-
editor/lang/bn.js (modified) (1 diff)
-
editor/lang/bs.js (modified) (1 diff)
-
editor/lang/ca.js (modified) (1 diff)
-
editor/lang/cs.js (modified) (1 diff)
-
editor/lang/da.js (modified) (1 diff)
-
editor/lang/de.js (modified) (1 diff)
-
editor/lang/el.js (modified) (1 diff)
-
editor/lang/en-au.js (modified) (1 diff)
-
editor/lang/en-ca.js (modified) (1 diff)
-
editor/lang/en.js (modified) (1 diff)
-
editor/lang/en-uk.js (modified) (1 diff)
-
editor/lang/eo.js (modified) (1 diff)
-
editor/lang/es.js (modified) (1 diff)
-
editor/lang/et.js (modified) (1 diff)
-
editor/lang/eu.js (modified) (1 diff)
-
editor/lang/fa.js (modified) (1 diff)
-
editor/lang/fi.js (modified) (1 diff)
-
editor/lang/fo.js (modified) (1 diff)
-
editor/lang/fr-ca.js (modified) (1 diff)
-
editor/lang/fr.js (modified) (1 diff)
-
editor/lang/gl.js (modified) (1 diff)
-
editor/lang/gu.js (modified) (1 diff)
-
editor/lang/he.js (modified) (1 diff)
-
editor/lang/hi.js (modified) (1 diff)
-
editor/lang/hr.js (modified) (1 diff)
-
editor/lang/hu.js (modified) (1 diff)
-
editor/lang/it.js (modified) (1 diff)
-
editor/lang/ja.js (modified) (1 diff)
-
editor/lang/km.js (modified) (1 diff)
-
editor/lang/ko.js (modified) (1 diff)
-
editor/lang/lt.js (modified) (1 diff)
-
editor/lang/lv.js (modified) (1 diff)
-
editor/lang/mn.js (modified) (1 diff)
-
editor/lang/ms.js (modified) (1 diff)
-
editor/lang/nb.js (modified) (1 diff)
-
editor/lang/nl.js (modified) (1 diff)
-
editor/lang/no.js (modified) (1 diff)
-
editor/lang/pl.js (modified) (1 diff)
-
editor/lang/pt-br.js (modified) (1 diff)
-
editor/lang/pt.js (modified) (1 diff)
-
editor/lang/ro.js (modified) (1 diff)
-
editor/lang/ru.js (modified) (1 diff)
-
editor/lang/sk.js (modified) (1 diff)
-
editor/lang/sl.js (modified) (1 diff)
-
editor/lang/sr.js (modified) (1 diff)
-
editor/lang/sr-latn.js (modified) (1 diff)
-
editor/lang/sv.js (modified) (1 diff)
-
editor/lang/th.js (modified) (1 diff)
-
editor/lang/_translationstatus.txt (modified) (1 diff)
-
editor/lang/tr.js (modified) (1 diff)
-
editor/lang/uk.js (modified) (1 diff)
-
editor/lang/vi.js (modified) (1 diff)
-
editor/lang/zh-cn.js (modified) (1 diff)
-
editor/lang/zh.js (modified) (1 diff)
-
_whatsnew.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/dialog/common/fck_dialog_common.js
r2056 r2362 313 313 oDest.style.cssText = oSource.style.cssText ; 314 314 } 315 316 /** 317 * Replaces a tag with another one, keeping its contents: 318 * for example TD --> TH, and TH --> TD. 319 * input: the original node, and the new tag name 320 * http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode 321 */ 322 function RenameNode( oNode , newTag ) 323 { 324 // TODO: if the browser natively supports document.renameNode call it. 325 // does any browser currently support it in order to test? 326 327 // Only rename element nodes. 328 if ( oNode.nodeType != 1 ) 329 return null ; 330 331 // If it's already correct exit here. 332 if ( oNode.nodeName == newTag ) 333 return oNode ; 334 335 var oDoc = oNode.ownerDocument ; 336 // Create the new node 337 var newNode = oDoc.createElement( newTag ) ; 338 339 // Copy all attributes 340 CopyAttributes( oNode, newNode, {} ) ; 341 342 // Move children to the new node 343 FCKDomTools.MoveChildren( oNode, newNode ) ; 344 345 // Finally replace the node and return the new one 346 oNode.parentNode.replaceChild( newNode, oNode ) ; 347 348 return newNode ; 349 } -
FCKeditor/trunk/editor/dialog/fck_table.html
r1565 r2362 32 32 var dialog = window.parent ; 33 33 var oEditor = dialog.InnerDialogLoaded() ; 34 var dialogArguments = dialog.Args() ; 35 36 // Gets the document DOM 37 var oDOM = oEditor.FCK.EditorDocument ; 34 35 var FCKDomTools = oEditor.FCKDomTools ; 38 36 39 37 // Gets the table if there is one selected. 40 38 var table ; 41 39 var e = dialog.Selection.GetSelectedElement() ; 40 var hasColumnHeaders ; 42 41 43 42 if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) ) … … 88 87 var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; 89 88 if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ; 89 90 hasColumnHeaders = true ; 91 // Check if all the first cells in every row are TH 92 for (var row=0; row<table.rows.length; row++) 93 { 94 // If just one cell isn't a TH then it isn't a header column 95 if ( table.rows[row].cells[0].nodeName != 'TH' ) 96 { 97 hasColumnHeaders = false ; 98 99 break; 100 } 101 } 102 103 // Check if the table contains <thead> 104 if ((table.tHead !== null) ) 105 { 106 if (hasColumnHeaders) 107 GetE('selHeaders').value = 'both' ; 108 else 109 GetE('selHeaders').value = 'row' ; 110 } 111 else 112 { 113 if (hasColumnHeaders) 114 GetE('selHeaders').value = 'col' ; 115 else 116 GetE('selHeaders').value = '' ; 117 } 118 90 119 91 120 document.getElementById('txtRows').disabled = true ; … … 105 134 var bExists = ( table != null ) ; 106 135 136 var oDoc = oEditor.FCK.EditorDocument ; 107 137 if ( ! bExists ) 108 table = o Editor.FCK.EditorDocument.createElement( "TABLE" ) ;138 table = oDoc.createElement( "TABLE" ) ; 109 139 110 140 // Removes the Width and Height styles … … 130 160 if ( !eCaption ) 131 161 { 132 eCaption = o Editor.FCK.EditorDocument.createElement( 'CAPTION' ) ;162 eCaption = oDoc.createElement( 'CAPTION' ) ; 133 163 table.insertBefore( eCaption, table.firstChild ) ; 134 164 } … … 146 176 } 147 177 178 var headers = GetE('selHeaders').value ; 179 if ( bExists ) 180 { 181 // Should we make a <thead>? 182 if ( table.tHead==null && (headers=='row' || headers=='both') ) 183 { 184 var oThead = table.createTHead() ; 185 var tbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ; 186 var theRow= FCKDomTools.GetFirstChild( tbody, 'TR' ) ; 187 188 //now change TD to TH: 189 for (var i = 0; i<theRow.childNodes.length ; i++) 190 { 191 var th = RenameNode(theRow.childNodes[i], 'TH') ; 192 if (th != null) 193 th.scope='col' ; 194 } 195 oThead.appendChild( theRow ) ; 196 } 197 198 if ( table.tHead!==null && !(headers=='row' || headers=='both') ) 199 { 200 // Move the row out of the THead and put it in the TBody: 201 var tHead = table.tHead ; 202 var tbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ; 203 204 var previousFirstRow = tbody.firstChild ; 205 while ( tHead.firstChild ) 206 { 207 var theRow = tHead.firstChild ; 208 for (var i = 0; i < theRow.childNodes.length ; i++ ) 209 { 210 var newCell = RenameNode( theRow.childNodes[i], 'TD' ) ; 211 if ( newCell != null ) 212 newCell.removeAttribute( 'scope' ) ; 213 } 214 tbody.insertBefore( theRow, previousFirstRow ) ; 215 } 216 table.removeChild( tHead ) ; 217 } 218 219 // Should we make all first cells in a row TH? 220 if ( (!hasColumnHeaders) && (headers=='col' || headers=='both') ) 221 { 222 for( var row=0 ; row < table.rows.length ; row++ ) 223 { 224 var newCell = RenameNode(table.rows[row].cells[0], 'TH') ; 225 if ( newCell != null ) 226 newCell.scope = 'row' ; 227 } 228 } 229 230 // Should we make all first TH-cells in a row make TD? If 'yes' we do it the other way round :-) 231 if ( (hasColumnHeaders) && !(headers=='col' || headers=='both') ) 232 { 233 for( var row=0 ; row < table.rows.length ; row++ ) 234 { 235 var oRow = table.rows[row] ; 236 if ( oRow.parentNode.nodeName == 'TBODY' ) 237 { 238 var newCell = RenameNode(oRow.cells[0], 'TD') ; 239 if (newCell != null) 240 newCell.removeAttribute( 'scope' ) ; 241 } 242 } 243 } 244 } 245 148 246 if (! bExists) 149 247 { 150 var iRows = document.getElementById('txtRows').value ; 151 var iCols = document.getElementById('txtColumns').value ; 152 153 for ( var r = 0 ; r < iRows ; r++ ) 154 { 248 var iRows = GetE('txtRows').value ; 249 var iCols = GetE('txtColumns').value ; 250 251 var startRow = 0 ; 252 // Should we make a <thead> ? 253 if (headers=='row' || headers=='both') 254 { 255 startRow++ ; 256 var oThead = table.createTHead() ; 155 257 var oRow = table.insertRow(-1) ; 258 oThead.appendChild(oRow); 259 156 260 for ( var c = 0 ; c < iCols ; c++ ) 157 261 { 158 var oCell = oRow.insertCell(-1) ; 262 var oThcell = oDoc.createElement( 'TH' ) ; 263 oThcell.scope = 'col' ; 264 oRow.appendChild( oThcell ) ; 265 if ( oEditor.FCKBrowserInfo.IsGeckoLike ) 266 oEditor.FCKTools.AppendBogusBr( oThcell ) ; 267 } 268 } 269 270 // Opera automatically creates a tbody when a thead has been added 271 var oTbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ; 272 if ( !oTbody ) 273 { 274 // make TBODY if it doesn't exist 275 oTbody = oDoc.createElement( 'TBODY' ) ; 276 table.appendChild( oTbody ) ; 277 } 278 for ( var r = startRow ; r < iRows; r++ ) 279 { 280 var oRow = oDoc.createElement( 'TR' ) ; 281 oTbody.appendChild(oRow) ; 282 283 var startCol = 0 ; 284 // Is the first column a header? 285 if (headers=='col' || headers=='both') 286 { 287 var oThcell = oDoc.createElement( 'TH' ) ; 288 oThcell.scope = 'row' ; 289 oRow.appendChild( oThcell ) ; 290 if ( oEditor.FCKBrowserInfo.IsGeckoLike ) 291 oEditor.FCKTools.AppendBogusBr( oThcell ) ; 292 293 startCol++ ; 294 } 295 for ( var c = startCol ; c < iCols ; c++ ) 296 { 297 // IE will leave the TH at the end of the row if we use now oRow.insertCell(-1) 298 var oCell = oDoc.createElement( 'TD' ) ; 299 oRow.appendChild( oCell ) ; 159 300 if ( oEditor.FCKBrowserInfo.IsGeckoLike ) 160 301 oEditor.FCKTools.AppendBogusBr( oCell ) ; … … 179 320 <tr> 180 321 <td valign="top"> 181 <table cellspacing=" 0" cellpadding="0" border="0">322 <table cellspacing="1" cellpadding="0" border="0"> 182 323 <tr> 183 324 <td> … … 195 336 </tr> 196 337 <tr> 197 <td> 198 </td> 199 <td> 200 </td> 338 <td><span fcklang="DlgTableHeaders">Headers</span>:</td> 339 <td> 340 <select id="selHeaders"> 341 <option fcklang="DlgTableHeadersNone" value="">None</option> 342 <option fcklang="DlgTableHeadersRow" value="row">First row</option> 343 <option fcklang="DlgTableHeadersColumn" value="col">First column</option> 344 <option fcklang="DlgTableHeadersBoth" value="both">Both</option> 345 </select> 346 </td> 201 347 </tr> 202 348 <tr> … … 245 391 </tr> 246 392 <tr> 247 <td> 248 </td> 249 <td> 250 </td> 251 <td> 252 </td> 393 <td colspan="3"> </td> 253 394 </tr> 254 395 <tr> -
FCKeditor/trunk/editor/lang/af.js
r2222 r2362 309 309 DlgTableCaption : "Beskreiwing", 310 310 DlgTableSummary : "Opsomming", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/ar.js
r2222 r2362 309 309 DlgTableCaption : "الوصف", 310 310 DlgTableSummary : "الخلاصة", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/bg.js
r2222 r2362 309 309 DlgTableCaption : "Заглавие", 310 310 DlgTableSummary : "Резюме", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/bn.js
r2222 r2362 309 309 DlgTableCaption : "শীর্ষক", 310 310 DlgTableSummary : "সারাংশ", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/bs.js
r2222 r2362 309 309 DlgTableCaption : "Naslov", 310 310 DlgTableSummary : "Summary", //MISSING 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/ca.js
r2315 r2362 309 309 DlgTableCaption : "Títol", 310 310 DlgTableSummary : "Resum", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/cs.js
r2316 r2362 309 309 DlgTableCaption : "Popis", 310 310 DlgTableSummary : "Souhrn", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/da.js
r2222 r2362 309 309 DlgTableCaption : "Titel", 310 310 DlgTableSummary : "Resume", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/de.js
r2307 r2362 309 309 DlgTableCaption : "Überschrift", 310 310 DlgTableSummary : "Inhaltsübersicht", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/el.js
r2222 r2362 309 309 DlgTableCaption : "Υπέρτιτλος", 310 310 DlgTableSummary : "Περίληψη", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/en-au.js
r2327 r2362 309 309 DlgTableCaption : "Caption", 310 310 DlgTableSummary : "Summary", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/en-ca.js
r2327 r2362 309 309 DlgTableCaption : "Caption", 310 310 DlgTableSummary : "Summary", 311 DlgTableHeaders : "Headers", //MISSING 312 DlgTableHeadersNone : "None", //MISSING 313 DlgTableHeadersColumn : "First column", //MISSING 314 DlgTableHeadersRow : "First Row", //MISSING 315 DlgTableHeadersBoth : "Both", //MISSING 311 316 312 317 // Table Cell Dialog -
FCKeditor/trunk/editor/lang/en.js
r2209 r2362 309 309 DlgTableCaption : "Caption", 310 310 DlgTableSummary : "Summary", 311 DlgTableHeaders : "Headers", 312 DlgTableHeadersNone : "None", 313 DlgTableHeadersColumn : "First column", 314 DlgTableHeadersRow : "First Row", 315 <