[interchange-cvs] interchange - ton modified code/Widget/htmlarea.widget

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Feb 21 08:16:43 EST 2007


User:      ton
Date:      2007-02-21 13:16:43 GMT
Modified:  code/Widget htmlarea.widget
Log:
	Fixed problem with FCK Editor where it was only possible
	to have one instance of the editor on the same page.

	The existing value of the window.onload event got overwritten
	by any additional instance of the editor.

Revision  Changes    Path
1.13      +15 -3     interchange/code/Widget/htmlarea.widget


rev 1.13, prev_rev 1.12
Index: htmlarea.widget
===================================================================
RCS file: /var/cvs/interchange/code/Widget/htmlarea.widget,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- htmlarea.widget	17 Jan 2007 13:52:07 -0000	1.12
+++ htmlarea.widget	21 Feb 2007 13:16:42 -0000	1.13
@@ -1,6 +1,6 @@
 # Copyright 2005 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: htmlarea.widget,v 1.12 2007/01/17 13:52:07 pajamian Exp $
+# $Id: htmlarea.widget,v 1.13 2007/02/21 13:16:42 ton Exp $
 
 CodeDef htmlarea Widget 1
 CodeDef htmlarea Description Rich text editor
@@ -119,15 +119,27 @@
 <script type="text/javascript" src="{PATH}fckeditor.js"></script>
 <script type="text/javascript">
    _editor_url = "{PATH}";
+
+   function addLoadEvent(func) {
+	var oldonload = window.onload;
+	if (typeof window.onload != 'function') {
+		window.onload = func;
+	} else {
+		window.onload = function() {
+		oldonload();
+		func();
+		}
+	}
+   }
 </script>|,
 					pre => qq|<script>
-window.onload = function()
+addLoadEvent(function()
 {
     var {NAME}FCKeditor = new FCKeditor( '{NAME}', '{WIDTH}', '{HEIGHT}' ) ;
     {NAME}FCKeditor.BasePath = _editor_url ;
 	{CONFIG?}{CONFIG}({NAME}FCKeditor);{/CONFIG?}
     {NAME}FCKeditor.ReplaceTextarea() ;
-}
+});
 
 </script>
 |,








More information about the interchange-cvs mailing list