refactor
This commit is contained in:
47
ts_web/elements/wysiwyg/wysiwyg.blockregistration.ts
Normal file
47
ts_web/elements/wysiwyg/wysiwyg.blockregistration.ts
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Block Registration Module
|
||||
* Handles registration of all block handlers with the BlockRegistry
|
||||
*
|
||||
* Phase 2 Complete: Divider block has been successfully migrated
|
||||
* to the new block handler architecture.
|
||||
* Phase 3 Complete: Paragraph block has been successfully migrated
|
||||
* to the new block handler architecture.
|
||||
* Phase 4 Complete: All heading blocks (h1, h2, h3) have been successfully migrated
|
||||
* to the new block handler architecture using a unified HeadingBlockHandler.
|
||||
* Phase 5 Complete: Quote, Code, and List blocks have been successfully migrated
|
||||
* to the new block handler architecture.
|
||||
*/
|
||||
|
||||
import { BlockRegistry, DividerBlockHandler } from './blocks/index.js';
|
||||
import { ParagraphBlockHandler } from './blocks/text/paragraph.block.js';
|
||||
import { HeadingBlockHandler } from './blocks/text/heading.block.js';
|
||||
import { QuoteBlockHandler } from './blocks/text/quote.block.js';
|
||||
import { CodeBlockHandler } from './blocks/text/code.block.js';
|
||||
import { ListBlockHandler } from './blocks/text/list.block.js';
|
||||
|
||||
// Initialize and register all block handlers
|
||||
export function registerAllBlockHandlers(): void {
|
||||
// Register content blocks
|
||||
BlockRegistry.register('divider', new DividerBlockHandler());
|
||||
|
||||
// Register text blocks
|
||||
BlockRegistry.register('paragraph', new ParagraphBlockHandler());
|
||||
BlockRegistry.register('heading-1', new HeadingBlockHandler('heading-1'));
|
||||
BlockRegistry.register('heading-2', new HeadingBlockHandler('heading-2'));
|
||||
BlockRegistry.register('heading-3', new HeadingBlockHandler('heading-3'));
|
||||
BlockRegistry.register('quote', new QuoteBlockHandler());
|
||||
BlockRegistry.register('code', new CodeBlockHandler());
|
||||
BlockRegistry.register('list', new ListBlockHandler());
|
||||
|
||||
// TODO: Register media blocks when implemented
|
||||
// BlockRegistry.register('image', new ImageBlockHandler());
|
||||
// BlockRegistry.register('youtube', new YoutubeBlockHandler());
|
||||
// BlockRegistry.register('attachment', new AttachmentBlockHandler());
|
||||
|
||||
// TODO: Register other content blocks when implemented
|
||||
// BlockRegistry.register('markdown', new MarkdownBlockHandler());
|
||||
// BlockRegistry.register('html', new HtmlBlockHandler());
|
||||
}
|
||||
|
||||
// Ensure blocks are registered when this module is imported
|
||||
registerAllBlockHandlers();
|
Reference in New Issue
Block a user