Last modified: 2014-02-04 11:01:31 UTC
Upon clicking the Save Draft button, the page is normally saved and I am redirected to the page view, where my changes have been incorporated. A draft is not saved, the error console says ReferenceError: wgDraft is not defined. The following changes need to be applied to make it work: --- Drafts.hooks.php.bak 2013-01-12 20:28:03.000000000 +0100 +++ Drafts.hooks.php 2013-01-12 20:29:00.000000000 +0100 @@ -211,7 +211,7 @@ } $ajaxButton = Xml::escapeJsString( Xml::element( 'input', - array( 'type' => 'submit' ) + $buttonAttribs + array( 'type' => 'button' ) + $buttonAttribs + ( $wgRequest->getText( 'action' ) !== 'submit' ? array ( 'disabled' => 'disabled' ) : array() --- modules/ext.Drafts.js.bak 2013-01-12 20:08:37.000000000 +0100 +++ modules/ext.Drafts.js 2013-01-12 20:27:45.000000000 +0100 @@ -194,5 +194,5 @@ } } -var wgDraft = new Draft(); +window["wgDraft"] = new Draft(); wgDraft.initialize();
Hi! Thanks for your patch! You are welcome to use Developer access https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial Putting your branch in Git makes it easier for us to review it quickly. Thanks again! We appreciate your contribution.
Hi Ilia! Thanks for your patch! You are welcome to use Developer access https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial Putting your branch in Git makes it easier for us to review it quickly. Thanks again! We appreciate your contribution.
I used other way to solve this bug. I modify modules/ext.Drafts.js. You have to modify 2 position. line:121 line:135 BEFORE: // Sets timer to save automatically after a period of time timer = setTimeout( 'wgDraft.save()', configuration.autoSaveWait * 1000 ); AFTER: // Sets timer to save automatically after a period of time timer = setTimeout( function () {self.save()}, configuration.autoSaveWait * 1000 ); I use v1.21 . In IE9 & chrome & firefox,it can work.
*** Bug 55395 has been marked as a duplicate of this bug. ***
Confirming that this bug exists in current master (1.22), and I was able to reproduce it on 1.21 too.
I can easily reproduce this bug, but when I use &debug=true it works just fine. Also, Chromium and Firefox both handle this error differently. Firefox will submit the form and save the page (bug 55395), but Chromium just sits there.
Change 88151 had a related patch set uploaded by Legoktm: ReferenceError: wgDraft is not defined https://gerrit.wikimedia.org/r/88151
(In reply to comment #0) > --- Drafts.hooks.php.bak 2013-01-12 20:28:03.000000000 +0100 > +++ Drafts.hooks.php 2013-01-12 20:29:00.000000000 +0100 <snip> So this part was already committed for the most part. > --- modules/ext.Drafts.js.bak 2013-01-12 20:08:37.000000000 +0100 > +++ modules/ext.Drafts.js 2013-01-12 20:27:45.000000000 +0100 > @@ -194,5 +194,5 @@ > } > } > > -var wgDraft = new Draft(); > +window["wgDraft"] = new Draft(); > wgDraft.initialize(); I put this part in gerrit.
Change 88151 abandoned by Legoktm: ReferenceError: wgDraft is not defined https://gerrit.wikimedia.org/r/88151
(In reply to comment #9) > Change 88151 abandoned by Legoktm: As Yuvi pointed out, this is an ugly hack, and should be fixed in some other way.