From 81698d4c1605f491709e636acd5ca0e6857e3821 Mon Sep 17 00:00:00 2001 From: cenarium Date: Wed, 20 Jan 2016 21:43:47 +0100 Subject: [PATCH] Add class to EditPage text area when editing an old revision This adds a class 'mw-textarea-oldrev' to the editing area when an old page revision is edited. It seems that the warning MediaWiki:Editingold is not sufficient for some users and some css tweaks might be appreciated, as is already done for protected pages. Bug: T124226 Change-Id: Ifc53af0f827a5cebfd9cc220b0aa247210e8dcfc --- includes/EditPage.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/EditPage.php b/includes/EditPage.php index 770a74ec00..e8ea20f16a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -408,6 +408,11 @@ class EditPage { */ protected $context; + /** + * @var bool Whether an old revision is edited + */ + private $isOldRev = false; + /** * @param Article $article */ @@ -2968,6 +2973,7 @@ ERROR; if ( !$revision->isCurrent() ) { $this->mArticle->setOldSubtitle( $revision->getId() ); $wgOut->addWikiMsg( 'editingold' ); + $this->isOldRev = true; } } elseif ( $this->mTitle->exists() ) { // Something went wrong @@ -3278,6 +3284,10 @@ HTML $classes[] = 'mw-textarea-cprotected'; } } + # Is an old revision being edited? + if ( $this->isOldRev ) { + $classes[] = 'mw-textarea-oldrev'; + } $attribs = [ 'tabindex' => 1 ]; -- 2.20.1