editing function
Each definition could define additional editing
method. This method is responsible for a few things:
showing/hiding fields displayed in the sidebar
disabling selection of its own subcomponents (
component
orcomponent-collection
)changing direction in which blue plus buttons are shown when adding items to
component-collection
fieldfields passing - certain fields from parent component can be displayed when child component is selected
Let's look at the SimpleBanner
editing
function:
The most important input argument is editing info (editingInfo
). It has the information about fields visibility, labels, grouping and subcomponents editing behaviour (is nested selection allowed, plus button direction, passed fields, etc). Here's the input editingInfo
for our SimpleBanner
:
Whenever you need to make changes in a default editing info, just use editing
function and return your modified editing info from it.
The editing
function of the SimpleBanner
does 2 things:
Sets
direction: "horizontal"
for each child Button instance. The default value isvertical
(arrows would display at the top and bottom edge of selection frame).Passes the
gap
property to theTitle
while changing thelabel
toBottom margin
. It means that the same property(gap)
is editable by a parent'sGap
field and byBottom margin
field when title is selected.
Changing fields visibility
Also you can modify visible
flag to show and hide fields. You can do it based on input values
and params
which unlocks a lot of customisation.
Disabling selection of child components
Sometimes you might want to disable nested selection of child components. You can do it by setting selectable: false
for a child component:
Of course disabling selection makes it impossible to change the properties of the child component. However, you still might allow for it from the sidebar by setting Title
field to visible: true
(by default all the subcomponents are not visible in the sidebar).
Last updated