Files
core/src/shared/components/BlockEditor/index.js
T
hykocx 085a779c74 feat(BlockEditor): add rich paste support with html-to-blocks parsing
- add clipboard.js with htmlToBlocks, blocksToHtml, and blocksToPlainText helpers
- handle single-paragraph html paste as inline splice preserving block type
- handle multi-block html paste by splitting current block and merging head/tail paragraphs
- add onPasteInline and onPasteBlocks props to Block component
- implement handlePasteInline and handlePasteBlocks in BlockEditor
- fallback to plain text insertion when html is absent or yields no blocks
- update README to document clipboard behaviour and new paste handlers
2026-04-25 20:19:32 -04:00

41 lines
1.2 KiB
JavaScript

// 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';
export {
INLINE_COLORS,
INLINE_COLOR_KEYS,
isHexColor,
collectUsedColors,
inlineLength,
inlineToPlainText,
inlineFromText,
sliceInline,
concatInline,
applyMark,
removeMark,
toggleMark,
marksAtOffset,
marksInRange,
normalize as normalizeInline,
} from './inline/types.js';
export { inlineToDom, domToInline } from './inline/serialize.js';
export { blocksToHtml, blocksToPlainText, htmlToBlocks } from './inline/clipboard.js';