Repository navigation
feat: store media ids in the rich editor, with a file attachment provider - #779
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in way for the rich editor integration to store each inserted image's media key in
data-idagain, the attribute Filament uses for its own attachments. 5.5 stopped storing it because Filament treatsdata-idas a disk path when the editor has no provider for it, and the image lost itssrc.AttachCuratorMediaPlugin::make()->storeMediaIds()sends the key to the editor. It's off by default, so nothing changes unless an app opts in.CuratorFileAttachmentProviderthrough Filament'sHasFileAttachmentProvider. 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.Uploader, with the same type detection, SVG sanitizing, naming and paths. It leaves the library alone when Filament cleans up attachments.Uploader::storeUploadedFile()andisAcceptedFile()are now public so the panel and the provider share them.docs/fields/rich-editor.mddocuments the option, fields outside a rich content attribute, tamper protection and content saved before 5.5.composer testpasses (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