docs: updated event reference (#2791)
* docs: updated events reference * docs: added noCopy metadata option for code blocks
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -152,7 +152,7 @@ console.log("hello")
|
||||
```
|
||||
~~~
|
||||
|
||||
### Remove Report Buttons
|
||||
### Remove Report Button
|
||||
|
||||
Some code block don't need a report button. To remove the report button, use the `noReport` metadata.
|
||||
|
||||
@@ -164,6 +164,18 @@ medusa new my-medusa-store --seed
|
||||
```
|
||||
~~~
|
||||
|
||||
### Remove Copy Button
|
||||
|
||||
Some code blocks don't need a copy button. To remove the copy button, use the `noCopy` metadata:
|
||||
|
||||
For example:
|
||||
|
||||
~~~md
|
||||
```bash noCopy
|
||||
medusa new my-medusa-store --seed
|
||||
```
|
||||
~~~
|
||||
|
||||
## NPM and Yarn Code Blocks
|
||||
|
||||
If you’re adding code blocks that use NPM and Yarn, you must use the [npm2yarn syntax](https://docusaurus.io/docs/markdown-features/code-blocks#npm2yarn-remark-plugin).
|
||||
|
||||
@@ -30,6 +30,10 @@ details summary {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.reference-table .tooltip-container code {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.reference-table .theme-code-block span {
|
||||
max-width: 100%;
|
||||
word-break: break-word;
|
||||
|
||||
@@ -26,7 +26,8 @@ export default function CodeBlockString({
|
||||
title: titleProp,
|
||||
showLineNumbers: showLineNumbersProp,
|
||||
language: languageProp,
|
||||
noReport = false
|
||||
noReport = false,
|
||||
noCopy = false
|
||||
}) {
|
||||
const {
|
||||
prism: {defaultLanguage, magicComments},
|
||||
@@ -101,12 +102,14 @@ export default function CodeBlockString({
|
||||
</a>
|
||||
</Tooltip>
|
||||
)}
|
||||
<CopyButton buttonClassName='code-action' text={code}>
|
||||
<ThemedImage alt='Copy to Clipboard' sources={{
|
||||
light: useBaseUrl('/img/clipboard-copy.png'),
|
||||
dark: useBaseUrl('/img/clipboard-copy-dark.png')
|
||||
}} className="no-zoom-img" />
|
||||
</CopyButton>
|
||||
{!noCopy && (
|
||||
<CopyButton buttonClassName='code-action' text={code}>
|
||||
<ThemedImage alt='Copy to Clipboard' sources={{
|
||||
light: useBaseUrl('/img/clipboard-copy.png'),
|
||||
dark: useBaseUrl('/img/clipboard-copy-dark.png')
|
||||
}} className="no-zoom-img" />
|
||||
</CopyButton>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
@@ -17,7 +17,7 @@ function maybeStringifyChildren(children) {
|
||||
// The children is now guaranteed to be one/more plain strings
|
||||
return Array.isArray(children) ? children.join('') : children;
|
||||
}
|
||||
export default function CodeBlock({children: rawChildren, noReport = false, ...props}) {
|
||||
export default function CodeBlock({children: rawChildren, noReport = false, noCopy = false, ...props}) {
|
||||
// The Prism theme on SSR is always the default theme but the site theme can
|
||||
// be in a different mode. React hydration doesn't update DOM styles that come
|
||||
// from SSR. Hence force a re-render after mounting to apply the current
|
||||
@@ -37,7 +37,7 @@ export default function CodeBlock({children: rawChildren, noReport = false, ...p
|
||||
{title}
|
||||
</div>
|
||||
)}
|
||||
<CodeBlockComp key={String(isBrowser)} {...props} noReport={noReport} className={title ? '' : 'no-header-block'}>
|
||||
<CodeBlockComp key={String(isBrowser)} {...props} noReport={noReport} noCopy={noCopy} className={title ? '' : 'no-header-block'}>
|
||||
{children}
|
||||
</CodeBlockComp>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user