MCPcopy
hub / github.com/GrapesJS/grapesjs / constructor

Function constructor

packages/core/src/abstract/Module.ts:51–65  ·  view source on GitHub ↗
(em: EditorModel, moduleName: string, defaults?: T)

Source from the content-addressed store, hash-verified

49 view?: any;
50
51 constructor(em: EditorModel, moduleName: string, defaults?: T) {
52 this._em = em;
53 this._name = moduleName;
54 const name = (this.name.charAt(0).toLowerCase() + this.name.slice(1)) as EditorConfigKeys;
55 const cfgParent = !isUndefined(em.config[name]) ? em.config[name] : em.config[this.name as EditorConfigKeys];
56 const cfg = (cfgParent === true ? {} : cfgParent || {}) as Record<string, any>;
57 cfg.pStylePrefix = em.config.pStylePrefix || '';
58
59 if (!isUndefined(cfgParent) && !cfgParent) {
60 cfg._disable = 1;
61 }
62
63 cfg.em = em;
64 this._config = deepMerge(defaults || {}, cfg) as T;
65 }
66
67 public get em() {
68 return this._em;

Callers

nothing calls this directly

Calls 2

deepMergeFunction · 0.90
isUndefinedFunction · 0.85

Tested by

no test coverage detected