Skip to content

Modules

Concept

Modules are functional extensions that enhance the capabilities of the Quill editor beyond simple text formatting. They allow you to add interactive features, modify event handling, or integrate external tools.

  • Goal: To provide business logic or complex functionality (e.g., resizing images, counting words, voice dictation, managing undo history).
  • How it works: A module is loaded when the editor starts. It can interact with the Quill API, listen to events (keystrokes, selection changes),
  • manipulate the editor's DOM, or add interface elements.

Note: This bundle provides several custom modules that do not exist natively in QuillJS (like ReadTimeModule, STTModule, FullScreenModule, etc.), offering advanced features out of the box.


This bundle categorizes modules into two types:

  1. Field-dependent Modules: These modules are tied to a specific Field DTO in quill_options. They are usually auto-loaded as soon as the corresponding field is added to the toolbar.
  2. Independent Modules: These modules provide global functionality or behavior regardless of specific fields. They usually require manual registration in the modules array.

  • You can add/customize quill modules in this option field.
  • You can create your own modules classes, they need to implement the ModuleInterface and add the name and options properties.
  • Some modules are automatically loaded when they are needed in fields by implementing the QuillFieldModuleInterface.

See Custom Fields for more details.

Example of how to use modules:

php
use Ehyiah\QuillJsBundle\Form\QuillType;
use Ehyiah\QuillJsBundle\DTO\Modules\STTModule;

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('content', QuillType::class, [
            'quill_options' => [
                //
            ],
            'modules' => [
                new SyntaxModules(),
                new TableModule(
                    'menus' => ['column', 'row', 'merge', 'table', 'cell', 'wrap', 'copy', 'delete'],
                    'toolbarTable' => 'true', // must be set to true to show the table toolbar options in TableModule
                    'language' => 'fr_FR',
                ),
            ],
            //
        ])
    ;
}

Modules list

See module details on the left menu

Field-dependent Modules

These modules are usually automatically imported when the corresponding field is present in quill_options.

moduleauto-importeddescriptionnameoptions typedefault options
DividerModuleYESsee detailsdividerarray[]
EmojiModuleYESRequired if EmojiField is activated.emoji-toolbarstring'true'
ImageSelectionModuleYESsee detailsimageSelectionarraysee Ehyiah\QuillJsBundle\DTO\Modules\ImageSelectionModule
LinkAttributesModuleYESsee detailslinkAttributesarraysee Ehyiah\QuillJsBundle\DTO\Modules\LinkAttributesModule
PageBreakModuleYESsee detailspageBreakarray['label' => 'Page Break']
ResizeModuleYES(Legacy) Basic image resizing functionality.resizearray[]
SyntaxModuleYESRequired for CodeBlockField.syntaxstring'true'
TableModuleYESsee detailstable-betterarraysee Ehyiah\QuillJsBundle\DTO\Modules\TableModule

Independent Modules

These modules provide global behavior and must usually be added manually to the modules option.

moduleauto-importeddescriptionnameoptions typedefault options
AutosaveModuleNOsee detailsautosavearraysee Ehyiah\QuillJsBundle\DTO\Modules\AutosaveModule
CounterModuleNOsee detailscounterarraysee Ehyiah\QuillJsBundle\DTO\Modules\CounterModule
FullScreenModuleNOsee detailstoggleFullscreenarraysee Ehyiah\QuillJsBundle\DTO\Modules\FullScreenModule
HistoryModuleNOResponsible for handling undo and redo.historyarray['delay' => '1000', 'maxStack' => '100', 'userOnly' => 'false']
HtmlEditModuleNOsee detailshtmlEditButtonarraysee Ehyiah\QuillJsBundle\DTO\Modules\HtmlEditModule
MarkdownModuleNOsee detailsmarkdownarray[]
MentionModuleNOsee detailsmentionarraysee Ehyiah\QuillJsBundle\DTO\Modules\MentionModule
NodeMoverModuleALWAYSsee detailsnodeMoverarray[]
PasteSanitizerModuleNOsee detailspasteSanitizerarray['plain_text' => true]
ReadTimeModuleNOsee detailsreadingTimearray['wpm' => '200', 'label' => 'Reading time: ', 'suffix' => ' min read']
SmartLinksModuleNOsee detailssmartLinksarray['linkRegex' => '/https?://[^\s]+/']
STTModuleNOsee detailsspeechToTextarraysee Ehyiah\QuillJsBundle\DTO\Modules\STTModule
ImageGalleryModuleYESAn image gallery to allow to pick images from a galleryimageGalleryarraylistEndpoint, uploadEndpoint, searchEndpoint, icon