mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
0cd6c90d5a
This makes the "direct" client and the VRS based client implement the same interface, so the caller doesn't have to know which one it is using. It looks like ParsoidHelper will not be needed if we use this approach. Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* ServiceWiring files for VisualEditor.
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\VisualEditor;
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
use MediaWiki\Logger\LoggerFactory;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
VisualEditorHookRunner::SERVICE_NAME => static function ( MediaWikiServices $services ): VisualEditorHookRunner {
|
|
return new VisualEditorHookRunner( $services->getHookContainer() );
|
|
},
|
|
|
|
VisualEditorParsoidClientFactory::SERVICE_NAME => static function (
|
|
MediaWikiServices $services
|
|
): VisualEditorParsoidClientFactory {
|
|
$isPrivateWiki = !$services->getPermissionManager()->isEveryoneAllowed( 'read' );
|
|
|
|
return new VisualEditorParsoidClientFactory(
|
|
new ServiceOptions(
|
|
VisualEditorParsoidClientFactory::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig(),
|
|
[
|
|
VisualEditorParsoidClientFactory::ENABLE_COOKIE_FORWARDING => $isPrivateWiki
|
|
]
|
|
),
|
|
$services->getParsoidSiteConfig(),
|
|
$services->getParsoidPageConfigFactory(),
|
|
$services->getParsoidDataAccess(),
|
|
$services->getGlobalIdGenerator(),
|
|
$services->getHttpRequestFactory(),
|
|
LoggerFactory::getInstance( 'VisualEditor' )
|
|
);
|
|
},
|
|
];
|