Changeset 69
- Timestamp:
- 04/13/05 10:04:25 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/htmlarea.js
r64 r69 1385 1385 } 1386 1386 1387 HTMLArea.prototype.editorIsActivated = function() { 1388 try { 1389 if (HTMLArea.is_gecko) return (this._doc.designMode == 'on'); 1390 else return (this._doc.body.contentEditable); 1391 } catch (e) 1392 { 1393 return false; 1394 } 1395 } 1396 1387 1397 HTMLArea.prototype.activateEditor = function() 1388 1398 { 1389 1399 if (HTMLArea.is_gecko && this._doc.designMode != 'on') 1390 { 1391 try{HTMLArea.last_on.designMode = 'off';} catch(e) { } 1392 if(this._iframe.style.display == 'none') 1400 try { 1401 1402 // cannot set design mode if no display 1403 if (this._iframe.style.display == 'none') 1393 1404 { 1394 1405 this._iframe.style.display = ''; … … 1400 1411 this._doc.designMode = 'on'; 1401 1412 } 1402 } 1413 } catch (e) {} 1403 1414 else 1404 1415 { 1405 1416 this._doc.body.contentEditable = true; 1406 1417 } 1407 HTMLArea.last_on = this._doc;1408 1418 } 1409 1419 1410 1420 HTMLArea.prototype.deactivateEditor = function() 1411 1421 { 1412 if(HTMLArea.is_gecko && this._doc.designMode == 'on') 1413 { 1414 this._doc.designMode = 'off'; 1415 HTMLArea.last_on = null; 1422 if (HTMLArea.is_gecko && this._doc.designMode != 'off') 1423 { 1424 try {this._doc.designMode = 'off';} catch (e) {} 1416 1425 } 1417 1426 else … … 1427 1436 try 1428 1437 { 1429 doc = editor._iframe.contentWindow.document; 1430 if (!doc) { 1431 // Try again.. 1432 // FIXME: don't know what else to do here. Normally 1433 // we'll never reach this point. 1438 if (editor._iframe.contentDocument) 1439 { 1440 this._doc = editor._iframe.contentDocument; 1441 } 1442 else 1443 { 1444 this._doc = editor._iframe.contentWindow.document; 1445 } 1446 doc = this._doc; 1447 if (!doc) { // try later 1434 1448 if (HTMLArea.is_gecko) { 1435 1449 setTimeout(function() { editor.initIframe()}, 50); … … 1439 1453 } 1440 1454 } 1455 editor.activateEditor(); 1441 1456 } 1442 1457 catch(e) 1443 { 1458 { // try later 1444 1459 setTimeout(function() { editor.initIframe()}, 50); 1445 1460 } 1446 1461 1462 doc.open(); 1447 1463 if (!editor.config.fullPage) { 1448 doc.open();1449 1464 var html = "<html>\n"; 1450 1465 html += "<head>\n"; … … 1476 1491 html += "</body>\n"; 1477 1492 html += "</html>"; 1478 doc.write(html);1479 doc.close();1480 1493 } else { 1481 1494 var html = editor.inwardHtml(editor._textArea.value); … … 1484 1497 html = html.replace(HTMLArea.RE_doctype, ""); 1485 1498 } 1486 doc.open();1487 1488 1489 }1490 1491 this._doc = doc;1492 1493 // If we have multiple editors some bug in Mozilla makes some lose editing ability1499 } 1500 doc.write(html); 1501 doc.close(); 1502 1503 // redo it for some obscure reason that IE need it.. 1504 editor.activateEditor(); 1505 1506 // if we have multiple editors some bug in Mozilla makes some lose editing ability 1494 1507 if(HTMLArea.is_gecko) 1495 1508 { … … 1499 1512 function() { editor.activateEditor(); } 1500 1513 ); 1501 }1502 else1503 {1504 editor.activateEditor();1505 1514 } 1506 1515 … … 1519 1528 } 1520 1529 1521 if(typeof editor._onGenerate == "function") { editor._onGenerate();} 1522 1523 setTimeout(function() { 1524 // editor.updateToolbar(); 1530 // specific editor initialization 1531 if(typeof editor._onGenerate == "function") { 1532 editor._onGenerate(); 1533 } 1534 1535 // update toolbar (hope this will arrive enough late...) 1536 editor._timerToolbar = setTimeout(function() { 1537 editor.updateToolbar(); 1538 editor._timerToolbar = null; 1525 1539 }, 250); 1526 1527 if (typeof editor.onGenerate == "function")1528 editor.onGenerate();1529 1540 } 1530 1541 … … 1932 1943 { 1933 1944 // We don't want to focus the field unless at least one field has been activated. 1934 if( HTMLArea.last_on)1945 if(!this.editorIsActivated()) 1935 1946 { 1936 1947 this.activateEditor(); … … 4669 4680 for(var x = 0; x < editor_names.length; x++) 4670 4681 { 4671 editors[editor_names[x]] = new HTMLArea(editor_names[x], HTMLArea.cloneObject(default_config)); 4672 if(plugin_names) 4673 { 4674 for(var i = 0; i < plugin_names.length; i++) 4675 { 4676 editors[editor_names[x]].registerPlugin(eval(plugin_names[i])); 4677 } 4678 } 4682 var editor = new HTMLArea(editor_names[x], HTMLArea.cloneObject(default_config)); 4683 editor.registerPlugins(plugin_names); 4684 editors[editor_names[x]] = editor; 4679 4685 } 4680 4686 return editors;
Note: See TracChangeset
for help on using the changeset viewer.