15

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: /craft/config/redactor/Standard.json You will see something like this: { "buttons": [ "html", "formatting", "bold", "italic", ... You will ...


13

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 have a button which adds custom CSS-classes, take a look at: Redactor CSS by Nathan Doyle Update (July 2015) Craft 2.3.2615 (Dec 2, 2014) and above use ...


12

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 place this in, go to your field’s settings in Settings → Fields → [your Rich Text field name], and check your “Redactor Config” setting.


11

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 attributes for those <a> tags to entries, and finally, you'll need to set classnames to the <a> tags (depending on the matched entry's Entry Type) and ...


11

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 sources using the Rich Text field on the front-end of your site. Presumably all users using the control panel are trusted enough not to input malicious code into ...


11

Add the linkNewTab config option to the Redactor config you're using: So, that would become something like: { "buttons": [...], "plugins": [...], "linkNewTab": true }


10

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 id="jobOverview" name="fields[jobOverview]"></textarea> {% includeJs "$('#jobOverview').redactor();" %} ... But it’s not recommended. Redactor’s API ...


10

No need for a plugin. Just add: "imageResizable": true, "imagePosition": true, to your chosen redactor config file i.e. (/craft/config/redactor/standard.json)


9

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', 'bold', 'italic', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'link', 'alignment', 'horizontalrule'], formatting: ['p'...


9

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 via a plugin, but it'd probably be a bit of work. Does anyone know the Redactor setting to set the default size of the editor? The setting your looking for is ...


9

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": ["format","bold","lists","link","file","image"], "plugins":["source","fullscreen"], "toolbarFixed": true, "formatting": ["p", "blockquote", "h2", "...


9

Sure, from the Redactor "Insert Image" modal:


9

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"], }, "align-right": { "title": "Align right", "args": ["p","class","align-right"], }, "align-center": { "title": "Align center", "args": ["...


9

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"], Or any combination of elements you want to be made available. For those reading this who can't see the Formatting option for their Redactor field, it's also ...


9

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'; } EDIT slightly more troubling is that you are getting Trebuchet in the first place, it should be Arial anyway. UPDATE it turns out this change came about in a ...


8

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 directory create a folder videoembeds. Create the main plugin file WrapEmbedsPlugin.php: <?php namespace Craft; class WrapEmbedsPlugin extends BasePlugin { ...


8

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 elements with custom classes/styles, Nathan's plugin only supports block elements, I created a plugin that wraps the Styles Redactor plugin. You can get it here: ...


8

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: { "buttons": ["format", "bold", "italic", "lists", "image"], "plugins":["fullscreen", "source"], "toolbarFixed": true }


8

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 your own names for the options. { "buttons": ["format","bold","italic","link"], "formatting": null, "formattingAdd": { "h3": { title: 'Heading', ...


8

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 hr tag to your contents.


7

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-paragraphize Standard.json { buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video', 'table'], plugins: ['...


7

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 attributes on save. When aligning text in Redactor, inline styling is added, which would be stripped away on save if the Clean up HTML option is checked. You'll just ...


7

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 with a new version of Redactor. With the release of Redactor 10 non-essential functionality was removed from Redactor's core and is now released as separate ...


7

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 other extras as well.


7

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 the Redactor config files to add an element with the classname .note. To do that, add the following to the file config/redactor/Standard.json (or if you ...


6

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” toolbar button. Now you can get the first "page" in your template: {% for entry in craft.entries.section('blog') %} <article> <h1><...


6

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’s image selection modal. Saving the entry and coming back to it (or just typing Command + S) will also make the image draggable, regardless of how you added ...


6

You can override the control panel's CSS with a plugin. Use the popular "Control Panel CSS plugin" by Lindsey DiLoreto or make your own little one. Make use of the includeCssResource() function and include a CSS file with your custom redactor styles: myRedactorCssPlugin.php: public function init() { if (craft()->request->isCpRequest()) { ...


6

You can use the striptags filter to remove all HTML tags from your string. With the trim filter you can strip all whitespace from the beginning and the end of it: {% if entry.poorText|striptags|trim %} {{ entry.poorText }} {% else %} Here could be a nicely formatted text! {% endif %}


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