Ticket #83: wymeditor_thickbox.diff
| File wymeditor_thickbox.diff, 6.5 kB (added by pc, 3 years ago) |
|---|
-
src/wymeditor/jquery.wymeditor.js
338 338 dialogFeatures: "menubar=no,titlebar=no,toolbar=no,resizable=no" 339 339 + ",width=560,height=300,top=0,left=0", 340 340 341 dialogHtml: "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'" 342 + " 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>" 343 + "<html><head>" 344 + "<link rel='stylesheet' type='text/css' media='screen'" 345 + " href='" 346 + WYM_CSS_PATH 347 + "' />" 348 + "<title>" 349 + WYM_DIALOG_TITLE 350 + "</title>" 351 + "<script type='text/javascript'" 352 + " src='" 353 + WYM_JQUERY_PATH 354 + "'></script>" 355 + "<script type='text/javascript'" 356 + " src='" 357 + WYM_WYM_PATH 358 + "'></script>" 359 + "</head>" 360 + WYM_DIALOG_BODY 361 + "</html>", 341 dialogHtml: WYM_DIALOG_BODY, 362 342 363 dialogLinkHtml: "< bodyclass='wym_dialog wym_dialog_link'"343 dialogLinkHtml: "<div class='wym_dialog wym_dialog_link'" 364 344 + " onload='WYM_INIT_DIALOG(" + WYM_INDEX + ")'" 365 345 + ">" 366 346 + "<form>" … … 385 365 + "</div>" 386 366 + "</fieldset>" 387 367 + "</form>" 388 + "</ body>",368 + "</div>", 389 369 390 dialogImageHtml: "< bodyclass='wym_dialog wym_dialog_image'"370 dialogImageHtml: "<div class='wym_dialog wym_dialog_image'" 391 371 + " onload='WYM_INIT_DIALOG(" + WYM_INDEX + ")'" 392 372 + ">" 393 373 + "<form>" … … 416 396 + "</div>" 417 397 + "</fieldset>" 418 398 + "</form>" 419 + "</ body>",399 + "</div>", 420 400 421 dialogTableHtml: "< bodyclass='wym_dialog wym_dialog_table'"401 dialogTableHtml: "<div class='wym_dialog wym_dialog_table'" 422 402 + " onload='WYM_INIT_DIALOG(" + WYM_INDEX + ")'" 423 403 + ">" 424 404 + "<form>" … … 447 427 + "</div>" 448 428 + "</fieldset>" 449 429 + "</form>" 450 + "</ body>",430 + "</div>", 451 431 452 dialogPasteHtml: "< bodyclass='wym_dialog wym_dialog_paste'"432 dialogPasteHtml: "<div class='wym_dialog wym_dialog_paste'" 453 433 + " onload='WYM_INIT_DIALOG(" + WYM_INDEX + ")'" 454 434 + ">" 455 435 + "<form>" … … 469 449 + "</div>" 470 450 + "</fieldset>" 471 451 + "</form>" 472 + "</ body>",452 + "</div>", 473 453 474 dialogPreviewHtml: "< bodyclass='wym_dialog wym_dialog_preview'"454 dialogPreviewHtml: "<div class='wym_dialog wym_dialog_preview'" 475 455 + " onload='WYM_INIT_DIALOG(" + WYM_INDEX + ")'" 476 + "></ body>",456 + "></div>", 477 457 478 458 dialogStyles: [], 479 459 … … 976 956 */ 977 957 Wymeditor.prototype.dialog = function(sType) { 978 958 979 var wDialog = window.open(980 '',981 'dialog',982 this._wym._options.dialogFeatures);959 //~ var wDialog = window.open( 960 //~ '', 961 //~ 'dialog', 962 //~ this._wym._options.dialogFeatures); 983 963 984 if( wDialog) {964 if(1) { 985 965 986 966 var sBodyHtml = ""; 987 967 … … 1017 997 1018 998 dialogHtml = this.replaceStrings(dialogHtml); 1019 999 1020 var doc = wDialog.document; 1021 doc.write(dialogHtml); 1022 doc.close(); 1000 var e = $('<div id="dialogContent"><div id="test">test</div></div>'); 1001 e.html(dialogHtml); 1002 $(document.body).append(e); 1003 e.hide(); 1004 tb_show(this.replaceStrings(this.encloseString(sType)), "#TB_inline?height=300&width=560&inlineId=dialogContent"); 1005 WYM_INIT_DIALOG(this._index); 1006 $("#TB_window").unload(function () { 1007 e.remove(); 1008 }); 1023 1009 } 1024 1010 }; 1025 1011 … … 1223 1209 1224 1210 function WYM_INIT_DIALOG(index) { 1225 1211 1226 var wym = window. opener.WYM_INSTANCES[index];1212 var wym = window.WYM_INSTANCES[index]; 1227 1213 var doc = window.document; 1228 1214 var selected = wym.selected(); 1229 1215 var dialogType = jQuery(wym._options.dialogTypeSelector).val(); … … 1292 1278 link.attr(WYM_TITLE, jQuery(wym._options.titleSelector).val()); 1293 1279 } 1294 1280 } 1295 window.close();1281 tb_remove(); 1296 1282 }); 1297 1283 1284 console.log('IMAGE', wym._options.dialogImageSelector + " " 1285 + wym._options.submitSelector, jQuery(wym._options.dialogImageSelector + " " 1286 + wym._options.submitSelector)); 1298 1287 jQuery(wym._options.dialogImageSelector + " " 1299 1288 + wym._options.submitSelector).click(function() { 1300 1289 … … 1317 1306 image.attr(WYM_ALT, jQuery(wym._options.altSelector).val()); 1318 1307 } 1319 1308 } 1320 window.close();1309 tb_remove(); 1321 1310 }); 1322 1311 1323 1312 jQuery(wym._options.dialogTableSelector + " " … … 1349 1338 if(!node || !node.parentNode) jQuery(wym._doc.body).append(table); 1350 1339 else jQuery(node).after(table); 1351 1340 } 1352 window.close();1341 tb_remove(); 1353 1342 }); 1354 1343 1355 1344 jQuery(wym._options.dialogPasteSelector + " " … … 1357 1346 1358 1347 var sText = jQuery(wym._options.textSelector).val(); 1359 1348 wym.paste(sText); 1360 window.close();1349 tb_remove(); 1361 1350 }); 1362 1351 1363 1352 jQuery(wym._options.dialogPreviewSelector + " " … … 1366 1355 1367 1356 //cancel button 1368 1357 jQuery(wym._options.cancelSelector).mousedown(function() { 1369 window.close();1358 tb_remove(); 1370 1359 }); 1371 1360 1372 1361 //pre-init functions -
src/examples/01-basic.html
22 22 <title>WYMeditor</title> 23 23 <link rel="stylesheet" type="text/css" media="screen" href="styles.css" /> 24 24 <link rel="stylesheet" type="text/css" media="screen" href="../wymeditor/skins/default/screen.css" /> 25 <link rel="stylesheet" type="text/css" media="screen" href="../wymeditor/skins/default/thickbox.css" /> 25 26 <script type="text/javascript" src="../jquery/jquery.js"></script> 27 <script type="text/javascript" src="../jquery/thickbox.js"></script> 26 28 <script type="text/javascript" src="../wymeditor/jquery.wymeditor.pack.js"></script> 27 29 28 30 <script type="text/javascript">