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 StylingTinyMCE 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
The following demos showcase common how-tos like creating toolbar buttons, menu items, formattingS etc.
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 StylingBadges 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 Dialogs FormatsThis 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.
IntermediateHere 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:TextpatternHere is a guide on how to visually integrate TinyMCE into Bootstrap using our Bootstrap skin
Beginner Content Styling SkinningNormally 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.
BeginnerThis 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 FormatsLearn how to configure tinyMCE to use different fonts
Beginner Content Styling FormatsImage related demos
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 Content Styling FormatsThis demo shows how to use an inline context form to set the alt text on an image without having to use dialogs.
IntermediateDemos showcasing diffrent ideas and concepts around tables
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 Plugin:TablesThis demo illustrates inserting templated table rows. This could be useful when dealing with document automation or reporting type apps.
Intermediate Plugin:TablesTokens – 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
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 Content Styling Plugin:NoneditableWith 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
Here we use a span with a class to wrap our token. A simple but powerful approach.
Beginner Content StylingExamples 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
This demo shows how to implement an empty page placeholder UI containing complex HTML and buttons to insert templates. This feature is found in popular apps like Notion and Atlassian Confluence among others.
Master Content Styling Plugin:TemplatesDemo of how to implement columns using CSS Columns and a toolbar button to toggle columns on/off
Intermediate FormatsA 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 ModeAnother visual approach is to use the quickbars plugin which enables "Medium" styled context toolbars. This provides a more seamless and integrated solution
Intermediate Inline ModeA third example is using the fixed_toolbar_container
option that allows you to render the toolbars anywhere on the page for maximum flexibility. This approach is very suitable for web apps.
All the previous locked down examples have shown a borderless editing experience. Here is an example on how to frame the inline editor to closer match the iframe version of TinyMCE.
Master Inline ModeExamples 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.
Demo of a simple rich text webmail editor including how to set inline CSS styles on the default paragraphs
Beginner FormatsThe 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 ModeSame example as the previous one but with a fixed toolbar.
Master Content Styling Inline ModeThis demo covers some additional config options and incorporates the token example
Master Content Styling Inline ModeSometimes you just want to show off right? Here are a couple of demos showcasing just how versatile TinyMCE is
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 Content Styling Inline Mode SkinningThis 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>
Learn how to make a slash commands plugin using the auto completer API to quickly insert different content types
MasterCreate a wordprocessor-like implementation with TinyMCE
Beginner Skinning Content Styling