Redactor / Documentation / Settings

Paste

pasteLinkTarget #

This setting is set to false by default.

In order to apply a target to all pasted links, just set a target:

$('#content').redactor({
    pasteLinkTarget: '_blank'
});

With this set, every link pasted into Redactor will also get target="_blank" attribute.

pastePlainText #

Sometimes you just need to restrict content that can be pasted into Redactor. When turned on, this setting will remove all tags and formatting from pasted text, excluding links and images.

Set to false by default.

pasteImages #

Whenever you need to exclude images from the content that users can paste, this setting is here for you, just set it to false.

Set to true by default.

If you need to restrict the content that users can paste into Redactor, but only need to exclude links, set this to false, and all links will be pasted as plain text.

Set to true by default.

pasteBlockTags #

The new Redactor II gives you unprecedented level of control over what you allow users to paste in editor's window. By default, only allows links, images and the following list of block tags to be pasted into Redactor (along with these inline tags)

['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'table', 'tbody', 'thead', 'tfoot', 'th', 'tr', 'td', 'ul', 'ol', 'li', 'blockquote', 'pre']

Remove one or more tags that you don't want to see pasted into the resulting code, or remove all tags to restrict all block tags from being pasted:

$('#content').redactor({
    pasteBlockTags: []
});

pasteInlineTags #

Whenever you need to control which inline tags your users can paste, use this setting. By default, the following is allowed to be pasted:

['strong', 'b', 'u', 'em', 'i', 'code', 'del', 'span', ins', 'samp', 'kbd', 'sup', 'sub', 'mark', 'var', 'cite', 'small']

Tweak this list to better fit your needs, but keep in mind, you can only remove inline tags from the list, not add them. For example, adding 'span' or 'font' to the list will not allow pasting spans or fonts and will be ignored by Redactor.

If you'd like to completely restrict any inline tags from being pasted, just use this setting with an empty array of tags.

$('#content').redactor({
    pasteInlineTags: []
});