i would like to create a simple grid. You should get two columns (later more) to put content in there. But not only simple text. All content types should be available
My edit function
registerBlockType(
'grids-2col', {
title: '2 Spalten',
icon: icon,
category: category,
attributes: {
paragraphLeft: {
type: "string",
selector: "div"
},
paragraphRight: {
type: "string",
selector: "div"
},
},
edit: function (props) {
var attributes = props.attributes,
className = props.className,
setAttributes = props.setAttributes;
var paragraphLeft = attributes.paragraphLeft,
paragraphRight = attributes.paragraphRight;
return [
createElement(
"div",
{ className: "main-wrapper-editor row" },
createElement(
"div",
{
className: "left col-md-6",
},
createElement(InnerBlocks, {
//tagName: "div",
className: className,
value: paragraphLeft,
onChange: function onChange(
newParagraphLeft
) {
setAttributes({
paragraphLeft: newParagraphLeft
});
},
placeholder:
"Inhalt linke Spalte"
})
),
createElement(
"div",
{
className: "right col-md-6",
},
createElement(InnerBlocks, {
//tagName: "div",
className: className,
value: paragraphRight,
onChange: function onChange(
newParagraphRight
) {
setAttributes({
paragraphRight: newParagraphRight
});
},
placeholder:
"Inhalt rechte Spalte"
})
)
)
];
},
The Problem is that the what i write in the left box ist cloned into the right one. How ist it possible to make more than one InnerBlock.
It works fine with RichText instead of InnerBlocks.