• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Edit rich text content in Craft CMS using Redactor by Imperavi.

Redactor icon

Redactor

This plugin adds a “Redactor” field type to Craft CMS, which provides a rich text editor powered by Redactor by Imperavi.

Requirements

This plugin requires Craft CMS 4.0 or later.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Redactor”. Then click on the “Install” button in its modal window.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/redactor

# tell Craft to install the plugin
./craft install/plugin redactor

Configuration

Redactor Configs

You can create custom Redactor configs that will be available to your Redactor fields. They should be created as JSON files in your config/redactor/ folder.

For example, if you created a config/redactor/Standard.json file with the following content:

{
  "buttons": ["html", "format", "bold", "italic", "lists", "link", "file"],
  "plugins": ["fullscreen"]
}

…then a “Standard” option would become available within the “Redactor Config” setting on your Redactor field’s settings.

See the Redactor documentation for a list of available config options and buttons.

Craft Redactor config options

Craft addes the enforceButtonOrder config option that can be set to a list of button names in the expected order. This option should be used to address the uncontrollable button order set by Redactor when adding plugins to the configuration.

HTML Purifier Configs

Redactor fields use HTML Purifier to ensure that no malicious code makes it into its field values, to prevent XSS attacks and other vulnerabilities.

You can create custom HTML Purifier configs that will be available to your Redactor fields. They should be created as JSON files in your config/htmlpurifier/ folder.

Copy Default.json as a starting point, which is the default config that Redactor fields use if no custom HTML Purifier config is selected.

See the HTML Purifier documentation for a list of available config options.

For advanced customization, you can modify the HTMLPurifier_Config object directly via the craft\redactor\Field::EVENT_MODIFY_PURIFIER_CONFIG event.

use craft\htmlfield\events\ModifyPurifierConfigEvent;
use craft\redactor\Field;
use HTMLPurifier_Config;
use yii\base\Event;

Event::on(
    Field::class,
    Field::EVENT_MODIFY_PURIFIER_CONFIG,
    function(ModifyPurifierConfigEvent $event) {
        /** @var HTMLPurifier_Config $config */
        $config = $event->config;
        // ...
    }
);

Redactor JS Plugins

All first party Redactor JS plugins are bundled by default. To enable them, just add the plugin handle to the plugin array in your Redactor config.

{
  "plugins": ["alignment", "fullscreen"]
}

You can also supply your own Redactor plugins by saving them in your config/redactor/ folder. You can either place the plugin directly in that folder, or within a subfolder that is named after the plugin:

config/
└── redactor/
    └── plugins/
        ├── foo.js
        └── bar/
            └── bar.js

Other Craft plugins can supply additional Redactor JS plugin locations using the craft\redactor\Field::EVENT_REGISTER_PLUGIN_PATHS event.

More Repositories

1

cms

Build bespoke content experiences with Craft.
PHP
3,213
star
2

happy-lager

Craft CMS demo site.
PLpgSQL
735
star
3

awesome

A collection of awesome Craft CMS plugins, articles, resources and shiny things.
526
star
4

element-api

Create a JSON API/Feed for your elements in Craft.
PHP
498
star
5

contact-form

Add a simple contact form to your Craft CMS site.
PHP
293
star
6

feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
PHP
287
star
7

commerce

Fully integrated ecommerce for Craft CMS.
PHP
215
star
8

craft

Composer starter project for Craft CMS.
Twig
183
star
9

nitro

Speedy local dev environment for @craftcms.
Go
178
star
10

plugins

The master list of Craft 3-compatible plugins
107
star
11

guest-entries

Accept anonymous entry submissions with Craft.
PHP
106
star
12

docker

Craft CMS Docker images.
Dockerfile
102
star
13

webhooks

Plugin for integrating Craft with Zapier and IFTTT.
PHP
84
star
14

generator

Scaffold new Craft CMS plugins, modules, and system components from the CLI
PHP
83
star
15

starter-blog

Blog starter site learning resource.
JavaScript
79
star
16

server-check

Craft CMS server requirements checker.
Hack
68
star
17

store-hours

Manage business hours with Craft CMS.
PHP
62
star
18

aws-s3

Amazon S3 volume type for Craft CMS.
PHP
60
star
19

gatsby-source-craft

Gatsby source plugin for Craft CMS.
TypeScript
54
star
20

spoke-and-chain

Craft CMS + Craft Commerce demo site.
Twig
54
star
21

phpstorm-settings

PhpStorm settings used for Craft CMS development.
50
star
22

anchors

Add anchor links to headings in your Craft CMS website content.
PHP
48
star
23

europa-museum

Craft CMS demo site.
SCSS
47
star
24

ckeditor

Edit rich text content in Craft CMS using CKEditor.
PHP
46
star
25

shopify

Synchronize and extend product data from your Shopify storefront.
PHP
45
star
26

apple-news

