From 975d632d12a266685bc5da071b07048e2324ed5a Mon Sep 17 00:00:00 2001 From: Baha Date: Tue, 1 Aug 2017 18:11:25 -0400 Subject: [PATCH] Use lead section when editing page without section marks The config variable `MFNamespacesWithoutCollapsibleSections` controls namespaces where section collapsing is disabled. In those namespaces page is not divided into sections marked with `.mf-section-X` classes. If that's the case the edit button edits the first section, which is the whole page. Bug: T157995 Change-Id: I3ec353575529c1fb11a33fc35c9886cf232e327f --- resources/skins.minerva.editor/init.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/skins.minerva.editor/init.js b/resources/skins.minerva.editor/init.js index 1def74e..675b94b 100644 --- a/resources/skins.minerva.editor/init.js +++ b/resources/skins.minerva.editor/init.js @@ -250,8 +250,11 @@ $( '.nojs-edit' ).removeClass( 'nojs-edit' ); $( '#ca-edit a' ).remove(); // FIXME: unfortunately the main page is special cased. - if ( mw.config.get( 'wgIsMainPage' ) || isNewPage || ( leadSection && leadSection.text() ) ) { + if ( mw.config.get( 'wgIsMainPage' ) || isNewPage || + ( leadSection && leadSection.text() ) || page.getSections().length === 0 ) { // if lead section is not empty, open editor with lead section + // In some namespaces (controlled by MFNamespacesWithoutCollapsibleSections) + // sections are not marked. Use the lead section for such cases. addEditButton( 0, '#ca-edit' ); } else { // if lead section is empty or does not exist, open editor with first section