pastePlainText

Type: Boolean

Default: false

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.

$R('#content', {
        pastePlainText: true
});

pasteLinkTarget

Type: Boolean String

Default: false

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

$R('#content', {
        pasteLinkTarget: '_blank'
});

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

pasteImages

Type: Boolean

Default: true

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

$R('#content', {
        pasteImages: false
});

pasteLinks

Type: Boolean

Default: true

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.

$R('#content', {
        pasteLinks: false
});

pasteClean

Type: Boolean

Default: true

This setting allows you to turn off all the cleaning rules for pasted content.

$R('#content', {
        pasteClean: false
});

pasteKeepStyle

Type: Array

Default: []

This setting allows you to set an array of tags for which the style attribute will not be deleted on pasting.

$R('#content', {
        pasteKeepStyle: ['p', 'td']
});

pasteKeepClass

Type: Array

Default: []

This setting allows you to set an array of tags for which the class attribute will not be deleted on pasting.

$R('#content', {
        pasteKeepClass: ['p', 'td']
});

pasteKeepAttrs

Type: Array

Default: ['td', 'th']

This setting allows you to set an array of tags for which attributes (excluding class and style) will not be deleted on pasting.

$R('#content', {
        pasteKeepAttrs: ['td', 'th', 'p']
});

pasteBlockTags

Type: Array

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

Whenever you need to control which block tags your users can paste, use this setting. Tweak this default list to better fit your needs, but keep in mind, you can only remove block tags from the list, not add them.

$R('#content', {
    pasteBlockTags: ['blockquote', 'p']
});

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

$R('#content', {
    pasteBlockTags: []
});

pasteInlineTags

Type: Array

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

Whenever you need to control which inline tags your users can paste, use this setting. Tweak this default list to better fit your needs, but keep in mind, you can only remove inline tags from the list, not add them.

$R('#content', {
    pasteInlineTags: ['a', 'br', 'strong', 'ins', 'code', 'del']
});

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

$R('#content', {
    pasteInlineTags: []
});