mediawiki.action.edit.preview: Disable if there is no #wpTextbox1
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Thu, 19 Mar 2015 21:45:53 +0000 (22:45 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sun, 22 Mar 2015 11:57:54 +0000 (11:57 +0000)
ProofreadPage has custom editforms for Index pages, which are not
supported by the API. These editforms have no #wpTextbox1, so disable
live preview in that case.

Bug: T78709
Change-Id: I90cba79e5a4a756454741c4070ebdf620520ab55

resources/src/mediawiki.action/mediawiki.action.edit.preview.js

index 3bf8e32..84bde7d 100644 (file)
        $( function () {
                // Do not enable on user .js/.css pages, as there's no sane way of "previewing"
                // the scripts or styles without reloading the page.
-               if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length ) {
+               // Do not enable for ProofreadPage Index page editors, which have no textbox
+               if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length || $( '#wpTextbox1' ).length === 0 ) {
                        return;
                }