umanit / tiptap-bundle
Standalone TipTap rich text editor for Symfony (Twig components, Stimulus controllers, form type).
Requires
- php: ^8.4
- ext-dom: *
- ext-libxml: *
- symfony/console: ^7.4 || ^8.0
- symfony/form: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/stimulus-bundle: ^2.0
- symfony/translation: ^7.4 || ^8.0
- symfony/twig-bundle: ^7.4 || ^8.0
- symfony/ux-icons: ^2.0 || ^3.0
- symfony/ux-twig-component: ^2.0 || ^3.0
- twig/twig: ^3.0
Requires (Dev)
- doctrine/dbal: ^3.8 || ^4.0
- doctrine/doctrine-bundle: ^2.11 || ^3.0
- doctrine/doctrine-migrations-bundle: ^3.4 || ^4.0
- doctrine/orm: ^2.14 || ^3.0
- symfony/doctrine-bridge: ^7.4 || ^8.0
- symfony/error-handler: ^7.4.17 || ^8.0
- symfony/process: ^7.4 || ^8.0
- umanit/dev-bundle: ^3.2
Suggests
- doctrine/dbal: Lets the audit and the migration read and rewrite the columns of the database which hold contents
- doctrine/doctrine-migrations-bundle: Registers the migration of the bundle, which creates the table where the migration saves the contents it rewrites
- doctrine/orm: Maps the table where the migration saves the contents it rewrites, so that `doctrine:migrations:diff` creates it
- symfony/process: Needed by the `umanit:tiptap:audit` command, which runs the editor under Node
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-12 10:57:20 UTC
README
Standalone TipTap rich text editor for Symfony: Twig components, Stimulus controllers and a form type, plus the tooling to migrate existing contents written with another editor (CKEditor…). No dependency on Bootstrap or on any application framework.
Status: work in progress. Nothing is stable yet and the package is not released: see the changelog.
Requirements
- PHP
^8.4withext-domandext-libxml(a hard requirement: the cleaning relies on the HTML5 parser\Dom\HTMLDocument, which only exists since PHP 8.4) - Symfony
^7.4 || ^8.0, withsymfony/stimulus-bundle,symfony/ux-twig-componentandsymfony/ux-icons - Webpack Encore or AssetMapper
- Optional:
symfony/process+ Node (audit, clean and palette commands),doctrine/dbalanddoctrine/orm(read and rewrite the columns of the database)
Installation
composer require umanit/tiptap-bundle
The JavaScript package @umanit/tiptap-bundle ships in the assets/ directory of the Composer package. Its four
Stimulus controllers (editor, dropdown, image, modal) are declared in assets/controllers.json, which Symfony
Flex does for you, as well as the reference to the package in your package.json with Webpack Encore. Without Flex,
add it yourself:
"@umanit/tiptap-bundle": "file:vendor/umanit/tiptap-bundle/assets"
With AssetMapper the bundle exposes its sources by itself, but @tiptap/pm has no root export, so its sub-paths must be
required explicitly. Flex does not fill the importmap for you: resolving the dependencies of TipTap currently fails
(jsDelivr writes a version range already encoded, which AssetMapper encodes a second time). The
playground is a working application for both pipelines and lists the exact steps.
Usage
In a form:
use Umanit\TiptapBundle\Form\Type\TiptapType; $builder->add('body', TiptapType::class, [ 'toolbar' => 'default', 'styles_set' => 'default', 'colors_set' => 'default', ]);
Other options: background_colors_set, cell_background_colors_set, templates_set, file_manager_url,
file_manager_adapter, migration_diff and the standard disabled, which shows the editor greyed out and unusable
(the content is then not submitted, as with any disabled field).
The attr of the widget land on the <textarea> which holds the content (the field a form submits), as with any field.
A class is added to the ones of the editor:
{{ form_widget(form.body, {attr: {'data-my-controller-target': 'input'}}) }}
Standalone, in Twig:
<twig:Umanit:Tiptap:Editor id="body" name="body" :content="html" />
Customizing the editor
The tools, the toolbar, the styles, the colors and the templates are built by services you can replace. Implement one of
ToolsBuilderInterface, ToolbarBuilderInterface, StylesSetsBuilderInterface, ColorsSetBuilderInterface
or TemplatesSetBuilderInterface (src/Builder): it is picked up by autoconfiguration. The default builders are
neutral.
To add a tool to the toolbar, a TipTap extension or a manager of your own, see customization.md.
Configuration
# config/packages/umanit_tiptap.yaml umanit_tiptap: migration_diff: false # warn when a loaded content is rewritten by the editor (acceptance environments) audit: node_command: node # how to start Node (`yarn node` with Yarn PnP)
Styling
Native CSS, no preprocessor: tiptap-editor.css (the editor UI), tiptap-content.css (the content, to load where it is
displayed) and tiptap-email.css (inlined styles for emails), in assets/dist/css. The PurgeCSS safelist is exposed as
@umanit/tiptap-bundle/purgecss-safelist. The editor UI is themed through its --umanit-tiptap-* custom properties
(see the accessibility notes before changing its colors).
Migrating existing contents
Four console commands take contents written with another editor to TipTap, in this order:
| Command | Purpose | Documentation |
|---|---|---|
umanit:tiptap:audit |
Measure what the schema would drop from the contents | migration-audit.md |
umanit:tiptap:clean |
Remove the leftovers of Word and of other editors | cleaning.md |
umanit:tiptap:palette |
Build the palette of the colors and sizes the contents use | palette.md |
umanit:tiptap:migrate |
Rewrite the contents (with backup and rollback) | migration.md |
All of them simulate by default. Other documents:
- Customizing the editor: add a tool, a TipTap extension or a manager from your application.
- The round-trip CLI: the Node script behind the audit, usable on its own.
- The migration diff: in the editor, warn when a loaded content is rewritten and show the difference.
Development
You need PHP 8.4 (ext-dom, ext-libxml), Composer, and Node and Yarn at the versions of mise.toml
(mise install works, so does any other version manager):
make install make full_static_analyze
make help lists the targets; make fix applies the automatic fixes, make playground serves the demo application.
A Nix flake is provided for those who use Nix (direnv allow or nix develop); it is optional.
See AGENTS.md for the conventions of the project.