Ttattributes ({text: newtext})
}The
}),
EL (\
Classname: \
Href: attribute. Button URL
}, properties. Button text)
)The
)In this case, the div element is created using WP block image with text block classname. Otherwise, add the block name in WP block-. Here, you also set the inline CSS style for sorting. Then add two additional div elements as child elements. The first div element has the classname my block image. Print the image uploaded by the user through the editor within this element. The
Here, set the element to mediaupload. The element has multiple attributes (onselect, type, value, and rendering). The first is to pass the media object to the onselect variable function, which returns a new object with a media ID and a media URL. The second definition is that the element is an image. The third definition is that the media ID is collected from the uploaded media object. The render function prints an additional HTML tag, which will become an upload button. The second sub div element is used for content information. You can set title text, content text, and buttons. The
The first and second elements are set to richtext, and you can edit the attribute keys. That is, you can change the text in real time, and onchange is your responsibility. This function gets the new value of the text on write and changes it within the block element. Other attributes that might be useful are placeholder and keepponceholderonfocus. These properties, like placeholders for input fields, are used to set labels so that users know where to edit. The third element is the button HTML tag, which sets the button attributes (URL and text) through the custom block option. Your responsibilities include: The
EL (inspector controls, {key: \
EL (components.panelbody{
Title: i18n__ (content mask, my first guenberg block)
Classname: \
Initial opening: true
},
EL (\
EL (text control{
Type: text
Label: i18n__ (button text, my first guenberg block)
Values: attributes. Button text
Onchange: function (newbuttontext){
Props Setattributes ({buttontext: newbuttontext})
}The
}),
EL (text control{
Type: \
Label: i18n__ (button URL, my first guenberg block)
Values: attributes. Button URL
Onchange: function (newbuttonurl){
Props Setattributes ({buttonurl: newbuttonurl})
}The
}()
)The
)The inspector controls element is created. This element can be considered a meta box part, but is limited to the Gutenberg editor. It defines some titles, descriptions, and options. This property is useful if you want to create multiple inspector controls sections. Initialopen This allows you to define the section that will be the default initial open. To create an option inside a section, for example, you must create an element to be of type textcontrol (you can find fields of all available types here). In our case, we created two options: button text and button URL. Use this option to render additional content. In this case, the content