mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
b029fd8ede
This patch introduces a factory service for creating VE Parsoid clients. NOTE: This patch also injects a GlobalIdGenerator to the client and avoids usage of deprecated UIDGenerator class. Change-Id: I787c0afb227308aab56770d14d62e08eb0084a6c
43 lines
1.2 KiB
PHP
43 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\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()
|
|
);
|
|
},
|
|
];
|