Skip to content

Commit cae32c5

Browse files
namedgraphclaude
andcommitted
Preserve mode query param when navigating from links on proxied pages
ldh:DocumentNavigate dropped every query param other than uri when unwrapping a proxied href. Clicking ReadMode in the bs2:ModeList dropdown on ?uri=external&mode=X pushed ?uri=external (no mode), so ac:mode($results) fell through to content-block detection and the page snapped back to ContentMode. Local URLs were unaffected because their mode rides inside $uri itself. Add a $query-params parameter to ldh:DocumentNavigate threaded into ldh:href, and pass map:remove($query-params, 'uri') from both the link click handler and the popstate handler so back/forward also preserves the mode after a switch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 94bc699 commit cae32c5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client.xsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ WHERE
783783

784784
<xsl:template name="ldh:DocumentNavigate">
785785
<xsl:param name="uri" as="xs:anyURI"/>
786+
<xsl:param name="query-params" select="map{}" as="map(xs:string, xs:string*)"/>
786787
<xsl:param name="push-state" select="true()" as="xs:boolean"/>
787788
<xsl:param name="container" as="element()" select="id($body-id, ixsl:page())"/>
788789

@@ -794,7 +795,7 @@ WHERE
794795
<xsl:variable name="controller" select="ixsl:abort-controller()"/>
795796
<ixsl:set-property name="saxonController" select="$controller" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
796797

797-
<xsl:variable name="href" select="ldh:href($uri)" as="xs:anyURI"/>
798+
<xsl:variable name="href" select="ldh:href($uri, $query-params)" as="xs:anyURI"/>
798799

799800
<!-- update address bar input: show external URI, clear for local docs -->
800801
<xsl:for-each select="id('uri', ixsl:page())">
@@ -877,11 +878,12 @@ WHERE
877878

878879
<xsl:call-template name="ldh:DocumentNavigate">
879880
<xsl:with-param name="uri" select="$uri"/>
881+
<xsl:with-param name="query-params" select="map:remove($query-params, 'uri')"/>
880882
<xsl:with-param name="push-state" select="false()"/>
881883
</xsl:call-template>
882884
</xsl:if>
883885
</xsl:template>
884-
886+
885887
<!-- do not intercept RDF download links -->
886888
<xsl:template match="button[@id = 'export-rdf']/following-sibling::ul//a" mode="ixsl:onclick" priority="1"/>
887889

@@ -895,6 +897,7 @@ WHERE
895897

896898
<xsl:call-template name="ldh:DocumentNavigate">
897899
<xsl:with-param name="uri" select="$uri"/>
900+
<xsl:with-param name="query-params" select="map:remove($query-params, 'uri')"/>
898901
</xsl:call-template>
899902
</xsl:template>
900903

0 commit comments

Comments
 (0)