Footnote: A basic block using the RichText component

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 the RichText 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 the content attribute.
  • The save() function takes the RichText content, assembles the HTML, and adds it to the post content that will be saved in the database.