drawDB/src/components/LexicalEditor/CodeHighlightPlugin.jsx

12 lines
371 B
React
Raw Normal View History

2023-09-19 20:51:59 +08:00
import { registerCodeHighlighting } from "@lexical/code";
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
import { useEffect } from "react";
export default function CodeHighlightPlugin() {
const [editor] = useLexicalComposerContext();
useEffect(() => {
return registerCodeHighlighting(editor);
}, [editor]);
return null;
}