How to clone Trix default link button, so I have modal and insert text into editor?
- Dominant language
- JavaScript
- Stars
- 20k
- Forks
- 1.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 13
Description
Hi
I need help because after extensive Google search I did not find any solution.
I would like to add a button to Trix editor that would insert YouTube video using custom HTML attribute. It seems to me that default `link` button is exactly what I need. I would need to just modify little bit what is done once someone click the link button after text is entered.
[![enter image description here][1]][1]
The standard link button
- has Trix menu button
- has input field
- has input value validation
- link and unlink functionality. I might want to remove the `unlink` button
- inserts text into editor
I was searching the net but did not find any example how to achieve what I want. The closest solution is https://www.kindleman.com.au/blog/advanced-actiontext-modifications-for-cms-use/ the embed, image, and link buttons are basically what I want. But it is coded in RoR. I know nothing about RoR.
Could someone help me to create my link (embed) button in Trix?
Thank you
Radek
[1]: https://i.sstatic.net/82hQ10XT.png
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue does not name a repository file, test, or entry point. Start by reviewing how Trix's standard link button handles its menu, input validation, linking, unlinking, and text insertion. Done would be a documented or implemented way to create a custom embed button that opens a modal and inserts YouTube content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100