From c2b9f7d074bbedf8b90d42a51c5566e2e1dd42df Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Mon, 9 Sep 2019 15:00:01 -0700 Subject: [PATCH] Standardise preview warning box when using ?action=edit If editing without JS, and clicking preview on action=edit you will see a preview with a note at the top of the page. McrUndoAction.php uses a close copy of the same code and will be amended accordingly. Currently this is using a class `.previewnote` and not the standardised and semantic "warningbox". The messages of the preview will now be warningbox's - see screenshots for end result: * https://phabricator.wikimedia.org/F30284946 * https://phabricator.wikimedia.org/F30284947 Bug: T232414 Change-Id: Ib678f03e908fa9dcd5af7632941475203478abf7 --- includes/EditPage.php | 8 +++++--- includes/actions/McrUndoAction.php | 5 +++-- resources/src/mediawiki.legacy/shared.css | 6 ------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index c346b750d9..fc9c577fae 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4045,11 +4045,11 @@ ERROR; if ( $this->isConflict ) { $conflict = Html::rawElement( - 'h2', [ 'id' => 'mw-previewconflict' ], + 'div', [ 'id' => 'mw-previewconflict', 'class' => 'warningbox' ], $this->context->msg( 'previewconflict' )->escaped() ); } else { - $conflict = '
'; + $conflict = ''; } $previewhead = Html::rawElement( @@ -4058,7 +4058,9 @@ ERROR; 'h2', [ 'id' => 'mw-previewheader' ], $this->context->msg( 'preview' )->escaped() ) . - $out->parseAsInterface( $note ) . $conflict + Html::rawElement( 'div', [ 'class' => 'warningbox' ], + $out->parseAsInterface( $note ) + ) . $conflict ); $pageViewLang = $this->mTitle->getPageViewLanguage(); diff --git a/includes/actions/McrUndoAction.php b/includes/actions/McrUndoAction.php index 41cd24e701..68c0ea1243 100644 --- a/includes/actions/McrUndoAction.php +++ b/includes/actions/McrUndoAction.php @@ -289,8 +289,9 @@ class McrUndoAction extends FormAction { 'h2', [ 'id' => 'mw-previewheader' ], $this->context->msg( 'preview' )->text() ) . - $out->parseAsInterface( $note ) . - "
" + Html::rawElement( 'div', [ 'class' => 'warningbox' ], + $out->parseAsInterface( $note ) + ) ); $pageViewLang = $this->getTitle()->getPageViewLanguage(); diff --git a/resources/src/mediawiki.legacy/shared.css b/resources/src/mediawiki.legacy/shared.css index 2c88bdc7cd..75dae92404 100644 --- a/resources/src/mediawiki.legacy/shared.css +++ b/resources/src/mediawiki.legacy/shared.css @@ -436,15 +436,9 @@ a.new { /* Note on preview page */ .previewnote { - color: #d33; margin-bottom: 1em; } -.previewnote p { - text-indent: 3em; - margin: 0.8em 0; -} - .visualClear { clear: both; } -- 2.20.1