[pLog-svn] r5802 - plog/trunk/js/editor

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed Aug 8 16:27:11 EDT 2007


Author: oscar
Date: 2007-08-08 16:27:11 -0400 (Wed, 08 Aug 2007)
New Revision: 5802

Modified:
   plog/trunk/js/editor/lifetypeeditor.js
Log:
If we use the DOM rather than document.write to add the markup code needed by the editor, things work better.


Modified: plog/trunk/js/editor/lifetypeeditor.js
===================================================================
--- plog/trunk/js/editor/lifetypeeditor.js	2007-08-07 20:51:11 UTC (rev 5801)
+++ plog/trunk/js/editor/lifetypeeditor.js	2007-08-08 20:27:11 UTC (rev 5802)
@@ -124,15 +124,19 @@
 		
 	  markup = '';
 	  
-	  document.write('<div class="textEditorToolbar" id="textEditorToolbar">');
+	  var container = document.createElement( 'div' );
+	  container.className = 'textEditorToolbar';
+	  container.id = 'textEditorToolbar';
 	  for( var buttonId in this.toolBar ) {
           if ( Lifetype.prototypeCompatibabilityCheck( buttonId ) )
 	          continue;
 	      button = this.toolBar[buttonId];
 	      markup += button.show(this.txtId, this.objName);
 	  }
-	  document.write(markup);
-	  document.write('</div>');
+
+	  container.innerHTML = markup;
+		
+	  document.getElementById( this.txtId ).parentNode.insertBefore( container, document.getElementById( this.txtId ));
 	  
 	  if( this.debug ) {
 		document.write('<textarea>'+markup+'</textarea>');
@@ -141,7 +145,7 @@
   
   // after initializing the buttons, we can generate the toolbar
   // we can't call this method after defining it!! :)
-  this.init();    
+  YAHOO.util.Event.addListener( window, 'load', this.init, this, true );
   
   /**
    * calls the edButton.execute() callback
@@ -727,7 +731,7 @@
  * @param type
  * @return nothing
  */
-Lifetype.UI.Editor.openResourceListWindow( type ) {
+Lifetype.UI.Editor.openResourceListWindow = function( type ) {
 	width  = 500;
 	height = 450;
 	



More information about the pLog-svn mailing list