mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Merge "Overwrite "edit source" link only when needed"
This commit is contained in:
commit
443cb0fe55
|
@ -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' ] );
|
||||
|
|
Loading…
Reference in a new issue