SyntaxHighlightVisualEditorModule: Use Context::encodeJson() instead

Also fixes the Phan warning about Xml::encodeJsCall/FormatJson
needing booleaen where int inDebugMode() is passed.

Change-Id: Id8de16ab683948eae096b43462118ea837f53038
This commit is contained in:
Timo Tijhof 2021-02-18 04:59:40 +00:00 committed by Krinkle
parent 123f8677fc
commit fa20f69cf4

View file

@ -26,23 +26,16 @@ class ResourceLoaderSyntaxHighlightVisualEditorModule extends ResourceLoaderFile
*/
public function getScript( ResourceLoaderContext $context ) {
$scripts = parent::getScript( $context );
return $scripts . Xml::encodeJsCall(
've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages', [
$this->getPygmentsLanguages()
],
ResourceLoader::inDebugMode()
) . Xml::encodeJsCall(
've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap', [
SyntaxHighlightGeSHiCompat::getGeSHiToPygmentsMap()
],
ResourceLoader::inDebugMode()
) . Xml::encodeJsCall(
've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap', [
SyntaxHighlightAce::getPygmentsToAceMap()
],
ResourceLoader::inDebugMode()
);
return $scripts
. 've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages('
. $context->encodeJson( $this->getPygmentsLanguages() )
. ');'
. 've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap('
. $context->encodeJson( SyntaxHighlightGeSHiCompat::getGeSHiToPygmentsMap() )
. ');'
. 've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap('
. $context->encodeJson( SyntaxHighlightAce::getPygmentsToAceMap() )
. ');';
}
/**