hopsoft/trix_embed

Update to use inline embeds/attachments

hopsoft opened this issue · 0 comments

Bring back the renderTrixAttachment method for inline embeds if/when this PR gets merged and released.

  renderTrixAttachment(content) {
     const attachment = new Trix.Attachment({ content, contentType: trixEmbedMediaTypes.attachment })
     const piece = new Trix.AttachmentPiece(attachment)
     const view = new Trix.AttachmentView(attachment, { piece })

     const figure = Trix.makeElement({
       tagName: 'figure',
       className: view.getClassName(),
       data: view.getData(),
       editable: false
     })

     figure.innerHTML = attachment.getContent()
     return figure.outerHTML
   }