Custom button in richeditor or links in hints
Requirements: Develop functionality for sending emails. When a user selects a template, the application should automatically replace custom tags such as {{ $author }} with the corresponding author's name.
I aim to streamline the user experience by utilizing a unified form for both template-based and custom emails. Users can input personalized text, and with a simple click, the email is sent.
To enhance user convenience, I envision incorporating hints, buttons, or custom buttons within the editor. These elements will feature the aforementioned tags and be clickable. When a user clicks on a tag, the corresponding text will seamlessly insert itself into the editor field, simplifying the process of including dynamic content in the email.
Is it possible?
I want to try with the default editor before install and try other editors
9 Replies
Tried this but doesn't works (maybe works only on v2)
https://v2.filamentphp.com/tricks/add-a-link-to-field-hint-and-helpertext0
Filament
Add a link to field hint() and helperText() by Andrew Peacock - Tri...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Tiptap editor has merge tags, but they aren’t dynamic in the editor. They are meant to be parsed on output.
I would like to find a smarter solution for users
I’m sure it could be done, but you’re going to have to make a custom field with your own editor integration more than likely.
And believe me that’s a lot less fun than it sounds. 😜
🙂 maybe a custom field before the editor with a series of button with some js code to copy the text on click?
what do you think?
I think it depends on the editor and how open it is to modification.
It’s still a custom field and editor instance though. I don’t think you’re going to make it just work with the built in rich editor.
after 3 days of testing to create a custom field livewire and !livewire, i ended with the hintAction
May I ask what the hint action does? It copies customer data in your case straight into the RichText editor field?
Hello Adam, may I ask how you envisioned that? I would use the JSON structure, look for all the merge tags and swap the placeholder value with my actual value/content?
Correct. Merge tags are placeholder so they have to be swapped out when the content is rendered. A simple str_replace() would do the job.