Skip to content

feat: store media ids in the rich editor, with a file attachment provider - #779

Merged
awcodes merged 1 commit into
5.xfrom
feat/rich-editor-media-ids
Oct 14, 2026
Merged

awcodes merged 1 commit into
5.xfrom
feat/rich-editor-media-ids

Conversation

@awcodes

@awcodes awcodes commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Adds an opt-in way for the rich editor integration to store each inserted image's media key in data-id again, the attribute Filament uses for its own attachments. 5.5 stopped storing it because Filament treats data-id as a disk path when the editor has no provider for it, and the image lost its src.

  • AttachCuratorMediaPlugin::make()->storeMediaIds() sends the key to the editor. It's off by default, so nothing changes unless an app opts in.
  • With the option on, the plugin supplies the new CuratorFileAttachmentProvider through Filament's HasFileAttachmentProvider. Each key resolves to the media's current URL whenever the content is edited or rendered. Only public media resolves, since the key comes from client content.
  • The provider adds editor uploads to the library through the panel's Uploader, with the same type detection, SVG sanitizing, naming and paths. It leaves the library alone when Filament cleans up attachments.
  • Uploader::storeUploadedFile() and isAcceptedFile() are now public so the panel and the provider share them.
  • docs/fields/rich-editor.md documents the option, fields outside a rich content attribute, tamper protection and content saved before 5.5.

composer test passes (696 tests). Also tested in a consuming app's browser suite, where a Curator image inserted into a nested rich editor is stored and rendered by id.

🤖 Generated with Claude Code

…ider

- AttachCuratorMediaPlugin::storeMediaIds() inserts library media with
  its key in the image's data-id, as Filament stores its own attachments.
  It is off by default, so inserted media stays a plain image unless an
  app opts in.
- The plugin then supplies CuratorFileAttachmentProvider through
  Filament's HasFileAttachmentProvider, so a rich content attribute and
  RichContentRenderer resolve each key to the media's current URL. Only
  public media resolves, since the key comes from client content.
- The provider adds editor uploads to the library through the panel's
  Uploader, with its type detection, SVG sanitizing, naming and paths,
  and leaves the library alone when Filament cleans up attachments.
- Uploader::storeUploadedFile() and isAcceptedFile() are public so the
  provider can share them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@awcodes
awcodes merged commit 249c7fd into 5.x Oct 14, 2026
13 checks passed
@awcodes
awcodes deleted the feat/rich-editor-media-ids branch October 14, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant