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.
Make this check on click avoid T94089.
Bug: T78709
Change-Id: I628d3b226a4294f2878fc4175080a975fd86e507
*/
function doLivePreview( e ) {
var isDiff, api, request, postData, copySelectors, section,
*/
function doLivePreview( e ) {
var isDiff, api, request, postData, copySelectors, section,
- $wikiPreview, $wikiDiff, $editform, $copyElements, $spinner, $errorBox;
+ $wikiPreview, $wikiDiff, $editform, $textbox, $summary, $copyElements, $spinner, $errorBox;
isDiff = ( e.target.name === 'wpDiff' );
$wikiPreview = $( '#wikiPreview' );
$wikiDiff = $( '#wikiDiff' );
$editform = $( '#editform' );
isDiff = ( e.target.name === 'wpDiff' );
$wikiPreview = $( '#wikiPreview' );
$wikiDiff = $( '#wikiDiff' );
$editform = $( '#editform' );
+ $textbox = $editform.find( '#wpTextbox1' );
+ $summary = $editform.find( '#wpSummary' );
$errorBox = $( '.errorbox' );
section = $editform.find( '[name="wpSection"]' ).val();
$errorBox = $( '.errorbox' );
section = $editform.find( '[name="wpSection"]' ).val();
+ if ( $textbox.length === 0 ) {
+ return;
+ }
// Show changes for a new section is not yet supported
if ( isDiff && section === 'new' ) {
return;
// Show changes for a new section is not yet supported
if ( isDiff && section === 'new' ) {
return;
action: 'parse',
uselang: mw.config.get( 'wgUserLanguage' ),
title: mw.config.get( 'wgPageName' ),
action: 'parse',
uselang: mw.config.get( 'wgUserLanguage' ),
title: mw.config.get( 'wgPageName' ),
- text: $editform.find( '#wpTextbox1' ).textSelection( 'getContents' ),
- summary: $editform.find( '#wpSummary' ).textSelection( 'getContents' )
+ text: $textbox.textSelection( 'getContents' ),
+ summary: $summary.textSelection( 'getContents' )
};
if ( section !== '' ) {
};
if ( section !== '' ) {