var attachment = new Trix.Attachment({ content: '<span class="mention">@trix</span>' })
element.editor.insertAttachment(attachment)
I used this snippet but it throwed error: Trix is not defined?? How can i handle it? Thank you!
@trix' }) element.editor.insertAttachment(attachment) I used this snippe" /> @trix' }) element.editor.insertAttachment(attachment) I used this snippe" /> @trix' }) element.editor.insertAttachment(attachment) I used this snippe"/>
var attachment = new Trix.Attachment({ content: '<span class="mention">@trix</span>' })
element.editor.insertAttachment(attachment)
I used this snippet but it throwed error: Trix is not defined?? How can i handle it? Thank you!
This is probably because the script
is executing before the trix.js or the npm package(however you are implementing it). For now I haven't found a listener when Trix is ready so a quick solution is to use a CDN instead of those.
These should work if you don't have a problem with the use of CDN