mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 10:48:42 +00:00
Merge "Use subpage only for media search string"
This commit is contained in:
commit
55952a32b3
|
@ -374,7 +374,7 @@ class VisualEditorHooks {
|
|||
* Adds extra variables to the page config.
|
||||
*/
|
||||
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
||||
global $wgStylePath, $wgSVGMaxSize;
|
||||
global $wgStylePath, $wgSVGMaxSize, $wgNamespacesWithSubpages;
|
||||
|
||||
$pageLanguage = $out->getTitle()->getPageLanguage();
|
||||
|
||||
|
@ -387,6 +387,7 @@ class VisualEditorHooks {
|
|||
'pageLanguageCode' => $pageLanguage->getHtmlCode(),
|
||||
'pageLanguageDir' => $pageLanguage->getDir(),
|
||||
'svgMaxSize' => $wgSVGMaxSize,
|
||||
'namespacesWithSubpages' => $wgNamespacesWithSubpages
|
||||
);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -18,10 +18,20 @@
|
|||
* @param {number} [size] Vertical size of thumbnails
|
||||
*/
|
||||
ve.ui.MWMediaSearchWidget = function VeUiMWMediaSearchWidget( config ) {
|
||||
var pageTitle = mw.config.get( 'wgTitle' ),
|
||||
namespace = mw.config.get( 'wgNamespaceNumber' ),
|
||||
namespacesWithSubpages = mw.config.get( 'wgVisualEditor' ).namespacesWithSubpages;
|
||||
|
||||
if ( namespacesWithSubpages[ namespace ] ) {
|
||||
// If we are in a namespace that allows for subpages, strip the entire
|
||||
// title except for the part after the last /
|
||||
pageTitle = pageTitle.substr( pageTitle.lastIndexOf( '/' ) + 1 );
|
||||
}
|
||||
|
||||
// Configuration intialization
|
||||
config = ve.extendObject( {
|
||||
'placeholder': ve.msg( 'visualeditor-media-input-placeholder' ),
|
||||
'value': mw.config.get( 'wgTitle' )
|
||||
'value': pageTitle
|
||||
}, config );
|
||||
|
||||
// Parent constructor
|
||||
|
|
Loading…
Reference in a new issue