Permalink
Switch branches/tags
Nothing to show
Find file Copy path
ad98a34 May 21, 2018
1 contributor

Users who have contributed to this file

34 lines (17 sloc) 1.55 KB

TinyMCE Toolbar Button

Covers the following TinyMCE API:

  • tinymce.activeEditor.addButton()

Overview

TinyMCE includes an API for registering custom buttons to its toolbar. These buttons appear alongside existing TinyMCE rich formatting buttons.

Custom buttons can be used to insert and programmatically manipulate post content. They often use the TinyMCE Editor set of APIs.

Existing Usage

From WordPress/gutenberg#4658, the following screenshot depicts a TinyMCE button that wraps some text with an indicator to highlight it for social sharing:

image


From #3, the following screenshot depicts a TinyMCE button that inserts an inline shortcode:

image

The button first opens a pop-up modal to present the user with some configuration options, and then inserts an inline shortcode with attributes filled out based on the user's selection.


Please open a new issue to suggest additional examples of existing usage.

Gutenberg Equivalent

While the Gutenberg Block API provides UI for inserting block-level elements, there are no Gutenberg equivalents for customizing the block toolbar or programmatically manipulating post content.