docs: updated event reference (#2791)
* docs: updated events reference * docs: added noCopy metadata option for code blocks
This commit is contained in:
1 parent
0d788e73c4
commit
319bcc71b0
5 files changed
+737
-72
No files matched your search
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.
|
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
|
## 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).
|
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%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reference-table .tooltip-container code {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.reference-table .theme-code-block span {
|
.reference-table .theme-code-block span {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ export default function CodeBlockString({
|
|||||||
title: titleProp,
|
title: titleProp,
|
||||||
showLineNumbers: showLineNumbersProp,
|
showLineNumbers: showLineNumbersProp,
|
||||||
language: languageProp,
|
language: languageProp,
|
||||||
noReport = false
|
noReport = false,
|
||||||
|
noCopy = false
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
prism: {defaultLanguage, magicComments},
|
prism: {defaultLanguage, magicComments},
|
||||||
@@ -101,12 +102,14 @@ export default function CodeBlockString({
|
|||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
{!noCopy && (
|
||||||
<CopyButton buttonClassName='code-action' text={code}>
|
<CopyButton buttonClassName='code-action' text={code}>
|
||||||
<ThemedImage alt='Copy to Clipboard' sources={{
|
<ThemedImage alt='Copy to Clipboard' sources={{
|
||||||
light: useBaseUrl('/img/clipboard-copy.png'),
|
light: useBaseUrl('/img/clipboard-copy.png'),
|
||||||
dark: useBaseUrl('/img/clipboard-copy-dark.png')
|
dark: useBaseUrl('/img/clipboard-copy-dark.png')
|
||||||
}} className="no-zoom-img" />
|
}} className="no-zoom-img" />
|
||||||
</CopyButton>
|
</CopyButton>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function maybeStringifyChildren(children) {
|
|||||||
// The children is now guaranteed to be one/more plain strings
|
// The children is now guaranteed to be one/more plain strings
|
||||||
return Array.isArray(children) ? children.join('') : children;
|
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
|
// 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
|
// 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
|
// 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}
|
{title}
|
||||||
</div>
|
</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}
|
{children}
|
||||||
</CodeBlockComp>
|
</CodeBlockComp>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user