Skip to main content
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)
Rattikarl's user avatar
  • 393
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 }
Paul's user avatar
  • 6,338
10 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"], ...
Jamie Wade's user avatar
  • 3,644
10 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 ...
Alban Jubert's user avatar
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'; } ...
Josh Angell's user avatar
  • 2,311
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 ...
carlcs's user avatar
  • 36.3k
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.
Andrew Terry Loveday's user avatar
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 ...
Mats Mikkel Rummelhoff's user avatar
6 votes

Redactor splitting nested <a> tags

The template engine (Twig) doesn't do anything like that – my guess is that the links only appear to render like your second example, because you're looking at the markup in your browser's dev tools, ...
Mats Mikkel Rummelhoff's user avatar
6 votes

Is it possible to make links open in a new tab by default?

Merits of doing this aside, I agree that JS is probably the easiest way to go here. This code adds target="_blank" to all external links. // Make sure any offsite links (non js/mailtos) open in a ...
Jeremy Daalder's user avatar
5 votes

Stop Redactor adding paragraph tags

According to docs, you need a breakline: true line in your config like this: { "buttons": [ "bold", "italic", "underline", "link", "html" ], "...
abdusco's user avatar
  • 151
5 votes
Accepted

Bold first word in title field

You can grab the first word with the split filter according to this thread {% set array = entry.title|split(' ', 2) %} <h1 class="section__heading"> <strong>{{ attribute(array, 0) }}&...
KSPR's user avatar
  • 3,786
5 votes

Redactor splitting nested <a> tags

Redactor is, very sensibly, correcting your invalid html. You can't have links inside links, the spec does not allow it: https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element Even if ...
Seth Warburton's user avatar
5 votes
Accepted

If YouTube in Redactor Then Wrap in Div

Check out the Retcon plugin! Retcon is a small Craft CMS plugin offering a series of easy-to-use Twig filters for manipulating HTML content. Specifically, it sounds like you need the wrap method: ...
Lindsey D's user avatar
  • 24k
5 votes
Accepted

Removing P tag's in rich text area's

Seems like a simple striptags filter would do nicely in this case: <h1>{{ entry.titleField|striptags('<strong><em><br>')|raw }}</h1> If you're having issues with ...
Mats Mikkel Rummelhoff's user avatar
5 votes
Accepted

Redactor Images Button Missing

not sure if it matters but in my config I have buttons in quotes "buttons": ["format","bold","italic","underline","lists","link","file","image","horizontalrule"],
Phil's user avatar
  • 250
5 votes
Accepted

Redactor II image resizing?

Quoting Brad Bell in a recent thread: If you're on Craft 2.6.2950 or greater, it includes Redactor II 1.3.1, where they re-introduced image resizing and positioning support. You'll just need ...
Nutmeg's user avatar
  • 598
4 votes
Accepted

YouTube video embeds in rich text field not saving

My guess is you're running into one of two issues. You're bumping into your php.ini file's max_intput_vars and/or post_max_size limitations. Your server has something like Suhosin or mod_security ...
Brad Bell's user avatar
  • 67.5k
4 votes

How do I enable redactor rich text editor in a front-end form?

For Craft 3 you can use: {%- do view.registerJsFile(view.getAssetManager().getPublishedUrl('@vendor/craftcms/redactor/lib/redactor/redactor.js')) -%} {%- do view.registerCssFile(view.getAssetManager()...
77120's user avatar
  • 141
4 votes

Rich-Text/Redactor hyperlink classes

For Craft 3 using Redactor 3, I have managed to create a small redactor plugin that toggles a class on all the links selected in redactor. Here is how I did it. Create your folders. Create a folder ...
Martin Stigzelius's user avatar
4 votes
Accepted

How can I dynamically remove some unwanted formatting tags inside rich text fields?

Not a "real" answer because it won't fix your actual content, but I wrote a plugin that would make it easy to remedy your issue on the front end (i.e. in the template) – To remove all <h1> and &...
Mats Mikkel Rummelhoff's user avatar
4 votes

Redactor image caption not saved and formatting lost

I copied your Redactor settings to a clean installation of Craft (2.6.2945) and added an image to a Rich Text field set to use those specific settings. Initially I encountered the same behaviour. ...
Stephen Hamilton's user avatar
4 votes

Redactor II image resizing?

You can use this superb plugin: RetconHTML Ever have a client put 4 MB PNG files in their Redactor fields, failing to apply any of your meticulously crafted image transforms? Writers consistently ...
Johannes Lamers's user avatar
4 votes
Accepted

How can I change the rich-text editor to remove the "Heading 1" option

formattingTags is not the correct syntax. You should be using formatting instead, as per my answer on this question.
Jamie Wade's user avatar
  • 3,644
4 votes
Accepted

Adding a cite tag within the blockquote tag using redactor's WYSIWYG?

You can use the Redactor Inline Styles add-on then use the following in your Redactor json config: "plugins": ["source","fullscreen","inlinestyles"], "buttonsAddAfter": "italic", "buttonsAdd":...
Cole Henley's user avatar
  • 1,741
4 votes
Accepted

How to remove empty tags in rich text? (Redactor or Twig)

I ended up using this solution: Filter empty tags in Craft/Twig template {{ entry.houseDescription|replace('/<[^\\/>][^>]*><\\/[^>]+>/', '')|raw }} The replace filter /<[^\\/...
Mario's user avatar
  • 255
4 votes
Accepted

Ugly Redactor II and how to fix it with some CSS

Here is my eye-friendly code: /* Redactor|Fonts */ [class^="redactor-"], [id^="redactor-"] { font-family: inherit !important; } /* Redactor|Toolbar */ ul.redactor-toolbar a { padding: 12px ...
Christian Steger's user avatar
4 votes
Accepted

Text Align Buttons for Rich Text Fields

Per their configuration docs, which also link to Craft's docs on the subject, it looks like you'd just need to add "alignment" to the plugins portion of one of your craft/config/redactor/ JSON config ...
Brad Bell's user avatar
  • 67.5k
4 votes

Is there a better way to make tables in Craft?

I'd use a Table or SuperTable field But if you want to stick to a Redactor Rich Text field, put a wrapper <div> around the {{ entry.redactorField }} Twig markup, and use CSS to style the table ...
andrew.welch's user avatar
  • 11.6k
4 votes

Redactor 3 config code

After several iterations I came up with this that works. But still puzzled as when to use [ ] or { }. { "buttons": ["html","undo","format","bold","lists","link","file"], "plugins": ["...
Paul Frost's user avatar
  • 1,060

Only top scored, non community-wiki answers of a minimum length are eligible