mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
61413c49eb
Works on VisualEditor Namespace Created VE api wrapper for parsoid service to roundtrip pages Change-Id: I3f2967730c1a3ece31b7262a46bef31ea8b38613
33 lines
722 B
PHP
33 lines
722 B
PHP
<?php
|
|
|
|
class VisualEditorHooks {
|
|
/**
|
|
* Adds VisualEditor JS to the output if in the correct namespace
|
|
*
|
|
* @param $output OutputPage
|
|
* @param $skin Skin
|
|
*/
|
|
public static function onPageDisplay( &$output, &$skin ) {
|
|
if ( self::loadVisualEditor( $output, $skin ) ) {
|
|
$output->addModules( array( 'ext.visualEditor.core' ) );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determines whether or not we should construct the loader.
|
|
*
|
|
* @param $output OutputPage
|
|
* @param $skin Skin
|
|
*/
|
|
public static function loadVisualEditor( &$output, &$skin ) {
|
|
// Vector skin supported for now.
|
|
if ( $skin->getSkinName() !== 'vector' ) {
|
|
return false;
|
|
}
|
|
//TODO: check namespace, user permissions...
|
|
return true;
|
|
}
|
|
|
|
}
|