-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachments target octet-stream content type #112
Attachments target octet-stream content type #112
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hmmm....I'm not sure overriding the MimeType is the right way to go here. I'm not 100%, but I think this would break anyone using the old "CustomAttachment" functionality from Trix. however, perhaps we do something slightly different. would something like using the other option is to do something like:
|
🤷 I'm not sure either, but for us it was the easiest way to differentiate different kinds of attachments.
Check out how we're doing mention support over in #113 . It might shed some light on where we're coming from, and how we're trying to handle all kinds of "attachments". Thanks again for your work on this! It's been a fun week exploring. |
1.) honestly, I agree. TipTap having an editable schema renders the 2.) right now SGID is purely an attribute we need to send back to Rails. Rhino doesn't do any introspection. 3.) fair point. IIRC contentType may actually be HTML for custom attachments so this may be okay... |
@KonnorRogers Rails uses the # app/models/user.rb
class User < ApplicationRecord
# A custom content type for easy querying
def attachable_content_type
"application/vnd.active_record.user"
end
end I couldn't find anywhere else in Rails where this is used, so hopefully there aren't any adverse side effects. |
@nathancolgate I just confirmed, rendering custom attachments does use the I may need to walk this one back 🤔 |
@KonnorRogers Even after changing the |
@nathancolgate Changing the |
Currently the
parseHTML
function for attachments only uses afigure[data-trix-attachment]
selector. This makes sense as the Rhino editor is heavily geared towards Trix attachments being images.However, while implementing the tiptap mention extension, we ran into a challenge where we want to capture/deliver mentions as Action Text Attachments.
Due to the broad selector above, we had to disable the attachments extension altogether to stop the editor from trying to turn our
@mentions
into image attachments.This PR targets the
octet-stream
content type specifically, which is what Rails delivers by default.Merging this PR would allow users to keep the image attachment functionality of Rhino, while also adding custom content types for other attachments/extensions via the
attachable_content_type
method on objects. For example: