mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Merge "Server-side replace Edit=>Edit Source on talk NS"
This commit is contained in:
commit
02897451d2
|
@ -262,12 +262,6 @@ class VisualEditorHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
$availableNamespaces = $config->get( 'VisualEditorAvailableNamespaces' );
|
||||
// Exit if we're not in a VE-enabled namespace
|
||||
if ( !$title->inNamespaces( array_keys( array_filter( $availableNamespaces ) ) ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Exit if we're on a foreign file description page
|
||||
if (
|
||||
$title->inNamespace( NS_FILE ) &&
|
||||
|
@ -278,30 +272,35 @@ class VisualEditorHooks {
|
|||
}
|
||||
|
||||
$tabMessages = $config->get( 'VisualEditorTabMessages' );
|
||||
$veEditSection = $tabMessages['editsection'] !== null ?
|
||||
$tabMessages['editsection'] : 'editsection';
|
||||
$sourceEditSection = $tabMessages['editsectionsource'] !== null ?
|
||||
$tabMessages['editsectionsource'] : 'editsection';
|
||||
|
||||
$result['editsection']['text'] = $skin->msg( $sourceEditSection )->inLanguage( $lang )->text();
|
||||
|
||||
$veLink = array(
|
||||
'text' => $skin->msg( $veEditSection )->inLanguage( $lang )->text(),
|
||||
'targetTitle' => $title,
|
||||
'attribs' => $result['editsection']['attribs'] + array(
|
||||
'class' => 'mw-editsection-visualeditor'
|
||||
),
|
||||
'query' => array( 'veaction' => 'edit', 'vesection' => $section ),
|
||||
'options' => array( 'noclasses', 'known' )
|
||||
);
|
||||
$availableNamespaces = $config->get( 'VisualEditorAvailableNamespaces' );
|
||||
|
||||
$result['veeditsection'] = $veLink;
|
||||
if ( $config->get( 'VisualEditorTabPosition' ) === 'before' ) {
|
||||
krsort( $result );
|
||||
// TODO: This will probably cause weird ordering if any other extensions added something already.
|
||||
// ... wfArrayInsertBefore?
|
||||
// add VE edit section in VE available namespaces
|
||||
if ( $title->inNamespaces( array_keys( array_filter( $availableNamespaces ) ) ) ) {
|
||||
$veEditSection = $tabMessages['editsection'] !== null ?
|
||||
$tabMessages['editsection'] : 'editsection';
|
||||
$veLink = array(
|
||||
'text' => $skin->msg( $veEditSection )->inLanguage( $lang )->text(),
|
||||
'targetTitle' => $title,
|
||||
'attribs' => $result['editsection']['attribs'] + array(
|
||||
'class' => 'mw-editsection-visualeditor'
|
||||
),
|
||||
'query' => array( 'veaction' => 'edit', 'vesection' => $section ),
|
||||
'options' => array( 'noclasses', 'known' )
|
||||
);
|
||||
|
||||
$result['veeditsection'] = $veLink;
|
||||
if ( $config->get( 'VisualEditorTabPosition' ) === 'before' ) {
|
||||
krsort( $result );
|
||||
// TODO: This will probably cause weird ordering if any other extensions added something
|
||||
// already.
|
||||
// ... wfArrayInsertBefore?
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,3 @@
|
|||
margin-left: 0.25em;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* Must have the same, or higher, specificity (4x class/pseudo-class) as the rule above */
|
||||
.client-js.ve-not-available .mw-content-ltr .mw-editsection-bracket,
|
||||
.client-js.ve-not-available .mw-content-rtl .mw-editsection-bracket {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue