Class GrapesJsBlock
java.lang.Object
io.jmix.messagetemplatesflowui.kit.component.GrapesJsBlock
- All Implemented Interfaces:
Serializable
A block is an object that allows the end user to reuse components. By default, added blocks are available
in the blocks section for adding to the message template using the drag-n-drop action.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forGrapesJsBlockthat can be used to create blocks via the Fluent API. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GrapesJsBlock.BuilderCreatesGrapesJsBlock.Builderthat can be used to create blocks via the Fluent API.getIcon()getId()getLabel()voidsetAttributes(String attributes) Sets additional attributes of the block as a JSON string.voidsetCategory(String category) Sets the category to which the block will be located in the blocks section.voidsetContent(String content) Sets the HTML content for the block.voidSets icon for the block in the block section.voidSets the label of the block.
-
Field Details
-
id
-
label
-
category
-
-
attributes
-
icon
-
-
Constructor Details
-
GrapesJsBlock
-
-
Method Details
-
create
CreatesGrapesJsBlock.Builderthat can be used to create blocks via the Fluent API.- Parameters:
id- unique ID of the block- Returns:
GrapesJsBlock.Builderfor subsequent use via the Fluent API
-
getId
- Returns:
- unique ID of the block
-
getLabel
- Returns:
- label of the block
-
setLabel
Sets the label of the block. The label is used to name a block in the blocks section.- Parameters:
label- label to set
-
getCategory
- Returns:
- category of the block in the blocks section
-
setCategory
Sets the category to which the block will be located in the blocks section.- Parameters:
category- category to set
-
getContent
- Returns:
- HTML content of the block
-
setContent
Sets the HTML content for the block. The content will be rendered in theGrapesJstemplate when you drag-n-drop a block into the template.- Parameters:
content- HTML content to set
-
getAttributes
- Returns:
- additional attributes of the block
-
setAttributes
Sets additional attributes of the block as a JSON string. Additional attributes can be used to set additional parameters.
For example, you can set text that will be displayed as a tooltip when hovering over a block:grapesJsBlock.setAttributes(""" { "title": "Insert another one" } """);- Parameters:
attributes- JSON string attributes to set
-
getIcon
- Returns:
- icon of the block in the block section
-
setIcon
Sets icon for the block in the block section. Theiconmust be from an existing icon set (e.g.vaadin:picture).- Parameters:
icon- the icon name with collection prefix
-