fix(workbench): Guard against snippets without anchor
This commit is contained in:
parent
71732745e6
commit
3124f72a2a
1 changed files with 2 additions and 1 deletions
|
@ -3,7 +3,7 @@ import { getProps } from '../utils'
|
||||||
import { Tr, KeyTd, ValTd, Attributes, pointCoords } from '../path/index'
|
import { Tr, KeyTd, ValTd, Attributes, pointCoords } from '../path/index'
|
||||||
|
|
||||||
const snippetInfo = (props) => {
|
const snippetInfo = (props) => {
|
||||||
console.log(props.snippet)
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 border bg-neutral bg-opacity-40 shadow rounded-lg">
|
<div className="p-4 border bg-neutral bg-opacity-40 shadow rounded-lg">
|
||||||
<h5 className="text-neutral-content text-center pb-4">Snippet info</h5>
|
<h5 className="text-neutral-content text-center pb-4">Snippet info</h5>
|
||||||
|
@ -46,6 +46,7 @@ console.log(props.snippet)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Snippet = (props) => {
|
const Snippet = (props) => {
|
||||||
|
if (!props.snippet?.anchor) return null
|
||||||
const snippetProps = {
|
const snippetProps = {
|
||||||
xlinkHref: '#' + props.snippet.def,
|
xlinkHref: '#' + props.snippet.def,
|
||||||
x: props.snippet.anchor.x,
|
x: props.snippet.anchor.x,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue