1 – Add a new category in sidebar components.
ViWec.Components.registerCategory($id, $display_name);
2 – Add a new component
ViWec.Components.add({
category: 'category_id',
type: 'component_type',
name: 'component_name',
icon: 'component_icon',
html: '<div class="target_selector">HTML after stop drag</div>',
properties: [
{
key: "unique_key",
inputType: SectionInput,
name: false,
section: contentSection,
data: {header: "Section header"},
},
{
key: "option_key",
htmlAttr: 'innerHTML',
target: '.target_selector',
section: contentSection,
col: 16,
inputType: TextInput,
renderShortcode: true,
data: {shortcodeTool: true}
},
{
key: "padding_header",
inputType: SectionInput,
name: false,
section: styleSection,
data: {header: "Padding (px)"}
},
{
name: "Left",
key: "padding-left",
htmlAttr: "style",
section: styleSection,
col: 4,
unit: 'px',
inputType: NumberInput,
data: {id: 20, max: 250},
},
{
name: "Top",
key: "padding-top",
htmlAttr: "style",
section: styleSection,
col: 4,
unit: 'px',
inputType: NumberInput,
data: {id: 20},
},
{
name: "Right",
key: "padding-right",
htmlAttr: "style",
section: styleSection,
col: 4,
unit: 'px',
inputType: NumberInput,
data: {id: 20, max: 250},
},
{
name: "Bottom",
key: "padding-bottom",
htmlAttr: "style",
section: styleSection,
col: 4,
unit: 'px',
inputType: NumberInput,
data: {id: 20},
}
],
inheritProp: ['text', 'alignment', 'margin']
});