Compare commits

..

1 Commits

Author SHA1 Message Date
Nolann B. 262749a0b1 Copy the current spec's server in OpenAPI endpoint URLs (#4794) 2026-11-16 20:12:40 +01:00
5 changed files with 12 additions and 12 deletions
-5
View File
@@ -1,5 +0,0 @@
---
"gitbook": patch
---
Fade the bottom of collapsed code blocks so readers can tell there is more code, matching the editor.
@@ -0,0 +1,5 @@
---
"@gitbook/react-openapi": patch
---
Copy the current spec's server in OpenAPI endpoint URLs instead of a server kept from a previously visited page.
@@ -180,11 +180,7 @@ function CodeBlockExpandable(props: {
<div
className={tcls(
!isExpanded
? [
'[&_pre]:h-[calc(2rem+var(--line-count)*var(--line-height))] [&_pre]:overflow-y-hidden',
// Mask the code rather than the pre to keep its border, with stops on the visible lines.
'[&_code]:mask-b-from-[calc((var(--line-count)+1)*var(--line-height)*0.55)] [&_code]:mask-b-to-[calc((var(--line-count)+1)*var(--line-height))]',
]
? '[&_pre]:h-[calc(2rem+var(--line-count)*var(--line-height))] [&_pre]:overflow-y-hidden'
: ''
)}
style={
@@ -127,7 +127,8 @@ export const CodeBlockRenderer = forwardRef(function CodeBlockRenderer(
<code
className={tcls(
'table max-h-full w-fit min-w-full [counter-reset:line] print:max-h-none print:whitespace-pre-wrap',
withWrap && 'whitespace-pre-wrap'
withWrap && 'whitespace-pre-wrap',
'[[aria-expanded=false]_&]:mask-b-from-50%'
)}
>
{theme.lines.map((line, index) => (
@@ -36,11 +36,14 @@ export function OpenAPIPathMultipleServers(
};
});
// The store outlives client-side navigation, so it can hold a server from another spec.
const selectedServer = items.find((item) => item.key === key)?.key ?? defaultServer;
return (
<OpenAPIPathItem
copyType="button"
{...props}
value={`${withServer ? key : ''}${path}`}
value={`${withServer ? selectedServer : ''}${path}`}
context={context}
>
{withServer ? (