Context

context#

Type: false | object

Default: { object }

Pass false to disable the context bar entirely.

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

context.animationDuration#

Type: number

Default: 100

Show/hide animation duration in milliseconds (CSS transition on the context wrapper).

const app = Redactor('#entry', {
  context: {
    animationDuration: 200
  }
});

context.click#

Type: boolean

Default: false

When true, shows the context bar when a block receives focus (in addition to selection-based display).

const app = Redactor('#entry', {
  context: {
    click: true
  }
});

Type: boolean

Default: false

When true, shows the context bar for a collapsed caret inside a link (<a>). Without this, only non-collapsed text selections open the bar.

const app = Redactor('#entry', {
  context: {
    clickLink: true
  }
});

context.exclude#

Type: object

Default: {}

Hides the context bar when the selection touches matching content.

Key Type Description
tags string[] HTML tag names (lowercase), e.g. ['pre', 'code'].
blocks string[] Block types, e.g. ['image', 'embed'].

If any selected block matches, the bar is not shown.

const app = Redactor('#entry', {
  context: {
    exclude: {
      tags: ['pre'],
      blocks: ['image', 'embed']
    }
  }
});

context.include#

Type: object

Default: {}

Whitelist mode. When tags or blocks arrays are non-empty, the bar is shown only if the selection matches at least one entry.

Same shape as context.exclude (tags, blocks).

const app = Redactor('#entry', {
  context: {
    include: {
      blocks: ['text', 'quote']
    }
  }
});