(bug 9437) Don't overwrite edit form submission handler when setting up edit box...
authorRob Church <robchurch@users.mediawiki.org>
Fri, 3 Aug 2007 17:40:21 +0000 (17:40 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 3 Aug 2007 17:40:21 +0000 (17:40 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
skins/common/wikibits.js

index a55bb73..19f8036 100644 (file)
@@ -348,7 +348,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   cases.
 * Fix RTL display of the upload form.
 * Fixed regression in blocking of username '0'
-
+* (bug 9437) Don't overwrite edit form submission handler when setting up
+  edit box scroll position preserve/restore behaviour
 
 == API changes since 1.10 ==
 
index f802ac0..241f63f 100644 (file)
@@ -1195,7 +1195,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches don't keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '95';
+$wgStyleVersion = '96';
 
 
 # Server-side caching:
index 1e37e3c..454b733 100644 (file)
@@ -778,20 +778,23 @@ function toggle_element_check(ida,idb) {
        document.getElementById(idb).checked=false;
 }
 
+/**
+ * Restore the edit box scroll state following a preview operation,
+ * and set up a form submission handler to remember this state
+ */
 function scrollEditBox() {
-       var editBoxEl = document.getElementById("wpTextbox1");
-       var scrollTopEl = document.getElementById("wpScrolltop");
-       var editFormEl = document.getElementById("editform");
-
-       if (editBoxEl && scrollTopEl) {
-               if (scrollTopEl.value) { editBoxEl.scrollTop = scrollTopEl.value; }
-               editFormEl.onsubmit = function() {
-                       document.getElementById("wpScrolltop").value = document.getElementById("wpTextbox1").scrollTop;
-               };
+       var editBox = document.getElementById( 'wpTextbox1' );
+       var scrollTop = document.getElementById( 'wpScrolltop' );
+       var editForm = document.getElementById( 'editform' );
+       if( editBox && scrollTop ) {
+               if( scrollTop.value )
+                       editBox.scrollTop = scrollTop.value;
+               addHandler( editForm, 'submit', function() {
+                       document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; 
+               } );
        }
 }
-
-hookEvent("load", scrollEditBox);
+hookEvent( 'load', scrollEditBox );
 
 var allmessages_nodelist = false;
 var allmessages_modified = false;