Skip to content

Commit 09d9a6c

Browse files
Stop 2417 doc viewer mask issue (#2814)
* fix: added maskdata to doc viewer * fix: Issue fix with masking for ninja and studio view * fix: duplicate prop removed from NodeContent * Bump up elements-core and elements-dev-portal versions * fix: added disableProps for root level properties --------- Co-authored-by: Pradeep Bande <pradeep.bande@smartbear.com>
1 parent 58c3b4b commit 09d9a6c

10 files changed

Lines changed: 17 additions & 14 deletions

File tree

packages/elements-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/elements-core",
3-
"version": "9.0.3",
3+
"version": "9.0.4",
44
"sideEffects": [
55
"web-components.min.js",
66
"src/web-components/**",

packages/elements-core/src/components/Docs/Docs.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export interface DocsProps extends BaseDocsProps {
162162
useNodeForRefResolving?: boolean;
163163
refResolver?: ReferenceResolver;
164164
maxRefDepth?: number;
165+
disableProps?: any;
165166
}
166167

167168
export interface DocsComponentProps<T = unknown> extends BaseDocsProps {
@@ -176,6 +177,7 @@ export const Docs = React.memo<DocsProps>(
176177
({
177178
nodeType,
178179
nodeData,
180+
disableProps,
179181
useNodeForRefResolving = false,
180182
refResolver,
181183
maxRefDepth,
@@ -190,7 +192,7 @@ export const Docs = React.memo<DocsProps>(
190192
return null;
191193
}
192194

193-
let elem = <ParsedDocs node={parsedNode} {...commonProps} />;
195+
let elem = <ParsedDocs node={parsedNode} disableProps={disableProps} {...commonProps} />;
194196

195197
if (useNodeForRefResolving) {
196198
elem = (
@@ -210,11 +212,10 @@ export const Docs = React.memo<DocsProps>(
210212

211213
export interface ParsedDocsProps extends BaseDocsProps {
212214
node: ParsedNode;
215+
disableProps?: any;
213216
}
214217

215-
export const ParsedDocs = ({ node, nodeUnsupported, ...commonProps }: ParsedDocsProps) => {
216-
const disableProps = (node.data as any)?.disableProps;
217-
218+
export const ParsedDocs = ({ node, nodeUnsupported, disableProps, ...commonProps }: ParsedDocsProps) => {
218219
switch (node.type) {
219220
case 'article':
220221
return <Article data={node.data} {...commonProps} />;

packages/elements-core/src/components/Docs/HttpOperation/Body.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const Body = ({ body, onChange, isHttpWebhookOperation = false, disablePr
5353
const { location, paths } = configEntry;
5454
paths.forEach(item => {
5555
// Construct the full absolute path
56-
const fullPath = `${location}/${item.path}`;
56+
const fullPath = location === '#' ? item?.path : `${location}/${item.path}`;
5757
absolutePathsToHide.push({ path: fullPath });
5858
});
5959
});

packages/elements-core/src/components/Docs/HttpOperation/Responses.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }: Res
208208
const absolutePathsToHide: Array<{ path: string; required?: boolean }> = [];
209209
configEntries.forEach(({ location, paths }) => {
210210
paths.forEach(item => {
211-
absolutePathsToHide.push({ path: `${location}/${item.path}` });
211+
absolutePathsToHide.push({ path: location === '#' ? item?.path : `${location}/${item.path}` });
212212
});
213213
});
214214
return absolutePathsToHide;

packages/elements-core/src/components/Docs/Model/Model.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const ModelComponent: React.FC<ModelProps> = ({
7878
disablePropsConfig.forEach((configEntry: any) => {
7979
const { location, paths } = configEntry;
8080
paths.forEach((item: any) => {
81-
const fullPath = `${location}/${item.path}`;
81+
const fullPath = location === '#' ? item?.path : `${location}/${item.path}`;
8282
absolutePathsToHide.push({ path: fullPath });
8383
});
8484
});

packages/elements-core/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export { useRouter } from './hooks/useRouter';
4141
export { Styled, withStyles } from './styled';
4242
export { Divider, Group, ITableOfContentsTree, Item, ParsedNode, RoutingProps, TableOfContentItem } from './types';
4343
export { isHttpOperation, isHttpService, isHttpWebhookOperation } from './utils/guards';
44+
export { resolveUrl } from './utils/http-spec/IServer';
4445
export { ReferenceResolver } from './utils/ref-resolving/ReferenceResolver';
4546
export { createResolvedObject } from './utils/ref-resolving/resolvedObject';
46-
export { slugify, resolveRelativeLink } from './utils/string';
47+
export { resolveRelativeLink, slugify } from './utils/string';
4748
export { createElementClass } from './web-components/createElementClass';
48-
export { resolveUrl } from './utils/http-spec/IServer';

packages/elements-dev-portal/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/elements-dev-portal",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"description": "UI components for composing beautiful developer documentation.",
55
"keywords": [],
66
"sideEffects": [
@@ -66,7 +66,7 @@
6666
"dependencies": {
6767
"@stoplight/markdown-viewer": "^5.7.1",
6868
"@stoplight/mosaic": "^1.53.4",
69-
"@stoplight/elements-core": "~9.0.3",
69+
"@stoplight/elements-core": "~9.0.4",
7070
"@stoplight/path": "^1.3.2",
7171
"@stoplight/types": "^14.0.0",
7272
"classnames": "^2.2.6",

packages/elements-dev-portal/src/components/NodeContent/NodeContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const NodeContent = ({
8787
<Docs
8888
nodeType={node.type as NodeType}
8989
nodeData={node.data}
90+
disableProps={node?.disableProps}
9091
nodeTitle={node.title}
9192
layoutOptions={{
9293
compact,

packages/elements-dev-portal/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type Node = NodeSummary & {
3737
};
3838
outbound_edges: NodeEdge[];
3939
inbound_edges: NodeEdge[];
40+
disableProps?: any;
4041
};
4142

4243
export type NodeSummary = {

packages/elements/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stoplight/elements",
3-
"version": "9.0.3",
3+
"version": "9.0.4",
44
"description": "UI components for composing beautiful developer documentation.",
55
"keywords": [],
66
"sideEffects": [
@@ -63,7 +63,7 @@
6363
]
6464
},
6565
"dependencies": {
66-
"@stoplight/elements-core": "~9.0.3",
66+
"@stoplight/elements-core": "~9.0.4",
6767
"@stoplight/http-spec": "^7.1.0",
6868
"@stoplight/json": "^3.18.1",
6969
"@stoplight/mosaic": "^1.53.4",

0 commit comments

Comments
 (0)