Allow using Embeds within Redactor. Embeds are referenced Matrix Blocks within the Redactor body.
This plugin requires Craft CMS 3.0 or 4.0 and the Craft Redactor plugin. The plugin has not been tested with current Craft CMS 5.0.
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
(As long as this is unreleased) Add the repository to your composer.json:
{ "repositories": [ { "type": "vcs", "url": "git@github.com:fork/craft-embeds.git" } ] }
-
Then tell Composer to load the plugin. For Craft 3.x use the v1.x and for Craft 4.x use v2.x
composer require fork/embeds:^1.0 composer require fork/embeds:^2.0
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Embeds. This will also install Redactor if it wasn't already installed before.
-
Enable the plugin in redactor by putting it into your config/redactor/MyConfig.json (see Embeds.json)
This plugin adds a Redactor plugin which enables editors to set markers between paragraphs in a redactor field. These markers then work as placeholders for blocks from a matrix field (embeds). In the current development phase, this plugin only supports one redactor field and one matrix field whit the names embedsCopy and embeds. The install migration of the plugin creates these fields automatically and also adds a Redactor configuration file for the copy field. Warning: Renaming the handles of these fields breaks the plugin! The matrix field will be empty. Redactor will be installed automatically by the install migration of this plugin.
Currently there are no configuration options.
Add the two fields to any of your EntryTypes' FieldLayout and don't forget to add some MatrixBlocks to the embeds field. When you add an embed marker to the copy text and add blocks to the matrix field, the plugin will show you which embed will appear at which placeholder.
Some things to do, and ideas for potential features:
- Fix the merging of copy and embeds
- Enable using multiple fields via plugin settings
- Evaluate possibilities for adding srcsets
Brought to you by Fork Unstable Media GmbH