Rich text
Rich text fields are edited with TipTap. The column decides how they are stored: a json or array cast keeps TipTap's JSON, and anything else is saved as HTML.
{{-- One component, nothing to build --}}
<x-collaboration::editor field="body" class="prose" />The editor comes with StarterKit; in React and Vue, pass extensions to use your own. In Livewire, the property holding a rich text field receives TipTap's JSON as people type, so type it array|string|null. To use your own TipTap setup instead, add the Collaborative extension to it; Collaboration.whenReady(element, (room) => …) hands you the component's room.
Any other page: the framework-free client works with plain DOM elements:
import { Room, bindTextField } from '@solutionforest/laravel-collaboration'
const room = new Room(config) // the `Collaboration::room()` array, rendered into the page
bindTextField(room, 'title', document.querySelector('#title'))Images in rich text
With Features::uploads() on, pasted or dropped images are uploaded at once, so everybody sees them. Add TipTap's Image extension and turn it on:
<x-collaboration::editor field="body" images />Images are stored on the public disk (uploads_disk in the config). One that no saved record ends up using is deleted by collaboration:prune-uploads, which runs daily.