mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Properly handle preview scenario for Parsoid rendering
* Removed a wikiech-specific hack and use the now available ParserOutput flag. Change-Id: Ia06025c131485a9dc67afd8258fa4b3753d165b9
This commit is contained in:
parent
46a3e15dfb
commit
3b2de5b10e
|
@ -15,6 +15,7 @@ use MediaWiki\Extension\DiscussionTools\CommentFormatter;
|
||||||
use MediaWiki\Hook\GetDoubleUnderscoreIDsHook;
|
use MediaWiki\Hook\GetDoubleUnderscoreIDsHook;
|
||||||
use MediaWiki\Hook\ParserAfterTidyHook;
|
use MediaWiki\Hook\ParserAfterTidyHook;
|
||||||
use MediaWiki\Hook\ParserOutputPostCacheTransformHook;
|
use MediaWiki\Hook\ParserOutputPostCacheTransformHook;
|
||||||
|
use MediaWiki\Parser\ParserOutputFlags;
|
||||||
use MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter;
|
use MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter;
|
||||||
use MediaWiki\Parser\Parsoid\ParsoidParser;
|
use MediaWiki\Parser\Parsoid\ParsoidParser;
|
||||||
use MediaWiki\Title\Title;
|
use MediaWiki\Title\Title;
|
||||||
|
@ -86,14 +87,7 @@ class ParserHooks implements
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function onParserOutputPostCacheTransform( $parserOutput, &$text, &$options ): void {
|
public function onParserOutputPostCacheTransform( $parserOutput, &$text, &$options ): void {
|
||||||
// TEMPORARY for wikitech visualdiff testing: Pin this to false so we
|
$isPreview = $parserOutput->getOutputFlag( ParserOutputFlags::IS_PREVIEW );
|
||||||
// always render reply links (for anon users as well) to match current
|
|
||||||
// behavior which also lets us run a truer visual diff with DT.
|
|
||||||
//
|
|
||||||
// NOTE: This is a temporary proxy for 'isPreview' flag in ParserOptions.
|
|
||||||
// It is not clear whether 'editsectionEditLinks' is disabled only for previews.
|
|
||||||
// $isPreview = empty( $options['enableSectionEditLinks'] );
|
|
||||||
$isPreview = false;
|
|
||||||
|
|
||||||
// We want to run this hook only on Parsoid HTML for now.
|
// We want to run this hook only on Parsoid HTML for now.
|
||||||
// (and leave the onParserAfterTidy handler for legacy HTML).
|
// (and leave the onParserAfterTidy handler for legacy HTML).
|
||||||
|
|
Loading…
Reference in a new issue