Publish your Craft CMS content with Apple News Format.
PHP
41
star
27

docs

Documentation for Craft CMS, Craft Commerce, and other official products.
JavaScript
38
star
28

commerce-stripe

Stripe payment gateway for Craft Commerce
PHP
30
star
29

plugin-installer

Composer installer for Craft CMS plugins.
PHP
28
star
30

mailgun

Mailgun mailer adapter for Craft CMS.
PHP
28
star
31

redactor-clips

Adds Redactor’s “Clips” plugin to Rich Text fields in Craft
PHP
27
star
32

simple-text

Simple textarea field type for Craft CMS.
JavaScript
27
star
33

contact-form-honeypot

Add a honeypot captcha to your Craft CMS contact form.
PHP
26
star
34

vue-asset

⛔️ DEPRECATED | Vue.js asset bundle for Craft 3 Beta
JavaScript
24
star
35

postmark

A Postmark mail adapter for Craft CMS.
PHP
20
star
36

rector

Rector rules for updating plugins and modules to Craft CMS 4.
PHP
19
star
37

digital-products

Sell digital products with Craft Commerce.
PHP
18
star
38

legacy-docs

The source documentation for Craft CMS
JavaScript
16
star
39

ecs

Easy Coding Standard configurations for Craft CMS projects.
PHP
16
star
40

oauth2-craftid

Craft ID Provider for OAuth 2.0 Client.
PHP
15
star
41

query

Run SQL queries as an admin from the Craft CMS control panel.
PHP
15
star
42

gatsby-helper

Craft CMS helper plugin for Gatsby.
PHP
15
star
43

fix-fks

Utility that restores any missing foreign key constraints
PHP
12
star
44

mandrill

Mandrill mailer adapter for Craft CMS.
PHP
12
star
45

phpstan

PHPStan configuration for Craft CMS projects.
12
star
46

google-cloud

Google Cloud Storage volume type for Craft CMS.
PHP
11
star
47

tutorial-project

Tutorial demo project source.
Twig
9
star
48

image

Container images that are used as the base for Craft CMS container applications
Dockerfile
8
star
49

sass

Sass mixins for the Craft CMS control panel.
SCSS
8
star
50

commerce-paypal

PayPal payment gateway for Craft Commerce.
PHP
6
star
51

commerce-omnipay

Omnipay gateway bridge for Craft Commerce
PHP
5
star
52

license

The Craft License
5
star
53

hexdec

Adds a ‘hexdec’ filter to Craft CMS.
PHP
5
star
54

commerce-paypal-checkout

PayPal Checkout gateway for Craft Commerce.
PHP
5
star
55

commerce-mollie

Mollie payment gateway for Craft Commerce.
PHP
5
star
56

.github

GitHub community files for Craft CMS.
5
star
57

ontherocks

JavaScript
5
star
58

stripe

Sync and extend Stripe products and subscriptions.
PHP
5
star
59

azure-blob

Azure Blob Storage for Craft CMS.
PHP
4
star
60

commerce-sagepay

SagePay payment gateway for Craft Commerce.
PHP
4
star
61

yii2-dynamodb

Yii2 implementation of a queue and cache driver for DynamoDB
PHP
4
star
62

automation-workshop

PLpgSQL
4
star
63

html-field

Base class for Craft CMS field types with HTML values.
PHP
4
star
64

cloud

Public repo for discussions, feature requests, and ehancements Craft Cloud. For support, please email [email protected]
4
star
65

legacy-commerce-docs

Commerce Documentation
JavaScript
4
star
66

flysystem

Flysystem integration package for Craft CMS 4
PHP
3
star
67

locales

Craft CMS localization data for all the locales.
PHP
3
star
68

commerce-eway

eWay payment gateway for Craft Commerce.
PHP
3
star
69

commerce-multisafepay

MultiSafepay payment gateway for Craft Commerce.
PHP
3
star
70

rackspace

Rackspace Cloud Files volume type for Craft CMS
PHP
2
star
71

commerce-paystack

Paystack payment gateway for Craft Commerce.
PHP
2
star
72

commerce-worldpay

Worldpay payment gateway for Craft Commerce.
PHP
2
star
73

plugin-port-helper

Plugin port helper for porting plugins from Craft 2 to Craft 3.
PHP
2
star
74

homebrew-nitro

Brew repository for Craft Nitro.
Ruby
2
star
75

commerce-taxjar

TaxJar integration for Craft Commerce.
PHP
2
star
76

docs-translations

Translated content moved out of `docs` and maintained separately.
JavaScript
1
star
77

textlint-rule-linkable-params

Custom textlint rule for allowing lowercase variations of terms when linked.
JavaScript
1
star
78

craftcms-imgproxy

PHP
1
star
79

console

Public repo for bug reports, discussions, feature requests, and ehancements Craft Console and the Plugin Store
1
star
80

ddev-craft-cloud

Shell
1
star