Search by

visualbuilder / filament-tinyeditor

ekoukltd

Filament TinyMce Editor v6

Package info

github.com/visualbuilder/filament-tinyeditor

pkg:composer/visualbuilder/filament-tinyeditor

Statistics

Installs: 53 072

Dependents: 3

Suggesters: 0

Stars: 0

6.2.0 2026-11-26 02:39 UTC

README

A TinyMCE integration for Filament Admin/Forms.

Version Compatibility

Package Version Filament Livewire Laravel PHP TinyMCE
6.x 5.x 4.x 11.x, 12.x 8.2+ 8.x
5.x 5.x 4.x 11.x, 12.x 8.2+ 7.x
4.x 4.x 3.x 10.x, 11.x 8.2+ 7.x

Installation

Install the package via composer

# For Filament 5.x + TinyMCE 8.x
composer require visualbuilder/filament-tinyeditor:^6.0

# For Filament 5.x + TinyMCE 7.x
composer require visualbuilder/filament-tinyeditor:^5.0

# For Filament 4.x
composer require visualbuilder/filament-tinyeditor:^4.0

Publish assets

php artisan vendor:publish --provider="Visualbuilder\FilamentTinyEditor\TinyeditorServiceProvider"
php artisan vendor:publish --provider="Visualbuilder\FilamentTinyEditor\TinyeditorServiceProvider" --tag="config"
php artisan vendor:publish --provider="Visualbuilder\FilamentTinyEditor\TinyeditorServiceProvider" --tag="views"
php artisan vendor:publish --provider="Visualbuilder\FilamentTinyEditor\TinyeditorServiceProvider" --tag="public"

Usage

The editor extends the default Field class so most other methods available on that class can be used when adding it to a form.

use Visualbuilder\FilamentTinyEditor\TinyEditor;

TinyEditor::make('content')
	->fileAttachments(true) // image paste and uploads are off without this
	->fileAttachmentsDisk('public')
	->fileAttachmentsVisibility('public')
	->fileAttachmentsDirectory('uploads')
    ->profile('default|simple|full|minimal|none|custom')
	->rtl() // Set RTL or use ->direction('auto|rtl|ltr')
	->resize('both')
	->columnSpan('full')
    ->required();

Config

The plugin will work without publishing the config, but should you need to change any of the default settings you can publish the config file with the following Artisan command:

php artisan vendor:publish --tag="filament-tinyeditor-config"

Profiles / Tools

The package comes with 4 profiles (or toolbars) out of the box. You can also use a pipe | to separate tools into groups. The default profile is the full set of tools.

'profiles' => [
    'default' => [
		'plugins' => 'accordion autoresize codesample directionality advlist link image lists preview pagebreak searchreplace wordcount code fullscreen insertdatetime media table emoticons',
		// Installing external plugins
		'external_plugins' => [
		'paste_from_word' => 'https://unpkg.com/@pangaeatech/tinymce-paste-from-word-plugin@latest/index.js'
    ],
		'toolbar' => 'undo redo removeformat | styles | bold italic | rtl ltr | alignjustify alignright aligncenter alignleft | numlist bullist outdent indent | forecolor backcolor | blockquote table toc hr | image link media codesample emoticons | wordcount fullscreen',
		'upload_directory' => null,
		// Custom Configs
		'custom_configs' => [
		'paste_webkit_styles' => 'color font-size',
    ]
	],

	'simple' => [
		'plugins' => 'autoresize directionality emoticons link wordcount',
		'toolbar' => 'removeformat | bold italic | rtl ltr | numlist bullist | link emoticons',
		'upload_directory' => null,
	],

	'minimal' => [
		'plugins' => 'link wordcount',
		'toolbar' => 'bold italic link numlist bullist',
		'upload_directory' => null,
	],

	'full' => [
		'plugins' => 'accordion autoresize codesample directionality advlist autolink link image lists charmap preview anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media table emoticons template help',
		'toolbar' => 'undo redo removeformat | styles | bold italic | rtl ltr | alignjustify alignright aligncenter alignleft | numlist bullist outdent indent accordion | forecolor backcolor | blockquote table toc hr | image link anchor media codesample emoticons | visualblocks print preview wordcount fullscreen help',
		'upload_directory' => null,
	],
],

RTL Support

In order for things like text align to work properly with RTL languages you can switch the direction key in the config to 'rtl'.

// config/filament-tinyeditor.php
'direction' => 'rtl'

Following the panel's light/dark switch

TinyMCE bakes its skin into the editor config, so a panel theme change used to need a page reload. Pass both skin pairs to the Alpine component (the published tiny-editor.blade.php view does this) and the editor re-initialises itself on Filament's theme-changed window event, keeping its content:

skin_dark: 'oxide-dark', content_css_dark: 'dark',
skin_light: 'oxide',     content_css_light: 'default',

Omit them and the editor keeps the skin it was initialised with.

Pasted images

Image paste and file uploads are off by default. Pasted data: images and dropped image files are then discarded. A remote <img> inside pasted HTML is still inserted. Call ->fileAttachments(true) on the field to accept them:

use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
use Visualbuilder\FilamentTinyEditor\TinyEditor;

TinyEditor::make('content')
    ->fileAttachments(true)
    ->fileAttachmentsDisk('s3')
    ->fileAttachmentsDirectory('editor-images')
    ->fileAttachmentsAcceptedFileTypes(['image/png', 'image/jpeg'])
    ->fileAttachmentsMaxSize(2048) // KB
    // Optional: store the file yourself and return what getFileAttachmentUrlUsing() receives.
    ->saveUploadedFileAttachmentUsing(fn (TemporaryUploadedFile $file): string => $file->store('editor-images', 's3'))
    // Optional: the URL the editor puts in the <img src>.
    ->getFileAttachmentUrlUsing(fn (string $file): string => route('editor.image', ['path' => $file]))
    // Optional: a file dropped on the body is not inserted. Text and links still drop.
    ->allowFileDrop(false)
    // Optional: announce files dragged over or dropped on the body as `tinyeditor-file-dragover`
    // (detail: { statePath }) and `tinyeditor-files-dropped` (detail: { statePath, files: File[] }) window events.
    ->dispatchDroppedFiles()
    // Optional: when the clipboard holds an image file and an <img> to a remote URL, upload the file.
    ->preferPastedImageFiles();

The editor uploads the file with Livewire, then calls Filament's saveUploadedFileAttachmentAndGetUrl() on the field. Filament validates the accepted types and the maximum size on the server. A failed upload shows a message in the editor and removes the image.

If your app publishes tiny-editor.blade.php, copy the component_key, file_attachments, file_attachments_accepted_types, file_attachments_max_size, allow_file_drop, prefer_pasted_image_files and dispatch_dropped_files arguments from the package view into it.

Versioning

Versioning

This project follow the Semantic Versioning guidelines.

License

Licensed under the MIT license, see LICENSE.md for details.