Take control over what external links and embedded media is permitted in the Trix editor via copy/paste
npm install trix-embed#### Take control over what external links and embedded media is permitted in the Trix editor via copy/paste
- Setup
- Features
- Allow / Block Lists
- Template Overrides
- Basic Usage
- Allow Lists
- Block Lists
- Sponsors
- Developing
- Releasing
- License
- ActionText
- Stimulus
- Trix
``sh`
bundle add trix_embed
yarn add trix-embed@$(bundle show trix_embed | ruby -ne 'puts $_.split(/-/).last')
`js
import Trix from 'trix'
import "@rails/actiontext"
import { Application, Controller } from '@hotwired/stimulus'
import TrixEmbed from 'trix-embed'
const application = Application.start()
TrixEmbed.initialize({ application, Controller, Trix })
`
Configure allow and/or block lists for external links and embedded media in your Trix editors.
__⚠︎ Block lists have precendence!__
- allowed link hosts
- blocked link hosts
- allowed media hosts
- blocked media hosts
_Note that you can also use wildcards * in any of lists._
TODO: document...
- Allow everything
`html`
- Allow links to all hosts and allow media (images, videos, etc.) from the following hosts: vimeo.com, voomly.com, youtube.com
`html`
- Block everything
`html`
...or simply.
`html`
- Block links to the following hosts: 4chan.org, 8chan.net, thepiratebay.orgdeviantart.com, imgur.com, tumblr.com
and block media (images, videos, etc.) from the following hosts:
`html`
Proudly sponsored by
`sh`
git clone https://github.com/hopsoft/trix_embed.git
cd trix_embed
bin/dev
1. Run yarn and bundle to pick up the latestlib/trix_embed/version.rb
1. Bump version number at . Pre-release versions use .preNpackage.json
1. Bump version number at _(make sure it matches)_. Pre-release versions use -preNyarn build
1. Run - builds both the Ruby gem and the NPM packagerake release
1. Commit and push changes to GitHub
1. Run yarn publish --no-git-tag-version --access public --new-version X.X.X` _(use same version number)_
1. Run
1. Create a new release on GitHub (here) and generate the changelog for the stable release for it
The gem is available as open source under the terms of the MIT License.