返回 presentation-ai
focused-paragraph-placeholder-plugin-config.tsx
根目录 / src / components / notebook / presentation / editor / plugins / focused-paragraph-placeholder-plugin-config.tsx
1 "use client";
2
3 import { KEYS } from "platejs";
4 import { createTPlatePlugin, type RenderNodeWrapper } from "platejs/react";
5
6 import { FocusedParagraphPlaceholder } from "./focused-paragraph-placeholder-plugin";
7
8 const focusedParagraphPlaceholderWrapper: RenderNodeWrapper = (props) => {
9 const { element } = props;
10
11 if (element.type !== KEYS.p) {
12 return ({ children }) => children;
13 }
14
15 return (wrapperProps) => <FocusedParagraphPlaceholder {...wrapperProps} />;
16 };
17
18 export const FocusedParagraphPlaceholderPlugin = createTPlatePlugin({
19 key: "focusedParagraphPlaceholder",
20 editOnly: true,
21 render: {
22 aboveNodes: focusedParagraphPlaceholderWrapper,
23 },
24 });
25
25 lines Plain Text