mirror of https://github.com/artf/grapesjs.git
1 changed files with 9 additions and 4 deletions
@ -1,18 +1,23 @@ |
|||||
export default (config = {}) => ({ |
import { TraitManagerConfig } from '../config/config'; |
||||
|
import { TraitProperties } from './Trait'; |
||||
|
|
||||
|
export default (config: Partial<TraitManagerConfig> = {}) => ({ |
||||
/** |
/** |
||||
* Build props object by their name |
* Build props object by their name |
||||
* @param {Array<string>|string} props Array of properties name |
* @param {Array<string>|string} props Array of properties name |
||||
* @return {Array<Object>} |
* @return {Array<Object>} |
||||
*/ |
*/ |
||||
build(props) { |
build(props: string | string[]) { |
||||
const objs = []; |
const objs = []; |
||||
|
|
||||
if (typeof props === 'string') props = [props]; |
if (typeof props === 'string') props = [props]; |
||||
|
|
||||
for (let i = 0; i < props.length; i++) { |
for (let i = 0; i < props.length; i++) { |
||||
const obj = {}; |
|
||||
const prop = props[i]; |
const prop = props[i]; |
||||
obj.name = prop; |
const obj: TraitProperties = { |
||||
|
name: prop, |
||||
|
type: 'text', |
||||
|
}; |
||||
|
|
||||
switch (prop) { |
switch (prop) { |
||||
case 'target': |
case 'target': |
||||
Loading…
Reference in new issue