X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.action%2Fmediawiki.action.edit.preview.js;h=84bde7d2374c7b231979bc04ff26e0e83036f667;hb=c890a2fdefaae2551897ce2f1b9f39d82b435dc2;hp=68fbe33fb00ecb3c3d152451f94722ea1dc9226c;hpb=1e209d1e74cf2c0f5f78a3ca8014fc0af9d7f0a5;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index 68fbe33fb0..84bde7d237 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -101,14 +101,15 @@ $.extend( postData, { pst: '', preview: '', - prop: 'text|displaytitle|modules|categorieshtml|templates|langlinks|limitreporthtml' + prop: 'text|displaytitle|modules|categorieshtml|templates|langlinks|limitreporthtml', + disableeditsection: true } ); if ( section !== '' ) { postData.sectionpreview = ''; } request = api.post( postData ); request.done( function ( response ) { - var li, newList, $next, $parent, $list; + var li, newList, $content, $parent, $list; if ( response.parse.modules ) { mw.loader.load( response.parse.modules.concat( response.parse.modulescripts, @@ -162,23 +163,16 @@ } if ( response.parse.text['*'] ) { - $next = $wikiPreview.next(); - // If there is no next node, use parent instead. - // Only query parent if needed, false otherwise. - $parent = !$next.length && $wikiPreview.parent(); - - $wikiPreview + $content = $wikiPreview.children( '.mw-content-ltr,.mw-content-rtl' ); + $content .detach() .html( response.parse.text['*'] ); - mw.hook( 'wikipage.content' ).fire( $wikiPreview ); + mw.hook( 'wikipage.content' ).fire( $content ); // Reattach - if ( $parent ) { - $parent.append( $wikiPreview ); - } else { - $next.before( $wikiPreview ); - } + $wikiPreview.append( $content ); + $wikiPreview.show(); } @@ -211,7 +205,8 @@ $( 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; } @@ -244,6 +239,7 @@ if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) { $( '#wikiPreview' ).after( $( '
' ) + .hide() .attr( 'id', 'wikiDiff' ) .html( '' + '
' )