feat(ui): add BlockEditor component with block types, slash menu, and drag-and-drop

- add BlockEditor orchestrator with controlled block list and keyboard navigation
- add Block client component with contentEditable sync, drag handles, and markdown shortcuts
- add SlashMenu for inserting block types via `/` command
- add blockRegistry and block type definitions (paragraph, heading, bullet list, numbered list, quote, code, divider)
- add caret and id utility helpers
- export BlockEditor from shared components index
- add BlockEditor demo to admin devkit ComponentsPage
- add README documenting usage and architecture
This commit is contained in:
2026-04-25 17:37:23 -04:00
parent 0c99bf5002
commit 54386d3fe3
18 changed files with 1401 additions and 0 deletions
@@ -0,0 +1,21 @@
// Barrel public du BlockEditor.
//
// Importer le composant depuis :
// import { BlockEditor } from '@zen/core/shared/components';
//
// Pour enregistrer un type de bloc custom dans une app consommatrice :
// import { registerBlock } from '@zen/core/shared/components/BlockEditor';
// registerBlock({ type: 'kpi', label: 'KPI', icon: '📊', isText: false,
// create: () => ({ id: crypto.randomUUID(), type: 'kpi' }),
// Component: MyKpiBlock });
export { default as BlockEditor } from './BlockEditor.client.js';
export { default } from './BlockEditor.client.js';
export {
registerBlock,
getBlockDef,
listBlocks,
isBlockText,
DEFAULT_BLOCK_TYPE,
} from './blockRegistry.js';
export { newBlockId } from './utils/ids.js';