Information on how to work with Tiptap extensions in the rich text editor.
The Rich Text Editor (RTE) in Umbraco is based on the open-source editor Tiptap.
Out of the box, Tiptap has limited capabilities and everything is an extension by design. Basic text formatting features such as bold, italic, and underline are their own extensions. This offers great flexibility, making the rich text editor highly configurable. The implementation in Umbraco offers a wide range of built-in extensions to enhance the Tiptap editor capabilities.
Using the same extension points, this article will show you how to add a custom extension to the rich text editor.
Tiptap has a library of supported native extensions. You can find a list of these extensions on the Tiptap website. While many of these are open source, there are also pro extensions available for commercial subscriptions.
There are two types of extension: tiptapExtension
and tiptapToolbarExtension
.
The tiptapExtension
extension is used to register a native Tiptap Extension. These will enhance the capabilities of the rich text editor itself. For example, to enable text formatting, drag-and-drop functionality and spell-checking.
The tiptapToolbarExtension
extension adds a toolbar action that interacts with the Tiptap editor (and native Tiptap extensions).
This example assumes that you will be creating an Umbraco package using the Vite/Lit/TypeScript setup. You can learn how to do this Vite Package Setup article.
In this example, you will take the native Tiptap open-source extension Highlight. Then register it with the rich text editor and add a toolbar button to invoke the Task List action.
Install the Highlight extension from the npm registry.
Create the code to register the native Tiptap extensions in the rich text editor.
Create the toolbar action to invoke the Highlight extension.
Once you have the above code in place, they can be referenced in the package manifest file.
Upon restarting Umbraco, the new extension and toolbar action will be available in the Tiptap Data Type configuration settings.