Editors

Quill

A rich text editor built on Quill 2, as a form field: label, help text and validation error around it, and its content saved as HTML in a hidden field. Images pasted, dropped or inserted are uploaded to the server and kept as links.

Blade

A bordered box under the "Body" label, with a toolbar on top: bold, italic, underline, strike, headings, text and background colors, size, sub and superscript, alignment and indentation, link, lists, image and video, quote, code block and a button to clear formatting. Each change is saved as HTML in a hidden field named body, sent with the form; an empty editor sends ''.

Bound to Livewire #

The editor opens with the HTML of $body, and each change sets it, e.g. '<p>Hello <strong>world</strong> again</p>'. Setting $body on the server replaces the content shown. toolbar keeps only the listed groups.

<p>Hello <strong>world</strong></p>
Blade

Uploads #

Images go through TALLKit's upload route to the public disk, by default under tallkit-uploads/, and only their URL is stored in the HTML. The first editor stores them under posts/ and accepts images up to 4 MB. With :upload="false" images stay in the HTML as data URLs. Saving the HTML and removing the images it no longer uses is covered in Storing and pruning uploads.

Blade

Read-only and disabled #

readonly and disabled lock the editor and its toolbar; the content stays visible.

Blade

Placeholder and help #

Quill settings go in options, such as its placeholder. The field props (description, help) work as on any field.

Only your team sees this note.

Paste images straight into the text.

Blade

Events #

rendered fires on the tag when the editor is ready, with the Quill instance in $event.detail.editor. editor:x-on:failed listens to load errors.

Quill could not be loaded. words
Blade

Customization #

Classes on the tag go to the field control; editor: attributes reach the editor box, with its border and focus ring.

Blade

Reference

tk:quill

Prop Type Default Description
toolbar string all groups The toolbar groups, separated by spaces: text, heading, color, size, script, align (alignment, indentation, direction), link, list, media (image and video), quote, code. full turns on all of them, none hides the toolbar. Otherwise a "clear formatting" button is always added.
upload array | false on How images are uploaded: disk (one of tallkit.upload.allowed_disks), directory, types (image, video; a string or a list), maxSize in KB (one number, or one per type; a type left out of the map keeps its configured limit, and neither can raise it), guest for pages without a signed-in user, limited to tallkit.upload.guest_types and guest_max_size. url sends the files to an endpoint of your own, which receives file and answers { "url": "..." }. false keeps images inline.
options array [] Quill configuration, merged over the one the component builds (placeholder, formats, modules...).
scripts array [] URLs of scripts loaded before the editor starts, for Quill modules.
styles array [] URLs of stylesheets loaded after Quill's.

Also accepts the field props and the field control props. wire:model and x-model bind the HTML as a string. data-options is an attribute: a JavaScript expression merged over the configuration, for options that are functions.

Slots

Slot Description
default The initial HTML, in place of value.

Events

Event Detail When
rendered { editor }, the Quill instance The editor is ready.
started Quill starts loading.
completed Quill and its stylesheet are loaded.
failed A script could not be loaded, or Quill threw while starting.
upload-failed { error, file, type, message } An image could not be uploaded. Cancelable: without preventDefault() the message is shown in a toast, or in window.alert when the page has no toast area.

Slots

The field props that take a slot (label, help...).

Events

rendered is dispatched on the hidden field, the element the tag's attributes go to, and does not bubble: listen on the tag itself. started, completed and failed are dispatched on the editor box and are listened to with the editor: prefix. upload-failed is dispatched on the hidden field and bubbles.

blade
blade

The second editor handles the failed upload itself: no toast is shown, and the message goes to a Livewire action.

Customization

Classes on the tag go to the field control; other attributes go to the hidden field. The editor box, with its border and focus ring, takes the editor: prefix; the parts around the field take the prefixes of the field props.

blade

Accessibility

The editing area is a role="textbox" with aria-multiline, named by the label and described by the help text and the error, with aria-invalid when the field is invalid. The toolbar buttons have translated names ("Bold", "Heading"...). Tab moves the focus out of the editor instead of inserting a tab.

Behavior notes

  • Quill, its stylesheet and DOMPurify are loaded from jsDelivr when the first editor needs them. When the app already puts both window.Quill and window.DOMPurify on the page, Quill and its stylesheet (quill.snow.css) are not loaded; the scripts and styles of the tag still are, after it.
  • HTML set from outside (the initial value, a Livewire update, a form reset) is sanitized with DOMPurify before it is shown.
  • disabled and readonly lock the editor and the toolbar, and toggling either later switches them.
  • wire:model.blur sends the value when the focus leaves the whole editor, toolbar included.
  • Inside a Livewire component, value and the slot are ignored: the bound property is the value.
  • The HTML the field sends comes from the browser and can hold anything: sanitize it on the server before showing it to other users.
  • The upload route, its signed link (who can use it and for how long) and the guest limits are described in Storing and pruning uploads. php artisan tallkit:prune-uploads deletes uploaded files that nothing uses anymore.
  • The upload request carries the CSRF token (X-XSRF-TOKEN from the cookie, or X-CSRF-TOKEN from the csrf-token meta tag) only when the upload URL is on the page's origin.