Paste

paste.clean#

Type: boolean

Default: true

Enables the paste cleanup pipeline (tag allowlist, Word/Docs fixes, attribute stripping). When false, pasted HTML is inserted with minimal changes.

const app = Redactor('#entry', {
  paste: {
    clean: false
  }
});

paste.plaintext#

Type: boolean

Default: false

Pastes only plain text.

const app = Redactor('#entry', {
  paste: {
    plaintext: true
  }
});

paste.autoparse#

Type: boolean

Default: true

Auto-converts URLs in pasted plain text into links and image URLs into <img>.

const app = Redactor('#entry', {
  paste: {
    autoparse: false
  }
});

paste.sanitize#

Type: boolean | object

Default: true

Strips attributes from pasted HTML. true keeps only essential attrs (href, src, etc.). Pass an object to customize allowed attributes, classes, and styles.

const app = Redactor('#entry', {
  paste: {
    sanitize: {
      allowedClasses: ['highlight'],
      allowedStyles: ['color', 'font-weight']
    }
  }
});

paste.images#

Type: boolean

Default: true

Allows images in pasted HTML. When false, <img> tags are removed before insert.

const app = Redactor('#entry', {
  paste: {
    images: false
  }
});

Type: boolean

Default: true

Allows links in pasted HTML. When false, <a> tags are removed before insert.

const app = Redactor('#entry', {
  paste: {
    links: false
  }
});

paste.linkTarget#

Type: false | true | string

Default: false

Sets target on pasted links.

  • false — no target attribute
  • true — all links in pasted HTML get target="_blank"
  • string — that exact value is written to target (e.g. '_blank', '_self')
const app = Redactor('#entry', {
  paste: {
    linkTarget: '_blank'
  }
});

paste.keepNameAttr#

Type: boolean

Default: false

Keeps name attributes when cleaning paste from Word.

const app = Redactor('#entry', {
  paste: {
    keepNameAttr: true
  }
});

paste.keepWordFormatting#

Type: false | string[]

Default: false

When pasting from Word, keeps only these CSS properties in style attributes. false removes Word inline styles.

const app = Redactor('#entry', {
  paste: {
    keepWordFormatting: ['color', 'font-weight', 'text-align']
  }
});

paste.keepEmptyLines#

Type: boolean

Default: false

Keeps empty <p></p> blocks when pasting to the editor.

const app = Redactor('#entry', {
  paste: {
    keepEmptyLines: true
  }
});

paste.formTags#

Type: string[]

Default: ['form', 'input', 'button', 'select', 'textarea', 'legend', 'fieldset']

Tags allowed in pasted HTML.

const app = Redactor('#entry', {
  paste: {
    formTags: ['form',  'button']
  }
});

paste.blockTags#

Type: string[]

Default: block-level tags (p, h1–h6, table, ul, blockquote, etc.)

Block tags allowed on paste.

const app = Redactor('#entry', {
  paste: {
    blockTags: ['p',  'h2']
  }
});

paste.inlineTags#

Type: string[]

Default: inline tags (a, strong, em, code, img, br, etc.)

Inline tags allowed on paste.

const app = Redactor('#entry', {
  paste: {
    inlineTags: ['a', 'strong', 'em', 'mark', 'img', 'br']
  }
});

cleanFrom.googleDocs#

Type: boolean

Default: true

Applies Google Docs paste cleanup when the clipboard HTML is detected as from GDocs.

const app = Redactor('#entry', {
  cleanFrom: {
    googleDocs: false
  }
});

cleanFrom.word#

Type: boolean

Default: true

Applies Microsoft Word paste cleanup when the clipboard HTML is detected as from Word.

const app = Redactor('#entry', {
  cleanFrom: {
    word: false
  }
});

cleanFrom.pages#

Type: boolean

Default: true

Applies Apple Pages paste cleanup when the clipboard HTML is detected as from Pages.

const app = Redactor('#entry', {
  cleanFrom: {
    pages: false
  }
});