Yurik has uploaded a new change for review. https://gerrit.wikimedia.org/r/317753
Change subject: Fix mapframe preview with enabled snapshot ...................................................................... Fix mapframe preview with enabled snapshot Bug: T149070 Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9 --- M includes/Tag/MapFrame.php M includes/Tag/TagHandler.php 2 files changed, 12 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer refs/changes/53/317753/1 diff --git a/includes/Tag/MapFrame.php b/includes/Tag/MapFrame.php index ecab4a9..ced690c 100644 --- a/includes/Tag/MapFrame.php +++ b/includes/Tag/MapFrame.php @@ -50,6 +50,11 @@ $framed = $caption !== null || $this->getText( 'frameless', null ) === null; $output = $this->parser->getOutput(); + $options = $this->parser->getOptions(); + + $useSnapshot = + $wgKartographerStaticMapframe && !$options->getIsPreview() && + !$options->getIsSectionPreview(); switch ( $wgKartographerFrameMode ) { /* Not implemented in Kartotherian yet @@ -88,11 +93,9 @@ */ case 'interactive': - if ( $wgKartographerStaticMapframe ) { - $output->addModules( 'ext.kartographer.staticframe' ); - } else { - $output->addModules( 'ext.kartographer.frame' ); - } + $output->addModules( $useSnapshot + ? 'ext.kartographer.staticframe' + : 'ext.kartographer.frame' ); $fullWidth = false; @@ -167,7 +170,7 @@ $attrs['style'] .= " width: {$width}; height: {$height};"; $attrs['class'] .= " {$containerClass} {$alignClasses[$this->align]}"; - return Html::rawElement( $wgKartographerStaticMapframe ? 'a' : 'div', $attrs ); + return Html::rawElement( $useSnapshot ? 'a' : 'div', $attrs ); } $attrs['style'] .= " height: {$height};"; @@ -176,7 +179,7 @@ $captionFrame = Html::rawElement( 'div', [ 'class' => 'thumbcaption' ], $this->parser->recursiveTagParse( $caption ) ); - $mapDiv = Html::rawElement( $wgKartographerStaticMapframe ? 'a' : 'div', $attrs ); + $mapDiv = Html::rawElement( $useSnapshot ? 'a' : 'div', $attrs ); return Html::rawElement( 'div', [ 'class' => $containerClass ], Html::rawElement( 'div', [ diff --git a/includes/Tag/TagHandler.php b/includes/Tag/TagHandler.php index 7412e71..2b8b6a0 100644 --- a/includes/Tag/TagHandler.php +++ b/includes/Tag/TagHandler.php @@ -303,6 +303,8 @@ $options = $parser->getOptions(); if ( $data && ( $options->getIsPreview() || $options->getIsSectionPreview() ) ) { $output->addJsConfigVars( 'wgKartographerLiveData', $data ); + // Preview generates HTML that is different from normal + $output->updateCacheExpiry( 0 ); } else { $interact = $state->getInteractiveGroups(); $requested = $state->getRequestedGroups(); -- To view, visit https://gerrit.wikimedia.org/r/317753 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib5c43b9f18ad3c94171b0f26962600773bd5f8c9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Kartographer Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits