MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / setupPlugins

Method setupPlugins

packages/editor-skeleton/src/skeleton.ts:306–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304 }
305
306 private setupPlugins() {
307 const { config, components = {} } = this.editor;
308 if (!config) {
309 return;
310 }
311
312 const { plugins } = config;
313 if (!plugins) {
314 return;
315 }
316 Object.keys(plugins).forEach((area) => {
317 plugins[area].forEach((item) => {
318 const { pluginKey, type, props = {}, pluginProps } = item;
319 const config: IPublicTypeWidgetBaseConfig = {
320 area: area as IPublicTypeWidgetConfigArea,
321 type: 'Widget',
322 name: pluginKey,
323 contentProps: pluginProps,
324 };
325 const { dialogProps, balloonProps, panelProps, linkProps, ...restProps } = props;
326 config.props = restProps;
327 if (dialogProps) {
328 config.dialogProps = dialogProps;
329 }
330 if (balloonProps) {
331 config.balloonProps = balloonProps;
332 }
333 if (panelProps) {
334 config.panelProps = panelProps;
335 }
336 if (linkProps) {
337 config.linkProps = linkProps;
338 }
339 if (type === 'TabPanel') {
340 config.type = 'Panel';
341 } else if (/Icon$/.test(type)) {
342 config.type = type.replace('Icon', 'Dock');
343 }
344 if (pluginKey in components) {
345 config.content = components[pluginKey];
346 }
347 this.add(config);
348 });
349 });
350 }
351
352 postEvent(event: SkeletonEvents, ...args: any[]) {
353 this.editor.eventBus.emit(event, ...args);

Callers 2

constructorMethod · 0.95
buildFromConfigMethod · 0.95

Calls 3

addMethod · 0.95
replaceMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected