docs: updated event reference (#2791)
* docs: updated events reference * docs: added noCopy metadata option for code blocks
This commit is contained in:
@@ -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