block-selection-kit
plate/block-selection-kitFreeComponent
plate publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by plate on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://platejs.org/r/block-selection-kit.jsonSource
1'use client';23import { AIChatPlugin } from '@platejs/ai/react';4import { BlockSelectionPlugin } from '@platejs/selection/react';5import { getPluginTypes, isHotkey, KEYS } from 'platejs';67import { BlockSelection } from '@/registry/ui/block-selection';89export const hasSelectableClass = ({10 attributes,11 className,12}: {13 attributes: { className?: string };14 className?: string;15}) =>16 [className, attributes.className]17 .filter(Boolean)18 .join(' ')19 .includes('slate-selectable');2021export const BlockSelectionKit = [22 BlockSelectionPlugin.configure(({ editor }) => ({23 options: {24 enableContextMenu: true,25 isSelectable: (element) =>26 !getPluginTypes(editor, [KEYS.column, KEYS.codeLine, KEYS.td]).includes(27 element.type28 ),29 onKeyDownSelecting: (editor, e) => {30 if (isHotkey('mod+j')(e)) {31 editor.getApi(AIChatPlugin).aiChat.show();32 }33 },34 },35 render: {36 belowRootNodes: (props) => {37 if (!hasSelectableClass(props)) return null;3839 return <BlockSelection {...(props as any)} />;40 },41 },42 })),43];
What it pulls in
npm packages
Other registry items
Files it writes
More from plate
All 324 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-kitai-kit | plate | Components | Free | 1 dep | |
| AI Menuai-menu | plate | Components | Free | 5 deps · 2 files | |
| AI Leafai-node | plate | Components | Free | no deps | |
| AI Toolbar Buttonai-toolbar-button | plate | Components | Free | 1 dep | |
| align-base-kitalign-base-kit | plate | Components | Free | 1 dep | |
| align-kitalign-kit | plate | Components | Free | 1 dep | |
| Align Toolbar Buttonalign-toolbar-button | plate | Components | Free | 1 dep | |
| autoformat-classic-kitautoformat-classic-kit | plate | Components | Free | 2 deps |
