examples: let people copy out code (#2920)
### Change Type - [x] `internal` — Any other changes that don't affect the published package[^2]
This commit is contained in:
parent
e15c9f12bb
commit
07f58b6885
3 changed files with 4 additions and 3 deletions
|
@ -48,6 +48,7 @@ export default function CanvasEventsExample() {
|
|||
overflow: 'auto',
|
||||
whiteSpace: 'pre-wrap',
|
||||
}}
|
||||
onCopy={(event) => event.stopPropagation()}
|
||||
>
|
||||
<div>{JSON.stringify(events, undefined, 2)}</div>
|
||||
</div>
|
||||
|
|
|
@ -92,6 +92,7 @@ export default function StoreEventsExample() {
|
|||
flexDirection: 'column-reverse',
|
||||
overflow: 'auto',
|
||||
}}
|
||||
onCopy={(event) => event.stopPropagation()}
|
||||
>
|
||||
<pre>{storeEvents}</pre>
|
||||
</div>
|
||||
|
|
|
@ -11,8 +11,8 @@ export default function UiEventsExample() {
|
|||
const handleUiEvent = useCallback<TLUiEventHandler>((name, data: any) => {
|
||||
const codeSnippet = getCodeSnippet(name, data)
|
||||
setUiEvents((events) => [
|
||||
`event: ${name} ${JSON.stringify(data)}${codeSnippet && `\ncode: ${codeSnippet}`}`,
|
||||
...events,
|
||||
`event: ${name} ${JSON.stringify(data)}${codeSnippet && `\ncode: ${codeSnippet}`}`,
|
||||
])
|
||||
}, [])
|
||||
|
||||
|
@ -31,10 +31,9 @@ export default function UiEventsExample() {
|
|||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
borderLeft: 'solid 2px #333',
|
||||
display: 'flex',
|
||||
flexDirection: 'column-reverse',
|
||||
overflow: 'auto',
|
||||
}}
|
||||
onCopy={(event) => event.stopPropagation()}
|
||||
>
|
||||
{uiEvents.map((t, i) => (
|
||||
<Fragment key={i}>
|
||||
|
|
Loading…
Reference in a new issue