返回 presentation-ai
block-selection-kit.tsx
根目录 / src / components / plate / plugins / block-selection-kit.tsx
1 /** biome-ignore-all lint/suspicious/noExplicitAny: This use requires any */
2 "use client";
3
4 import {
5 BlockSelectionAfterEditable,
6 BlockSelectionPlugin,
7 } from "@platejs/selection/react";
8 import { getPluginTypes, KEYS } from "platejs";
9
10 import { BlockSelectionFocusBridge } from "@/components/plate/plugins/block-selection-focus-bridge";
11 import { BlockSelection } from "@/components/plate/ui/block-selection";
12
13 export const BlockSelectionKit = [
14 BlockSelectionPlugin.configure(({ editor }) => ({
15 options: {
16 enableContextMenu: false,
17 isSelectable: (element) => {
18 return !getPluginTypes(editor, [KEYS.codeLine, KEYS.td]).includes(
19 element.type,
20 );
21 },
22 },
23 render: {
24 afterEditable: () => (
25 <>
26 <BlockSelectionAfterEditable />
27 <BlockSelectionFocusBridge />
28 </>
29 ),
30 belowRootNodes: (props) => {
31 if (!props.attributes.className?.includes("slate-selectable"))
32 return null;
33
34 return <BlockSelection {...(props as any)} />;
35 },
36 },
37 })),
38 ];
39
39 lines Plain Text