The Footnote block is a simple example that we’ll use as the basis of later blocks with more advanced features.
The Footnote block displays multiline content as multiple paragraph (<p>
) elements wrapped within a <div>
tag.
- The block has only one attribute,
content
, which will store the input. - The
edit()
function renders theRichText
component as an editable field. It also specifies how the input will be displayed in the editor and how changes will be handled; in this case, changes to the input will update the value of thecontent
attribute. - The
save()
function takes theRichText
content, assembles the HTML, and adds it to the post content that will be saved in the database.