mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-24 02:38:29 +00:00
Merge "Fix editing of non-mobile-formatted pages"
This commit is contained in:
commit
fcc759ee19
|
@ -46,6 +46,7 @@
|
|||
}
|
||||
/**
|
||||
* Prepend an edit page button to the container
|
||||
* Remove any existing links in the container
|
||||
* @method
|
||||
* @ignore
|
||||
* @param {number} section number
|
||||
|
@ -53,6 +54,7 @@
|
|||
* @return {jQuery.Object} newly created edit page button
|
||||
*/
|
||||
function addEditButton( section, container ) {
|
||||
$( container ).find( 'a' ).remove();
|
||||
return $( '<a class="edit-page">' )
|
||||
.attr( {
|
||||
href: '#/editor/' + section,
|
||||
|
@ -256,15 +258,17 @@
|
|||
// FIXME: split the selector and cache it
|
||||
if ( $caEdit.find( '.edit-page' ).length === 0 ) {
|
||||
$( '.nojs-edit' ).removeClass( 'nojs-edit' );
|
||||
$( '#ca-edit a' ).remove();
|
||||
|
||||
if ( 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
|
||||
} else if ( leadSection !== null ) {
|
||||
// if lead section is empty open editor with first section
|
||||
// be careful not to do this when leadSection is null as this means MobileFormatter has not
|
||||
// been run and thus we could not identify the lead
|
||||
addEditButton( 1, '#ca-edit' );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue