Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (76 sloc) 3.24 KB
title description overview image options id
Redactor
A fast, customizable WYSIWYG editor.
Redactor is a fast, retina-ready WYSIWYG editor fieldtype. It’s lightweight, customizable, and powerful. Currently using [Redactor 10](https://imperavi.com/assets/pdf/redactor-documentation-10.pdf) you can check out the docs to see what options are available to customize.
/assets/fieldtypes/redactor.png
name type description
settings
string
The _name_ of the Redactor setting configuration you want to use. If you leave this blank, or specify a name that doesn't exist, Statamic will use the first set of settings in the list.
name type description
container
string
An asset container ID. When specified, the fieldtype will allow the user to add assets from the specified container.
name type description
folder
string
The folder (relative to the asset container) to use when choosing assets. If left blank, the root folder of the container will be used.
name type description
restrict_assets
bool
If set to `true`, navigation within the asset browser dialog will be disabled, and you will be restricted to the container and folder specified.
25d8be49-2300-42ac-90e4-92df42fc2906

Data Structure {#data-structure}

By design Redactor saves HTML code.

quote: |
  <blockquote>I signed up for Second Life about a year ago. Back then, my life was so great that I literally wanted a second one. Absolutely everything was the same... except I could fly.</blockquote><p>– Dwight Schrute</p>  

This is fine, but keep it in mind if you're using it for your content field and are using a markdown file. Statamic automatically parses the content field as Markdown within md files.

Redactor.js Configuration {#configuration}

You are able to set any number of predefined Redactor setting configurations. We give you two out of the box, but of course you are free to modify those and add more.

-
  name: Standard
  settings:
    buttons: [formatting, bold, italic, unorderedlist, orderedlist, html]
-
  name: Basic
  settings:
    buttons: [bold, italic]

Each item has a name, which is what you will see when configuring your fieldtype, and the settings themselves.

You can find these Redactor settings in Configure > Settings > System or within site/settings/system.yaml.

The settings value should be a YAML representation of the options object that will get passed into the Redactor jQuery plugin. You are able to customize all of the Redactor options. You can view the full list of settings in the Redactor documentation.

Any settings and options available to the plugin can be set here. For example, if the docs say to use the following configuration object:

$('textarea').redactor({
  formatting: ['p', 'blockquote', 'h2'],
  minHeight: 300
});

You would translate to YAML like so:

-
  name: My Redactor Settings
  settings:
    formatting:
      - p
      - blockquote
      - h2
    minHeight: 300

Note: Function type options (eg. callbacks) are not supported.

You can’t perform that action at this time.