{"id":15591227,"url":"https://github.com/hopsoft/trix_embed","last_synced_at":"2025-08-19T08:33:05.678Z","repository":{"id":187478133,"uuid":"674516915","full_name":"hopsoft/trix_embed","owner":"hopsoft","description":"Take control over what external links and embedded media is permitted in the Trix editor via copy/paste","archived":false,"fork":false,"pushed_at":"2023-12-04T18:36:16.000Z","size":206,"stargazers_count":12,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T02:37:59.324Z","etag":null,"topics":["actiontext","stimulus","trix","trix-editor","wysiwyg"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hopsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-04T06:20:02.000Z","updated_at":"2024-07-13T06:41:45.000Z","dependencies_parsed_at":"2023-12-04T19:47:14.535Z","dependency_job_id":"a507495b-912d-487b-90e3-b7e3c8e817e5","html_url":"https://github.com/hopsoft/trix_embed","commit_stats":null,"previous_names":["hopsoft/trix_embed"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Ftrix_embed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Ftrix_embed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Ftrix_embed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopsoft%2Ftrix_embed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hopsoft","download_url":"https://codeload.github.com/hopsoft/trix_embed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251297148,"owners_count":21566754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actiontext","stimulus","trix","trix-editor","wysiwyg"],"created_at":"2024-10-02T23:40:40.207Z","updated_at":"2025-04-28T10:41:30.933Z","avatar_url":"https://github.com/hopsoft.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trix Embed\n\n#### Take control over what external links and embedded media is permitted in the Trix editor via copy/paste\n\n\u003c!-- Tocer[start]: Auto-generated, don't remove. --\u003e\n\n## Table of Contents\n\n  - [Dependencies](#dependencies)\n  - [Setup](#setup)\n  - [Features](#features)\n    - [Allow / Block Lists](#allow--block-lists)\n    - [Template Overrides](#template-overrides)\n  - [Basic Usage](#basic-usage)\n    - [Allow Lists](#allow-lists)\n    - [Block Lists](#block-lists)\n  - [Persistence](#persistence)\n  - [Sponsors](#sponsors)\n  - [Developing](#developing)\n  - [Releasing](#releasing)\n  - [License](#license)\n\n\u003c!-- Tocer[finish]: Auto-generated, don't remove. --\u003e\n\n## Dependencies\n\n- [ActionText](https://github.com/rails/rails/tree/main/actiontext)\n- [Stimulus](https://github.com/hotwired/stimulus)\n- [Trix](https://github.com/basecamp/trix)\n\n## Setup\n\n```sh\nbundle add trix_embed\nyarn add trix-embed@$(bundle show trix_embed | ruby -ne 'puts $_.split(/-/).last')\n```\n\n```js\nimport Trix from 'trix'\nimport \"@rails/actiontext\"\nimport { Application, Controller } from '@hotwired/stimulus'\nimport TrixEmbed from 'trix-embed'\n\nconst application = Application.start()\nTrixEmbed.initialize({ application, Controller, Trix })\n```\n\n## Features\n\n### Allow / Block Lists\n\nConfigure allow and/or block lists for external links and embedded media in your Trix editors.\n\n__⚠︎ Block lists have precendence!__\n\n- allowed link hosts\n- blocked link hosts\n- allowed media hosts\n- blocked media hosts\n\n_Note that you can also use wildcards `*` in any of lists._\n\n### Template Overrides\n\nTODO: document...\n\n## Basic Usage\n\n### Allow Lists\n\n- Allow everything\n\n    ```html\n    \u003cform\u003e\n      \u003cinput id=\"content\" name=\"content\" type=\"hidden\"\u003e\n      \u003ctrix-editor id=\"editor\" input=\"content\"\n        data-controller=\"trix-embed\"\n        data-trix-embed-allowed-link-hosts-value='[\"*\"]'\n        data-trix-embed-allowed-media-hosts-value='[\"*\"]'\u003e\n      \u003c/trix-editor\u003e\n    \u003c/form\u003e\n    ```\n\n- Allow links to all hosts and allow media (images, videos, etc.) from the following hosts: `vimeo.com, voomly.com, youtube.com`\n\n    ```html\n    \u003cform\u003e\n      \u003cinput id=\"content\" name=\"content\" type=\"hidden\"\u003e\n      \u003ctrix-editor id=\"editor\" input=\"content\"\n        data-controller=\"trix-embed\"\n        data-trix-embed-allowed-link-hosts-value='[\"*\"]'\n        data-trix-embed-allowed-media-hosts-value='[\"vimeo.com\", \"voomly.com\", \"youtube.com\"]'\u003e\n      \u003c/trix-editor\u003e\n    \u003c/form\u003e\n    ```\n\n### Block Lists\n\n- Block everything\n\n    ```html\n    \u003cform\u003e\n      \u003cinput id=\"content\" name=\"content\" type=\"hidden\"\u003e\n      \u003ctrix-editor id=\"editor\" input=\"content\"\n        data-controller=\"trix-embed\"\n        data-trix-embed-block-link-hosts-value='[\"*\"]'\n        data-trix-embed-block-media-hosts-value='[\"*\"]'\u003e\n      \u003c/trix-editor\u003e\n    \u003c/form\u003e\n    ```\n\n  ...or simply.\n\n    ```html\n    \u003cform\u003e\n      \u003cinput id=\"content\" name=\"content\" type=\"hidden\"\u003e\n      \u003ctrix-editor id=\"editor\" input=\"content\" data-controller=\"trix-embed\"\u003e\n      \u003c/trix-editor\u003e\n    \u003c/form\u003e\n    ```\n\n- Block links to the following hosts: `4chan.org, 8chan.net, thepiratebay.org`\n  and block media (images, videos, etc.) from the following hosts: `deviantart.com, imgur.com, tumblr.com`\n\n    ```html\n    \u003cform\u003e\n      \u003cinput id=\"content\" name=\"content\" type=\"hidden\"\u003e\n      \u003ctrix-editor id=\"editor\" input=\"content\"\n        data-controller=\"trix-embed\"\n        data-trix-embed-blocked-link-hosts-value='[\"4chan.org\", \"8chan.net\", \"thepiratebay.org\"]'\n        data-trix-embed-blocked-media-hosts-value='[\"deviantart.com\", \"imgur.com\", \"tumblr.com\"]'\u003e\n      \u003c/trix-editor\u003e\n    \u003c/form\u003e\n    ```\n\n## Persistence\n\nYou'll need to ensure any embedded attachments are prepared for persistence.\n\n```ruby\nclass ContentController \u003c ApplicationController\n  def create\n    Example.create content: TrixEmbed::Attachment.rewrite_for_storage(params[:content].to_s)\n  end\nend\n```\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eProudly sponsored by\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.clickfunnels.com?utm_source=hopsoft\u0026utm_medium=open-source\u0026utm_campaign=trix_embed\"\u003e\n    \u003cimg src=\"https://images.clickfunnel.com/uploads/digital_asset/file/176632/clickfunnels-dark-logo.svg\" width=\"575\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Developing\n\n```sh\ngit clone https://github.com/hopsoft/trix_embed.git\ncd trix_embed\nbin/dev\n```\n\n## Releasing\n\n1. Run `yarn` and `bundle` to pick up the latest\n1. Bump version number at `lib/trix_embed/version.rb`. Pre-release versions use `.preN`\n1. Bump version number at `package.json` _(make sure it matches)_. Pre-release versions use `-preN`\n1. Run `yarn build` - *builds both the Ruby gem and the NPM package*\n1. Commit and push changes to GitHub\n1. Run `rake release`\n1. Run `yarn publish --no-git-tag-version --access public --new-version X.X.X` _(use same version number)_\n1. Create a new release on GitHub ([here](https://github.com/hopsoft/trix_embed/releases)) and generate the changelog for the stable release for it\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopsoft%2Ftrix_embed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhopsoft%2Ftrix_embed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopsoft%2Ftrix_embed/lists"}