Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (fields[pos.row].length === 0) {
fields.splice(pos.row, 1);
if (pos.row < row) {
createAtRef.current.row--;
}
}
return insertField(fieldData, createAtRef.current, { ...state, fields });
});
return;
}
// Find field plugin which handles the dropped field type "id".
const plugin = getPlugins("form-editor-field-type").find(pl => pl.fieldType.id === type);
const data = plugin.fieldType.createField();
insertField(data, createAtRef.current);
}
getGroups(): Array {
return getPlugins("cms-element-group");
}
const ImagesList = pure(({ data = {}, cms: { theme } }: Object = {}) => {
const { component, images } = data;
const components = getPlugins("pb-page-element-images-list-component");
const imageList = components.find(cmp => cmp.name === component);
if (!imageList) {
return "Selected image gallery component not found!";
}
const { component: ListComponent } = imageList;
if (!ListComponent) {
return "You must select a component to render your image gallery!";
}
return ;
});
const SaveAction = ({
showDialog,
hideDialog,
isDialogOpened,
children,
onSubmit,
element
}: Props) => {
if (!element) {
return null;
}
const plugin = getPlugins("pb-page-element").find(pl => pl.elementType === element.type);
if (!plugin) {
return null;
}
return (
{React.cloneElement(children, { onClick: showDialog })}
const Toolbar = ({ activePluginsTop }: Object) => {
const actionsTop = getPlugins("cms-toolbar-top");
const actionsBottom = getPlugins("cms-toolbar-bottom");
return (
{actionsTop
.filter(plugin => typeof plugin.renderDrawer === "function")
.map(plugin => (
{plugin.renderDrawer()}
))}
() => getPlugins("i18n-rich-editor").map(item => item.slate),
[]
const AdvancedAction = ({ elementType, children }: Object) => {
const plugins = getPlugins("pb-page-element-advanced-settings");
if (!plugins.some(pl => pl.element === elementType)) {
return null;
}
return children;
};
const Element = ({ element, cms: { theme } }: ElementProps) => {
if (!element) {
return null;
}
const plugin = getPlugins("cms-render-element").find(pl => pl.element === element.type);
if (!plugin) {
return null;
}
return plugin.render({ theme, element });
};
renderSettings({ Bind, setValue, setMessage, data }) {
const inputsDisabled = data.settings.preset !== "custom";
const presetPlugins = getPlugins("form-editor-field-validator-pattern");
return (
{
if (value === "custom") {
setMessage("Invalid value.");
return;
}
setValue("settings.regex", null);
setValue("settings.flags", null);
export default function PageOptionsMenu() {
const plugins = getPlugins("cms-default-bar-right-page-options-option");
return (
<menu>} />}>
{plugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}
</menu>
);
}