jenkins-bot has submitted this change and it was merged.
Change subject: Don't show edit pencils on main page
......................................................................
Don't show edit pencils on main page
They are unstyled and overlaps the notifications bell.
Follow up: I8d8d47cd608d59fb1723758106547f1ab137daa2
Bug: T89559
Change-Id: I8688ddda81d292b80e280f758d6d434f7c748aa7
(cherry picked from commit 830a70e413d4ce1241bf51888ab0e31a500a5395)
---
M includes/MobileFormatter.php
M javascripts/modules/editor/init.js
2 files changed, 24 insertions(+), 14 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index a95210e..f207104 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -250,18 +250,21 @@
*/
protected function headingTransform( $s, $tagName = 'h2' ) {
// add in-block class to all headings included in this section
(except the first one)
- $s = preg_replace_callback(
- '/<(h[1-6])>/si',
- function ( $match ) use ( $tagName ) {
- $tag = $match[1];
- $cssClass = '';
- if ( $tag !== $tagName ) {
- $cssClass = ' class="in-block"';
- }
- return '<' . $tag . $cssClass . '>';
- },
- $s
- );
+ // don't do this for the main page, it breaks things - Bug
190662
+ if ( !$this->mainPage ) {
+ $s = preg_replace_callback(
+ '/<(h[1-6])>/si',
+ function ( $match ) use ( $tagName ) {
+ $tag = $match[1];
+ $cssClass = '';
+ if ( $tag !== $tagName ) {
+ $cssClass = ' class="in-block"';
+ }
+ return '<' . $tag . $cssClass . '>';
+ },
+ $s
+ );
+ }
// Makes sections expandable
$tagRegEx = '<' . $tagName . '.*</' . $tagName . '>';
diff --git a/javascripts/modules/editor/init.js
b/javascripts/modules/editor/init.js
index d5fb544..101fd20 100644
--- a/javascripts/modules/editor/init.js
+++ b/javascripts/modules/editor/init.js
@@ -121,7 +121,8 @@
* @param {Page} page The page to edit.
*/
function setupEditor( page ) {
- var isNewPage = page.options.id === 0;
+ var isNewPage = page.options.id === 0,
+ $editPencils = $( '.edit-page' );
if ( query.undo ) {
window.alert( mw.msg(
'mobile-frontend-editor-undo-unsupported' ) );
}
@@ -199,7 +200,13 @@
}
}
- $( '.edit-page' ).show().on( 'click', function ( ev ) {
+ // enable all edit pencils on the page (not only toggleable
sections) except for the main
+ // page, the pencils are unstyled there, see bug T89559
+ // FIXME: Merge this with the line under it after main page
special handling is killed
+ if ( !mw.config.get( 'wgIsMainPage' ) ) {
+ $editPencils.show();
+ }
+ $editPencils.on( 'click', function ( ev ) {
// prevent folding section when clicking Edit
ev.stopPropagation();
} );
--
To view, visit https://gerrit.wikimedia.org/r/190984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8688ddda81d292b80e280f758d6d434f7c748aa7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.25wmf17
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Kaldari2 <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits