mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
fix(edit): forward ref and editing props through Tag
Tag dropped every prop beyond children/accent/className, so the editing
surface EditableText attaches (ref, contentEditable, key/blur handlers)
never reached the span: tags rendered through as={Tag} — interests,
philosophy keywords, project-detail technologies — showed a pencil but
never became editable (React 19: ref is a plain prop the component must
declare). Tag is now a pass-through; visitor markup is unchanged.
This commit is contained in:
1 parent
fbf75d8ffa
commit
24de125182
1 file changed
+7
-3
@@ -1,12 +1,16 @@
|
|||||||
interface TagProps {
|
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
accent?: boolean
|
accent?: boolean
|
||||||
className?: string
|
className?: string
|
||||||
|
// EditableText/TagListEditor attach editing props to the element they render
|
||||||
|
// through (ref, contentEditable, key/blur handlers) — Tag must forward them
|
||||||
|
// or the element never becomes editable in edit mode (React 19: ref is a prop).
|
||||||
|
ref?: React.Ref<HTMLSpanElement>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Tag({ children, accent = false, className = '' }: TagProps) {
|
export function Tag({ children, accent = false, className = '', ref, ...rest }: TagProps) {
|
||||||
return (
|
return (
|
||||||
<span className={`tag ${accent ? 'tag-accent' : ''} ${className}`}>
|
<span ref={ref} className={`tag ${accent ? 'tag-accent' : ''} ${className}`} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user