$wgOut->addModules( 'mediawiki.action.edit.editWarning' );
}
- if ( $wgAjaxEditStash ) {
- $wgOut->addModules( 'mediawiki.action.edit.stash' );
- }
-
# Enabled article-related sidebar, toplinks, etc.
$wgOut->setArticleRelated( true );
$wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) );
# Transmit the name of the message to JavaScript for live preview
# Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys
- $wgOut->addJsConfigVars( 'wgEditMessage', $msg );
+ $wgOut->addJsConfigVars( [
+ 'wgEditMessage' => $msg,
+ 'wgAjaxEditStash' => $wgAjaxEditStash,
+ ] );
}
/**
}
}
+ // Set a hidden field so JS knows what edit form mode we are in
+ if ( $this->isConflict ) {
+ $mode = 'conflict';
+ } elseif ( $this->preview ) {
+ $mode = 'preview';
+ } elseif ( $this->diff ) {
+ $mode = 'diff';
+ } else {
+ $mode = 'text';
+ }
+ $wgOut->addHTML( Html::hidden( 'mode', $mode, [ 'id' => 'mw-edit-mode' ] ) );
+
// Marker for detecting truncated form data. This must be the last
// parameter sent in order to be of use, so do not move me.
$wgOut->addHTML( Html::hidden( 'wpUltimateParam', true ) );
"<div id='mw-anon-edit-warning' class='warningbox'>\n$1\n</div>",
[ 'anoneditwarning',
// Log-in link
- '{{fullurl:Special:UserLogin|returnto={{FULLPAGENAMEE}}}}',
+ SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( [
+ 'returnto' => $this->getTitle()->getPrefixedDBkey()
+ ] ),
// Sign-up link
- '{{fullurl:Special:CreateAccount|returnto={{FULLPAGENAMEE}}}}' ]
+ SpecialPage::getTitleFor( 'CreateAccount' )->getFullURL( [
+ 'returnto' => $this->getTitle()->getPrefixedDBkey()
+ ] )
+ ]
);
} else {
$wgOut->wrapWikiMsg( "<div id=\"mw-anon-preview-warning\" class=\"warningbox\">\n$1</div>",
$cancelParams = [];
if ( !$this->isConflict && $this->oldid > 0 ) {
$cancelParams['oldid'] = $this->oldid;
+ } elseif ( $this->getContextTitle()->isRedirect() ) {
+ $cancelParams['redirect'] = 'no';
}
$attrs = [ 'id' => 'mw-editform-cancel' ];
*/
function getPreviewText() {
global $wgOut, $wgUser, $wgRawHtml, $wgLang;
- global $wgAllowUserCss, $wgAllowUserJs, $wgAjaxEditStash;
+ global $wgAllowUserCss, $wgAllowUserJs;
$stats = $wgOut->getContext()->getStats();
$this->mTitle, $pstContent, $wgUser );
$parserOutput = $pstContent->getParserOutput( $this->mTitle, null, $parserOptions );
- # Try to stash the edit for the final submission step
- # @todo: different date format preferences cause cache misses
- if ( $wgAjaxEditStash ) {
- ApiStashEdit::stashEditFromPreview(
- $this->getArticle(), $content, $pstContent,
- $parserOutput, $parserOptions, $parserOptions, wfTimestampNow()
- );
- }
-
$parserOutput->setEditSectionTokens( false ); // no section edit links
$previewHTML = $parserOutput->getText();
$this->mParserOutput = $parserOutput;