diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 08d007fde1..17e5117d24 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -57,6 +57,15 @@ class VisualEditorHooks { 'ext.visualEditor.targetLoader' ) ); $output->addModuleStyles( array( 'ext.visualEditor.viewPageTarget.noscript' ) ); + // add scroll offset js variable to output + $veConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); + $skinsToolbarScrollOffset = $veConfig->get( 'VisualEditorSkinToolbarScrollOffset' ); + $toolbarScrollOffset = 0; + $skinName = $skin->getSkinName(); + if ( isset( $skinsToolbarScrollOffset[$skinName] ) ) { + $toolbarScrollOffset = $skinsToolbarScrollOffset[$skinName]; + } + $output->addJsConfigVars( 'wgVisualEditorToolbarScrollOffset', $toolbarScrollOffset ); return true; } diff --git a/extension.json b/extension.json index a6d5d838ed..99b8040c04 100644 --- a/extension.json +++ b/extension.json @@ -98,6 +98,7 @@ "VisualEditorEnableTocWidget": false, "VisualEditorAutoAccountEnable": false, "VisualEditorAvailableNamespaces": { "2": true }, + "VisualEditorSkinToolbarScrollOffset": [], "VisualEditorParsoidTimeout": 100 }, "APIModules": { diff --git a/modules/ve-mw/init/ve.init.mw.Target.js b/modules/ve-mw/init/ve.init.mw.Target.js index 63917fcc24..1cbe940056 100644 --- a/modules/ve-mw/init/ve.init.mw.Target.js +++ b/modules/ve-mw/init/ve.init.mw.Target.js @@ -20,7 +20,12 @@ */ ve.init.mw.Target = function VeInitMwTarget( pageName, revisionId ) { // Parent constructor - ve.init.Target.call( this, { shadow: true, actions: true, floatable: true } ); + ve.init.Target.call( this, { + shadow: true, + actions: true, + floatable: true, + scrollOffset: mw.config.get( 'wgVisualEditorToolbarScrollOffset', 0 ) + } ); // Properties this.pageName = pageName;