mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-03-08 01:53:30 +01:00
feat(element-configs): Initialize configs at app startup
- Added initElementConfigs() function in ElementConfigs/index.ts - Calls registry.register() for ButtonConfig and TextConfig - Integrated into Router constructor (called after LessonTemplatesModel init) - Configs now load when editor starts - Console log shows '[ ElementConfigs] Initialized with X configs' Part of STYLE-002 MVP 2 implementation. Next: Hook into node creation to auto-apply defaults.
This commit is contained in:
@@ -14,5 +14,24 @@ export * from './ElementConfigTypes';
|
|||||||
// Export registry
|
// Export registry
|
||||||
export { ElementConfigRegistry, registry } from './ElementConfigRegistry';
|
export { ElementConfigRegistry, registry } from './ElementConfigRegistry';
|
||||||
|
|
||||||
// Configs will be exported once implemented
|
// Export configs
|
||||||
// export * from './configs';
|
export * from './configs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize Element Configs
|
||||||
|
*
|
||||||
|
* Registers all built-in element configurations.
|
||||||
|
* Should be called once at application startup.
|
||||||
|
*/
|
||||||
|
export function initElementConfigs(): void {
|
||||||
|
// Import configs and register them
|
||||||
|
import('./configs').then(({ ButtonConfig, TextConfig }) => {
|
||||||
|
// Import registry from local module
|
||||||
|
import('./ElementConfigRegistry').then(({ ElementConfigRegistry }) => {
|
||||||
|
ElementConfigRegistry.instance.register(ButtonConfig);
|
||||||
|
ElementConfigRegistry.instance.register(TextConfig);
|
||||||
|
|
||||||
|
console.log('[ElementConfigs] Initialized with', ElementConfigRegistry.instance.getCount(), 'configs');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import './utils/editorapi';
|
|||||||
import { platform } from '@noodl/platform';
|
import { platform } from '@noodl/platform';
|
||||||
|
|
||||||
import { AiAssistantModel } from '@noodl-models/AiAssistant';
|
import { AiAssistantModel } from '@noodl-models/AiAssistant';
|
||||||
|
import { initElementConfigs } from '@noodl-models/ElementConfigs';
|
||||||
import { ProjectModel } from '@noodl-models/projectmodel';
|
import { ProjectModel } from '@noodl-models/projectmodel';
|
||||||
|
|
||||||
import { AppRoute } from './pages/AppRoute';
|
import { AppRoute } from './pages/AppRoute';
|
||||||
@@ -108,6 +109,9 @@ export default class Router
|
|||||||
// Initialise models
|
// Initialise models
|
||||||
LessonTemplatesModel.instance.fetch();
|
LessonTemplatesModel.instance.fetch();
|
||||||
|
|
||||||
|
// Initialize element configs (Button, Text, etc.)
|
||||||
|
initElementConfigs();
|
||||||
|
|
||||||
EventDispatcher.instance.on(
|
EventDispatcher.instance.on(
|
||||||
'viewer-refresh',
|
'viewer-refresh',
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user