Merge "Overwrite "edit source" link only when needed"

This commit is contained in:
jenkins-bot 2020-04-01 21:51:56 +00:00 committed by Gerrit Code Review
commit 443cb0fe55

View file

@ -648,6 +648,23 @@
// The below duplicates the functionality of VisualEditorHooks::onSkinTemplateNavigation()
// in case we're running on a cached page that doesn't have these tabs yet.
// Alter the edit tab (#ca-edit)
if ( $( '#ca-view-foreign' ).length ) {
if ( tabMessages[ action + 'localdescriptionsource' ] !== null ) {
// The following messages can be used here:
// * editlocaldescriptionsource
// * createlocaldescriptionsource
$caEditLink.text( mw.msg( tabMessages[ action + 'localdescriptionsource' ] ) );
}
} else {
if ( tabMessages[ action + 'source' ] !== null ) {
// The following messages can be used here:
// * editsource
// * createsource
$caEditLink.text( mw.msg( tabMessages[ action + 'source' ] ) );
}
}
// If there is no edit tab or a view-source tab,
// the user doesn't have permission to edit.
if ( $caEdit.length && !$caSource.length ) {
@ -706,23 +723,6 @@
$( '#ca-addsection' ).off( '.ve-target' ).on( 'click.ve-target', init.onEditTabClick.bind( init, 'source' ) );
}
// Alter the edit tab (#ca-edit)
if ( $( '#ca-view-foreign' ).length ) {
if ( tabMessages[ action + 'localdescriptionsource' ] !== null ) {
// The following messages can be used here:
// * editlocaldescriptionsource
// * createlocaldescriptionsource
$caEditLink.text( mw.msg( tabMessages[ action + 'localdescriptionsource' ] ) );
}
} else {
if ( tabMessages[ action + 'source' ] !== null ) {
// The following messages can be used here:
// * editsource
// * createsource
$caEditLink.text( mw.msg( tabMessages[ action + 'source' ] ) );
}
}
if ( isMinerva ) {
// Minerva hides the link text - display tiny icons instead
mw.loader.load( [ 'oojs-ui.styles.icons-editing-advanced', 'oojs-ui.styles.icons-accessibility' ] );