Changeset 1075
- Timestamp:
- 10/09/08 17:02:30 (2 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
modules/Dialogs/XinhaDialog.js (modified) (2 diffs)
-
modules/InlineStyler/InlineStyler.js (modified) (19 diffs)
-
plugins/TableOperations/TableOperations.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/Dialogs/XinhaDialog.js
r1058 r1075 1038 1038 function(fullString, id) 1039 1039 { 1040 if(typeof dialog.id[id] == 'undefined') 1041 { 1042 dialog.id[id] = Xinha.uniq('Dialog'); 1043 dialog.r_id[dialog.id[id]] = id; 1044 } 1045 return dialog.id[id]; 1040 return dialog.createId(id); 1046 1041 } 1047 1042 ).replace(/<l10n>(.*?)<\/l10n>/ig, … … 1058 1053 return html; 1059 1054 } 1055 1056 /** Use this function when adding an element with a new ID/name to a 1057 * dialog after it has already been created. This function ensures 1058 * that the dialog has the id/name stored in its reverse-lookup table 1059 * (which is required for form values to be properly returned by 1060 * Xinha.Dialog.hide). 1061 * 1062 * @param {id} the id (or name) to add 1063 * 1064 * Returns the internal ID to which the passed in ID maps 1065 * 1066 * TODO: createId is a really awful name, but I can't think of anything better... 1067 */ 1068 Xinha.Dialog.prototype.createId = function(id) 1069 { 1070 var dialog = this; 1071 if (typeof dialog.id[id] == 'undefined') 1072 { 1073 dialog.id[id] = Xinha.uniq('Dialog'); 1074 dialog.r_id[dialog.id[id]] = id; 1075 } 1076 return dialog.id[id]; 1077 }; 1060 1078 1061 1079 /** When several modeless dialogs are shown, one can be brought to front with this function (as happens on mouseclick) -
trunk/modules/InlineStyler/InlineStyler.js
r1065 r1075 1 Xinha.InlineStyler = function(element, editor, d oc)1 Xinha.InlineStyler = function(element, editor, dialog, doc) 2 2 { 3 3 this.element = element; 4 4 this.editor = editor; 5 this.dialog = dialog; 5 6 this.doc = doc ? doc : document; 6 7 this.inputs = { … … 32 33 if (typeof params[i] == 'function') 33 34 continue; 34 var val = params[i].value; 35 if (params[i] != null) 36 var val = params[i].value || params[i]; 37 35 38 switch (i) 36 39 { … … 46 49 break; 47 50 case "borderCollapse": 48 style.borderCollapse = params[i].checked ? "collapse" : "";51 style.borderCollapse = params[i] == "on" ? "collapse" : "separate"; 49 52 break; 50 53 case "width": … … 109 112 break; 110 113 case "borderWidth": 111 var borderWidthUnit = this.inputs.aux["heightUnit"].value; 112 style[i] = val + (borderWidthUnit) ? borderWidthUnit : 'px'; 113 break; 114 default: 114 style[i] = val + "px"; 115 break; 116 default: 115 117 style[i] = val; 116 118 break; … … 155 157 tr.appendChild(td); 156 158 select = doc.createElement("select"); 159 select.name = this.dialog.createId("float"); 157 160 td.appendChild(select); 158 161 this.inputs.styles['float'] = select; … … 185 188 tr.appendChild(td); 186 189 input = doc.createElement("input"); 190 input.name = this.dialog.createId("width"); 187 191 input.type = "text"; 188 192 input.value = Xinha.InlineStyler.getLength(el.style.width); … … 192 196 td.appendChild(input); 193 197 select = doc.createElement("select"); 198 select.name = this.dialog.createId("widthUnit"); 194 199 this.inputs.aux['widthUnit'] = select; 195 200 option = doc.createElement("option"); … … 208 213 td.appendChild(doc.createTextNode(Xinha._lc("Text align", "TableOperations") + ":")); 209 214 select = doc.createElement("select"); 215 select.name = this.dialog.createId("textAlign"); 210 216 select.style.marginLeft = select.style.marginRight = "0.5em"; 211 217 td.appendChild(select); … … 218 224 input = doc.createElement("input"); 219 225 this.inputs.aux['textAlignChar'] = input; 220 input.name= 'fuck';226 input.name= this.dialog.createId("textAlignChar"); 221 227 input.size = "1"; 222 228 input.style.fontFamily = "monospace"; … … 258 264 tr.appendChild(td); 259 265 input = doc.createElement("input"); 266 input.name = this.dialog.createId("height"); 260 267 input.type = "text"; 261 268 input.value = Xinha.InlineStyler.getLength(el.style.height); … … 265 272 td.appendChild(input); 266 273 select = doc.createElement("select"); 274 select.name = this.dialog.createId("heightUnit"); 267 275 this.inputs.aux['heightUnit'] = select; 268 276 option = doc.createElement("option"); … … 281 289 td.appendChild(doc.createTextNode(Xinha._lc("Vertical align", "TableOperations") + ":")); 282 290 select = doc.createElement("select"); 291 select.name = this.dialog.createId("verticalAlign"); 283 292 this.inputs.styles['verticalAlign'] = select; 284 293 select.style.marginLeft = "0.5em"; … … 330 339 331 340 input = doc.createElement("input"); 341 input.name = this.dialog.createId("backgroundColor"); 332 342 input.value = Xinha._colorToRgb( el.style.backgroundColor ); 333 343 input.type = "hidden"; … … 337 347 new Xinha.colorPicker.InputBinding(input) 338 348 339 td.appendChild(doc.createTextNode(Xinha._lc("Image URL", "TableOperations") + ": ")); 340 input = doc.createElement("input"); 349 td.appendChild(doc.createTextNode(" " + Xinha._lc("Image URL", "TableOperations") + ": ")); 350 input = doc.createElement("input"); 351 input.name = this.dialog.createId("backgroundImage"); 341 352 input.type = "text"; 342 353 this.inputs.styles['backgroundImage'] = input; 343 if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) 344 { 354 if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) 345 355 input.value = RegExp.$1; 346 }347 356 // input.style.width = "100%"; 348 357 td.appendChild(input); … … 357 366 tr.appendChild(td); 358 367 input = doc.createElement("input"); 368 input.name = this.dialog.createId("color"); 359 369 input.value = Xinha._colorToRgb( el.style.color ); 360 370 input.type = "hidden"; … … 379 389 tr.appendChild(td); 380 390 input = doc.createElement("input"); 391 input.name = this.dialog.createId("borderColor"); 381 392 input.value = Xinha._colorToRgb( el.style.borderColor ); 382 393 input.type = "hidden"; … … 387 398 388 399 select = doc.createElement("select"); 400 select.name = this.dialog.createId("borderStyle"); 389 401 var borderFields = []; 390 402 td.appendChild(select); … … 424 436 425 437 input = doc.createElement("input"); 438 input.name = this.dialog.createId("borderWidth"); 426 439 borderFields.push(input); 427 440 input.type = "text"; … … 447 460 tr.appendChild(td); 448 461 input = doc.createElement("input"); 462 input.name = this.dialog.createId("borderCollapse"); 449 463 input.type = "checkbox"; 450 464 this.inputs.styles['borderCollapse'] = input; -
trunk/plugins/TableOperations/TableOperations.js
r1067 r1075 503 503 var dialog = this.dialogTable; 504 504 505 var Styler = new Xinha.InlineStyler(table, this.editor );505 var Styler = new Xinha.InlineStyler(table, this.editor, dialog); 506 506 507 507 function apply() { … … 512 512 if(typeof params[i] == 'function') continue; 513 513 var val = params[i]; 514 if (typeof val == 'object' && val.tagName) val = val.value; 514 //if (val == null) continue; 515 if (typeof val == 'object' && val != null && val.tagName) val = val.value; 515 516 switch (i) { 516 517 case "caption": … … 619 620 var dialog = this.dialogRowCell; 620 621 dialog.getElementById('title').innerHTML = cell ? Xinha._lc("Cell Properties", "TableOperations") : Xinha._lc("Row Properties", "TableOperations"); 621 var Styler = new Xinha.InlineStyler(element, self.editor );622 var Styler = new Xinha.InlineStyler(element, self.editor, dialog); 622 623 623 624 function apply() { 624 625 var params = dialog.hide(); 625 Styler.applyStyle( );626 Styler.applyStyle(params); 626 627 627 628 // various workarounds to refresh the table display (Gecko,
