-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Confusion with insertHTML method #120
Comments
Do you have CSS in your app that styles It's working as expected on http://trix-editor.org/
There's no list of accepted tags because we use computed styles to determine the corresponding attributes. The attributes are those that you see on the toolbar.
You could do this what we call content attachments, which aren't documented yet. embed = '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
attachment = new Trix.Attachment({content: embed})
element.editor.insertAttachment(attachment) |
@javan Thank you for your feedback here and especially within such short time. Perhaps I haven't been able to dig deep enough to understand Trix completely, which is leading to some of my confusion. Your thoughts are spot on. I do have I really appreciate this—thank you again. Trix is an exciting project. |
🍻 |
Hi, @javan. I am struggling with one more thing. I used your example above successfully to add custom attachments in my editor. Specifically, I am enabling video embedding, but I want to provide the "remove" option at all times (not just when selected). Is this possible? I attempted to insert a custom removal button into the attachment HTML (while permanently hiding the default button), but I am confused on how to appropriately add a click event listener to the option that persists whenever the editor state changes. Thanks again for any help you may be able to provide here. |
Also, I want to bring to you attention this issue I noticed when inserting iframe/video attachments. When cursor is above the attachment and you hit enter, sometimes it loses focus completely. It appears to happen most when hitting enter from a line of text—less when from an empty line. You will see the cursor disappear here a few times. Other times the cursor is still there, in which case it's working fine despite the video taking a few seconds to reload. |
In the documentation, it states you can insert HTML into the editor document:
...though it does not seem to work except for inserting formatting, such as
<b>test</b>
, which is already handled by the toolbar.<div>
tag, it inserts nothing.<b>
works as an alternative.This may be the reason, but it's not clear and can waste a bit of time. If there's a list of accepted tags and attributes, perhaps it would be valuable to add this info to the README.
Or maybe I'm misunderstanding something?
The text was updated successfully, but these errors were encountered: