TinyMCE Demos

TinyMCE is a versatile tool that can be used for a wide variety of text editing tasks. This repository aims to inspire you and demonstrate different approaches to common use cases.

Every demo has a thorougly documented html file explaining the TinyMCE config as well as links to relevant documentation to make it easy to use these demos as basis for your own projects.

Make sure you visit the Github repository and look through the HTML files. Each demo is carefully documented to help you get the most out of TinyMCE.

These demos are released under a MIT license. TinyMCE is licensed under a LGPL or commercial license

TinyMCE Basics

The following demos showcase common how-tos like creating toolbar buttons, menu items, formattingS etc.

Useful styles to include in your content css

The default content css is very barebone for maximum flexibility. Here are some tips on styles you can include in your content css to improve the writing experience.

Beginner Content Styling

Badges with custom text and colors

Badges are a common ui component in web apps to indicate statuses. Here is one of many ways to implement them in TinyMCE. This demo allows the user to choose their own text and colors through a dialog and demonstrating how to use formats to create a badge but use the selection api for editing it to make sure the whole badge gets the changes and not just the selected text within it.

Intermediate Buttons & Menus Dialogs Formats

Creating custom toolbar buttons, menus and context toolbars.

This demo uses a custom callout block to demonstrate how to create toolbar buttons, customizing the menu and showing a context toolbar when selecting the callout. It also shows how to add a custom icon pack for our custom toolbar button.

Intermediate Buttons & Menus

Webapp description/comment/reply editor

Here is a demo of an editor suitable for description fields, comment and replys found in webapps like Jira, Zendesk, Asana among others. This demo also includes how to use the text_pattern plugin to achieve automatic conversion of stars into proper lists etc.

Intermediate Plugin:Textpattern

Right aligned toolbar buttons

Normally we strongly advice against overriding the TinyMCE CSS to tweak the editor. The proper way to change the visual appearance is to make a skin. That said, there is always exceptions to a good rule and moving a couple of toolbar buttons to the right side of the toolbar is one example of such an exeception.

Beginner Toolbar

Format links to look like buttons

This demo shows how to format a link into a call-to-action button by creating a custom format that applies a class to a link turning it into a button.

Beginner Formats

Using fonts

Learn how to configure tinyMCE to use different fonts

Beginner Content Styling Formats

Images

Image related demos

Toggle between image sizes and layouts using a context toolbar

A popular pattern among blog and cmses is to allow the author to switch between different preset image sizes like small, wide and full as well as aligning the image left or right. It also showcases the quickbars plugin that uses medium style context toolbars when selecting content.

Intermediate Buttons & Menus Content Styling Formats

Tables

Demos showcasing diffrent ideas and concepts around tables

An alternate table context toolbar

TinyMCE 5.4 introduced a couple of new table APIs we can use to construct an alternative table context toolbar. In this demo showcases a table header row/column toggle, a menu for choosing cell background color menu among other things.

Intermediate Buttons & Menus Plugin:Tables

Table row templates

This demo illustrates inserting templated table rows. This could be useful when dealing with document automation or reporting type apps.

Intermediate Buttons & Menus Plugin:Tables

Tokens

Tokens – or mail merge variables such as {{name.first}} – are often found in document automation and email editors. Here are three ways you can implement them in TinyMCE

Text-based tokens

Transform any text based tokens such as {{name.first}} into spans that we can style and make noneditable – and transform back to pure text when storing the content. Perfect for existing systems as this approach is non-destructive to your content.

Beginner Buttons & Menus Content Styling Plugin:Noneditable

Web component tokens

With the january 2020 release of Microsoft Edge, all major browsers now supports web components. Here we create a custom element called <inline-token> that becomes our token. Tip: You can render the custom element using vue/angular/react in your front-end

Master Buttons & Menus Content Styling Custom Elements

Span-based tokens

Here we use a span with a class to wrap our token. A simple but powerful approach.

Beginner Buttons & Menus Content Styling

Templates

Examples and ideas how to implement templates and layouts with TinyMCE. For example how to only enable editing on select parts of a document or to enable multiple column support in TinyMCE

Locked down template example 1: using the default inline mode

A popular question we get is how to lock down the editor in different ways to force a specific order of elements or prevent formatting. The way to do this is by using the inline mode which will give you more flexibility over the TinyMCE UI. Here is a basic example using the regular inline mode.

Intermediate Inline Mode

Email

Examples and ideas how to create HTML email editors with TinyMCE, from a rich text webmail editor to the recommended approach for creating visually rich marketing email editor implementations.

Webmail rich text editor

Demo of a simple rich text webmail editor including how to set inline CSS styles on the default paragraphs

Beginner Formats

Marketing email editor using inline mode

The recommended approach to do marketing emails containing layouts is to move the table layout outside of TinyMCE and enable TinyMCE inline mode on the text blocks only.

Master Content Styling Inline Mode

Cool demos

Sometimes you just want to show off right? Here are a couple of demos showcasing just how versatile TinyMCE is

Expand and show toolbar

A truly minimal and elegant example of an editor that starts out like a unintrusive textarea and grows into a rich text editor upon focus. Demonstrates an interesting use of the inline mode and features like inline placeholder, toolbar groups as well as our new premium thin icon pack.

Master Buttons & Menus Content Styling Inline Mode Toolbar Skinning

Document automation styled conditional blocks using Web Components

This demo shows how to use Web Components to create conditional blocks often found in document and marketing automation apps. The power with Web Components is that they allow us to create complex HTML stuctures and abstract away that into a single custom element, in this case the <conditional-block>...</conditional-block>

Master Buttons & Menus Custom Elements Dialogs Skinning

Create a slash commands plugin

Learn how to make a slash commands plugin using the auto completer API to quickly insert different content types

Master Buttons & Menus

Make a wordprocessor

Create a wordprocessor-like implementation with TinyMCE

Beginner Buttons & Menus Toolbar Skinning Content Styling