Skip to content

Commit 3a15120

Browse files
shockeydeepjia
authored andcommitted
improvement: operation path + summary overflow styling (via swagger-api#5184)
* improvement: operation path + summary overflow styling * inject zero-width spaces for better path breaking * migrate 4867 regression test to tolerate new ZWSPs * rm `dev-helpers/doc.yaml`
1 parent efe7b96 commit 3a15120

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

src/core/components/operation-summary-path.jsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export default class OperationSummaryPath extends PureComponent{
1212
getComponent: PropTypes.func.isRequired,
1313
}
1414

15+
onCopyCapture = (e) => {
16+
// strips injected zero-width spaces (`\u200b`) from copied content
17+
e.clipboardData.setData("text/plain", this.props.operationProps.get("path"))
18+
e.preventDefault()
19+
}
20+
1521
render(){
1622
let {
1723
getComponent,
@@ -31,13 +37,15 @@ export default class OperationSummaryPath extends PureComponent{
3137
const DeepLink = getComponent( "DeepLink" )
3238

3339
return(
34-
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
35-
<DeepLink
36-
enabled={isDeepLinkingEnabled}
37-
isShown={isShown}
38-
path={createDeepLinkPath(`${tag}/${operationId}`)}
39-
text={path} />
40-
</span>
40+
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" }
41+
onCopyCapture={this.onCopyCapture}
42+
data-path={path}>
43+
<DeepLink
44+
enabled={isDeepLinkingEnabled}
45+
isShown={isShown}
46+
path={createDeepLinkPath(`${tag}/${operationId}`)}
47+
text={path.replace(/\//g, "\u200b/")} />
48+
</span>
4149

4250
)
4351
}

src/style/_layout.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,9 @@
245245

246246

247247
display: flex;
248-
flex: 0 3 auto;
249248
align-items: center;
250249

251-
word-break: break-all;
250+
word-break: break-word;
252251

253252
padding: 0 10px;
254253

@@ -270,7 +269,9 @@
270269
{
271270
font-size: 13px;
272271

273-
flex: 1;
272+
flex: 1 1 auto;
273+
274+
word-break: break-word;
274275

275276
@include text_body();
276277
}

test/e2e-cypress/tests/bugs/4867.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe("#4867: callback parameter rendering", () => {
77
.contains("Callbacks")
88
.click()
99

10-
.get(".callbacks-container")
11-
.contains("http://$request.query.url")
10+
.get(".callbacks-container .opblock-summary-path")
11+
.should("have.attr", "data-path", "http://$request.query.url")
1212
.click()
1313

1414
.get(".parameters-container")

0 commit comments

Comments
 (0)