Skip to content

Commit c492f09

Browse files
authored
Fix outline not visible on OpenAPI blocks (#2910)
1 parent 2c3af5e commit c492f09

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/gitbook/src/components/DocumentView/utils/isBlockOffscreen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ const getBlockHeight = memoize((block: DocumentBlock | undefined): number => {
9292
case 'images':
9393
case 'image':
9494
case 'swagger':
95+
case 'openapi-operation':
9596
return 768 / (16 / 9);
9697
case 'file':
9798
case 'expandable':

packages/gitbook/src/lib/document-sections.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function getDocumentSections(
3737
});
3838
}
3939

40-
if (block.type === 'swagger' && block.meta?.id) {
40+
if ((block.type === 'swagger' || block.type === 'openapi-operation') && block.meta?.id) {
4141
const { data: operation } = await resolveOpenAPIBlock({
4242
block,
4343
context,

packages/gitbook/src/lib/document.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function hasFullWidthBlock(document: JSONDocument): boolean {
2222
if (node.data && 'fullWidth' in node.data && node.data.fullWidth) {
2323
return true;
2424
}
25-
if (node.type === 'swagger') {
25+
if (node.type === 'swagger' || node.type === 'openapi-operation') {
2626
return true;
2727
}
2828
}
@@ -120,7 +120,8 @@ export function getBlockTitle(block: DocumentBlock): string {
120120
return block.data.title ?? '';
121121
}
122122

123-
case 'swagger': {
123+
case 'swagger':
124+
case 'openapi-operation': {
124125
return `${block.data.method?.toUpperCase()} ${block.data.path}`;
125126
}
126127
default:

0 commit comments

Comments
 (0)