Skip to content
bfintal and mkaz Added ESNext examples to format API tutorial (page 3) (#16802)
* Added ESNext examples

* Added missing end tag

* Use wp.blockEditor instead of wp.editor
Latest commit 2a7c8a6 Aug 16, 2019

README.md

Introduction to the Format API

The purpose of this tutorial is to introduce you to the Format API. The Format API makes it possible for developers to add custom buttons to the formatting toolbar and have them apply a format to a text selection. Bold is an example of a standard button in the formatting toolbar.

In WordPress lingo, a format is a HTML tag with text-level semantics used to give some special meaning to a text selection. For example, in this tutorial, the button to be hooked into the format toolbar will let users wrap a particular text selection with the <samp> HTML tag.

If you are unfamiliar with how to work with WordPress plugins and JavaScript, you may want to check the JavaScript Tutorial first.

Table of Contents

  1. Register a new format
  2. Add a button to the toolbar
  3. Apply the format when the button is clicked
You can’t perform that action at this time.