async attachContent(content) { let _this = this let formData = new FormData() formData.append("content", content) const response = await patch('/embed', { body: formData, responseKind: "json" }) if (response.ok) { const data = response.json data.then((result) => { const attachment = new Trix.Attachment(result) _this.element.editor.insertAttachment(attachment) _this.element.editor.insertLineBreak() }) } }
<% post.content.body.attachables.each do |node| %> <%= render partial: 'embeds/embed', locals: { embed: Embed.new(id: node.id) } %> <% end %>