Bläddra i källkod

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`
bubble
kyle 5 år sedan
committed by GitHub
förälder
incheckning
291e2c7251
Ingen känd nyckel hittad för denna signaturen i databasen GPG-nyckel ID: 4AEE18F83AFDEB23
3 ändrade filer med 21 tillägg och 12 borttagningar
  1. +15
    -7
      src/core/components/operation-summary-path.jsx
  2. +4
    -3
      src/style/_layout.scss
  3. +2
    -2
      test/e2e-cypress/tests/bugs/4867.js

+ 15
- 7
src/core/components/operation-summary-path.jsx Visa fil

@@ -12,6 +12,12 @@ export default class OperationSummaryPath extends PureComponent{
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(){
let {
getComponent,
@@ -31,13 +37,15 @@ export default class OperationSummaryPath extends PureComponent{
const DeepLink = getComponent( "DeepLink" )

return(
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
<DeepLink
enabled={isDeepLinkingEnabled}
isShown={isShown}
path={createDeepLinkPath(`${tag}/${operationId}`)}
text={path} />
</span>
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" }
onCopyCapture={this.onCopyCapture}
data-path={path}>
<DeepLink
enabled={isDeepLinkingEnabled}
isShown={isShown}
path={createDeepLinkPath(`${tag}/${operationId}`)}
text={path.replace(/\//g, "\u200b/")} />
</span>

)
}


+ 4
- 3
src/style/_layout.scss Visa fil

@@ -245,10 +245,9 @@


display: flex;
flex: 0 3 auto;
align-items: center;

word-break: break-all;
word-break: break-word;

padding: 0 10px;

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

flex: 1;
flex: 1 1 auto;

word-break: break-word;

@include text_body();
}


+ 2
- 2
test/e2e-cypress/tests/bugs/4867.js Visa fil

@@ -7,8 +7,8 @@ describe("#4867: callback parameter rendering", () => {
.contains("Callbacks")
.click()

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

.get(".parameters-container")


Laddar…
Avbryt
Spara