Link

Settings for inline links and image links. The link button opens a create or edit form depending on the current selection.

link.create#

Type: false | function

Default: false

Controls the UI when inserting a new link.

const app = Redactor('#entry', {
  link: {
    create(app, { text }) {
      const url = prompt('URL');
      if (url) app.link.create({ url, text, target: false });
    }
  }
});

link.edit#

Type: false | function

Default: false

Controls the UI when editing a link.

const app = Redactor('#entry', {
  link: {
    edit(app, anchor, data) {
      const url = prompt('URL', data.url);
      if (url) app.link.save({ ...data, url });
    }
  }
});

link.truncate#

Type: number

Default: 24

How long URLs can be before they are shortened with ... in the UI — context bar “visit” label and autoparsed links in pasted text. Does not change the real href.

const app = Redactor('#entry', {
  link: {
    truncate: 40
  }
});

link.newTab#

Type: boolean

Default: false

When true, the “open in new tab” checkbox is checked by default in the create form.

const app = Redactor('#entry', {
  link: {
    newTab: true
  }
});

link.nofollow#

Type: boolean

Default: false

When true, every <a> in exported HTML gets rel="nofollow". Does not affect links while editing — only on output.

const app = Redactor('#entry', {
  link: {
    nofollow: true
  }
});