Skip to content

Commit

Permalink
fix: fix the issue that View can create customized component
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 authored and purpose233 committed Sep 15, 2023
1 parent bcd1b05 commit eed002b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/vgrammar-core/src/view/View.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IBounds, ILogger } from '@visactor/vutils';
// eslint-disable-next-line no-duplicate-imports
import { EventEmitter, debounce, isNil, isObject, isString, getContainerSize, Logger, isArray } from '@visactor/vutils';
import { EventEmitter, debounce, isNil, isObject, isString, getContainerSize, Logger } from '@visactor/vutils';
import type { IColor } from '@visactor/vrender';
// eslint-disable-next-line no-duplicate-imports
import { vglobal } from '@visactor/vrender';
Expand Down Expand Up @@ -103,6 +103,7 @@ import { Cell } from '../semantic-marks/cell';
import { Text } from '../semantic-marks/text';
import { ThemeManager } from '../theme/theme-manager';
import { Factory } from '../core/factory';
import { Component } from './component';

/**
* Create a new View instance from a VGrammar dataflow runtime specification.
Expand Down Expand Up @@ -292,7 +293,9 @@ export default class View extends EventEmitter implements IView {
break;
// components
case GrammarMarkType.component:
mark = Factory.createComponent(markOptions?.componentType, this, groupMark, markOptions?.mode);
mark = Factory.hasComponent(markOptions?.componentType)
? Factory.createComponent(markOptions?.componentType, this, groupMark, markOptions?.mode)
: new Component(this, markOptions?.componentType, groupMark, markOptions?.mode);
break;
case GrammarMarkType.interval:
mark = new Interval(this, type, groupMark);
Expand Down

0 comments on commit eed002b

Please sign in to comment.