mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
20 lines
495 B
TypeScript
20 lines
495 B
TypeScript
'use client';
|
|
|
|
|
|
import { withRef } from '@udecode/cn';
|
|
import { useCodeSyntaxLeaf } from '@udecode/plate-code-block/react';
|
|
import { PlateLeaf } from '@udecode/plate-common/react';
|
|
|
|
export const CodeSyntaxLeaf = withRef<typeof PlateLeaf>(
|
|
({ children, ...props }, ref) => {
|
|
const { leaf } = props;
|
|
|
|
const { tokenProps } = useCodeSyntaxLeaf({ leaf });
|
|
|
|
return (
|
|
<PlateLeaf ref={ref} {...props}>
|
|
<span {...tokenProps}>{children}</span>
|
|
</PlateLeaf>
|
|
);
|
|
}
|
|
);
|