TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/196443
Change subject: LivePreview: Support section=new for preview ...................................................................... LivePreview: Support section=new for preview Reproduce the new section behavior for the full submit preview. Diffing will require a bit more additional work in Api. Bug: T84877 Change-Id: Iec71fdc7ba09f91683214f3d65472ea2f72a06b1 --- M resources/src/mediawiki.action/mediawiki.action.edit.preview.js 1 file changed, 14 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/43/196443/1 diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index 7e7fe91..516e8a1 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -65,6 +65,14 @@ summary: $editform.find( '#wpSummary' ).textSelection( 'getContents' ) }; + if ( section !== '' ) { + postData.sectionpreview = ''; + postData.section = section; + if ( section === 'new' ) { + postData.sectiontitle = postData.summary; + } + } + if ( isDiff ) { $wikiPreview.hide(); @@ -104,9 +112,6 @@ 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, $content, $parent, $list; @@ -179,8 +184,7 @@ } ); } request.done( function ( response ) { - if ( response.parse.parsedsummary ) { - // TODO implement special behavior for section === 'new' + if ( response.parse.parsedsummary && section !== 'new' ) { $editform.find( '.mw-summary-preview' ) .empty() .append( @@ -244,6 +248,11 @@ ); } + // Show changes for a new section is not yet supported + if( $( '#editform [name="wpSection"]' ).val() === 'new' ) { + $( '#wpDiff' ).prop( 'disabled', true ); + } + // This should be moved down to '#editform', but is kept on the body for now // because the LiquidThreads extension is re-using this module with only half // the EditPage (doesn't include #editform presumably, bug 55463). -- To view, visit https://gerrit.wikimedia.org/r/196443 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iec71fdc7ba09f91683214f3d65472ea2f72a06b1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: TheDJ <hartman.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits