15
votes
Accepted
How can I link to an Asset from the Rich Text editor?
This isn't really related to Craft specifically, but to allow a user to link to an asset, you will need to enable the feature in the redactor configuration file.
For example, within this file:
/...
13
votes
Accepted
How do I add custom styles/plugins to the rich text editor in Craft?
If by styles you mean the formatting drop-down, just add them in an array:
{
buttons: ['bold', 'italic'],
formatting: ['p', 'blockquote', 'h2', 'h3', 'h4', 'SomeHtmlTag']
}
.
If you want to ...
12
votes
Accepted
Redactor table plugin for craft
Craft ships with Redactor’s Table plugin, but you must add it to your Redactor config yourself (in craft/config/redactor/).
{
// ...
plugins: ['table']
}
To determine which config file to ...
12
votes
Image alignment and size in Redactor 2
No need for a plugin.
Just add:
"imageResizable": true,
"imagePosition": true,
to your chosen redactor config file i.e. (/craft/config/redactor/standard.json)
12
votes
Accepted
Craft 3 Redactor Link no longer has target option
Add the linkNewTab config option to the Redactor config you're using:
So, that would become something like:
{
"buttons": [...],
"plugins": [...],
"linkNewTab": true
}
11
votes
How do I enable redactor rich text editor in a front-end form?
It’s technically possible to include Craft’s copy of Redactor on the front end:
{% includeJsResource "lib/redactor/redactor.js" %}
{% includeCssResource "lib/redactor/redactor.css" %}
<textarea ...
11
votes
Accepted
Treat links in redactor/rich text field differently depending on entry type
This is a high-level question, with multiple problems to solve. First, you'll need to parse the HTML from the Rich Text field for <a> tags. Then, you'll need to find a way to match the href ...
11
votes
Accepted
Redactor video plugin not working
You've probably got "Purify HTML" checked under your Rich Text field's settings and that's stripping iframe code.
You should really only have that checked if you're accepting input from untrusted ...
9
votes
Accepted
Is Redactor's default config saved as a .json file anywhere?
As @Brandon said, the defaults are hardcoded in redactor.js so there isn't a default.json file, but if there was, this is what it would be (from Craft 2.3.2615):
{
buttons: ['html', 'formatting', ...
9
votes
Accepted
Is there a way to limit the Asset upload directory in Redactor?
Is there a way to limit the Asset upload directory in Redactor?
No. You'll want to use a Matrix Field with an image block.
That said, it's possible you could create a Redactor button that does this ...
9
votes
How do I add custom styles/plugins to the rich text editor in Craft?
It's worth noting that as of Craft 2.5, it's now using Redactor II, so the above code examples don't work if you have upgraded. Here's a working JSON config example you can build on:
{
"buttons": ...
9
votes
Accepted
apply transform to image uploaded into Redactor?
Sure, from the Redactor "Insert Image" modal:
9
votes
Redactor 2 - Can a text alignment button be added?
You can use the formattingAdd config setting to add custom formatting to the "Format" dropdown.
formattingAdd: {
"align-left": {
"title": "Align left",
"args": ["p","class","align-left"],
...
9
votes
Can I change which 'Format' options are available in my Rich Text field?
You certainly can using the Redactor Formatting config.
Locate the config file for the Redactor setting you want to edit in craft/config/redactor and add this line:
"formatting": ["h1", "h2", "h3"],
...
9
votes
Accepted
Change font of Redactor II
You could use the Control Panel CSS plugin that lets you add arbitrary css to the control panel.
Then you could target all redactor fields like so:
.redactor-layer * {
font-family: 'Arial';
}
...
9
votes
Accepted
Does Redactor have a button that adds a horizontal rule (<hr> tag)?
Yes. Edit config/redactor/standard.json file (or the relevant file in your Craft project) and add "line" in the buttons items list.
You should see the "Line" button in the toolbar which will add a ...
8
votes
Accepted
Wrap embeds with HTML in rich text field
I suggest a Twig filter so you can do something like this in the template:
{{ entry.body | wrapembeds }}
This is something to love about Craft - the ease of building Twig filters.
In the plugins ...
8
votes
How do I add custom styles/plugins to the rich text editor in Craft?
Victor answers my questions regarding the formatting tags and the fact that you need to create a Craft plugin to add Redactor plugins.
Since there wasn't a solution for adding classes on inline ...
8
votes
HTML/View Source button not working/showing in WYSIWYG Craft 2.5 / Redactor II 1.1.0
It turns out that the latest redactor seems to now have a plugin for viewing the source. You can enable this in your redactor JSON config file under plugins. Just add the "source" plugin like so:
{
...
8
votes
Can I change which 'Format' options are available in my Rich Text field?
What I like to do is to override the default options of the Format dropdown by setting "formatting" to null and adding my own list of options using "formattingAdd".
This allows you to come up with ...
7
votes
Accepted
Rich text editor Redactor adding additional paragraph p tags
http://imperavi.com/redactor/docs/settings/clean/#setting-replaceDivs
http://imperavi.com/redactor/docs/settings/clean/#setting-removeEmpty http://imperavi.com/redactor/docs/settings/clean/#setting-...
7
votes
Accepted
On entry save/update, centered text returns to left in rich text field
When you create a Rich Text field, there is an option for Clean up HTML which is checked by default. The description underneath the setting reads:
Removes spans, empty tags, and most style ...
7
votes
Accepted
Table button missing in Rich Text fields?
Update: since version 2.3.2621 Craft comes with Redactor's table plugin preinstalled again. So there's no need to do anything special, simply add it to your Redactor json config.
Craft 2.3 now comes ...
7
votes
Where do I add custom css for the Redactor editor in the Craft control panel?
I ended up using the Control Panel CSS plugin by Lindsey D to do this. Installed the plugin and then pointed it to an external style sheet with my redactor styles.
Here's the plugin:
https://github....
7
votes
HTML/View Source button not working/showing in WYSIWYG Craft 2.5 / Redactor II 1.1.0
You need to add "html" in the buttons array, and not "source" in the plugins array.
7
votes
Redactor 2 - Can a text alignment button be added?
Either existing answer could work.
Another option is a plugin I've recently built. Redactor Extras: https://github.com/elliotlewis/Redactor-Extras
Uses the Plugin from Redactors site for align. Has ...
7
votes
Accepted
How do I add class to redactor format list?
Your example code attempts to create a new Redactor instance, which (as Brad says) won't work inside the control panel (where Craft has created the Redactor instances already).
You can, however, use ...
6
votes
Accepted
"Excerpt" option in Redactor?
You could use the Redactor's pagebreak plugin. Check out the docs.
If activated in your Redactor config, you will have the option to insert page breaks to your content, via a new “Insert Page Break” ...
6
votes
Accepted
Dragging images inside of rich text editor
Just looked into this and it’s a Craft bug. If you add an image manually using the “Insert URL” option, the image can be dragged around, but not if you use the “Choose image” option, which opens Craft’...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
redactor × 265richtext × 67
craft3 × 31
image × 15
wysiwyg × 15
templating × 13
plugins × 13
plugin-redactorstyles × 10
plugin-development × 9
entries × 9
editor × 9
assets × 8
json × 6
control-panel × 5
config × 4
image-transforms × 4
plugin-feedme × 4
css × 4
table × 4
field × 3
upload × 3
link × 3
ckeditor5 × 3
search × 2
entry × 2