未验证 提交 291e2c72 编写于 作者: K kyle 提交者: GitHub

improvement: operation path + summary overflow styling (via #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`
上级 937c8f62
...@@ -12,6 +12,12 @@ export default class OperationSummaryPath extends PureComponent{ ...@@ -12,6 +12,12 @@ export default class OperationSummaryPath extends PureComponent{
getComponent: PropTypes.func.isRequired, getComponent: PropTypes.func.isRequired,
} }
onCopyCapture = (e) => {
// strips injected zero-width spaces (`\u200b`) from copied content
e.clipboardData.setData("text/plain", this.props.operationProps.get("path"))
e.preventDefault()
}
render(){ render(){
let { let {
getComponent, getComponent,
...@@ -31,13 +37,15 @@ export default class OperationSummaryPath extends PureComponent{ ...@@ -31,13 +37,15 @@ export default class OperationSummaryPath extends PureComponent{
const DeepLink = getComponent( "DeepLink" ) const DeepLink = getComponent( "DeepLink" )
return( return(
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } > <span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" }
<DeepLink onCopyCapture={this.onCopyCapture}
enabled={isDeepLinkingEnabled} data-path={path}>
isShown={isShown} <DeepLink
path={createDeepLinkPath(`${tag}/${operationId}`)} enabled={isDeepLinkingEnabled}
text={path} /> isShown={isShown}
</span> path={createDeepLinkPath(`${tag}/${operationId}`)}
text={path.replace(/\//g, "\u200b/")} />
</span>
) )
} }
......
...@@ -245,10 +245,9 @@ ...@@ -245,10 +245,9 @@
display: flex; display: flex;
flex: 0 3 auto;
align-items: center; align-items: center;
word-break: break-all; word-break: break-word;
padding: 0 10px; padding: 0 10px;
...@@ -270,7 +269,9 @@ ...@@ -270,7 +269,9 @@
{ {
font-size: 13px; font-size: 13px;
flex: 1; flex: 1 1 auto;
word-break: break-word;
@include text_body(); @include text_body();
} }
......
...@@ -7,8 +7,8 @@ describe("#4867: callback parameter rendering", () => { ...@@ -7,8 +7,8 @@ describe("#4867: callback parameter rendering", () => {
.contains("Callbacks") .contains("Callbacks")
.click() .click()
.get(".callbacks-container") .get(".callbacks-container .opblock-summary-path")
.contains("http://$request.query.url") .should("have.attr", "data-path", "http://$request.query.url")
.click() .click()
.get(".parameters-container") .get(".parameters-container")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册