Nonbreaking Space plugin

This plugin adds a button for inserting nonbreaking space entities   at the current caret location (cursor insert point). It also adds a menu item Nonbreaking space under the Insert menu dropdown and a toolbar button.

Basic setup

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'nonbreaking',
  toolbar: 'nonbreaking'
});

Options

nonbreaking_force_tab

This option allows you to force TinyMCE to insert a specified number of   entities when the user presses the keyboard tab key.

When set to true, it will insert three   entities. When set to a number, it will insert that many   entities.

It’s important to note that this does not change the behavior of the menu and toolbar controls, which will continue to insert a single &nbsp entity when nonbreaking_force_tab value is true.

However, the true condition does capture the tab key and contain it within the editable area, whereas when set to its default state of false a tab keypress will move the cursor to the next editable area (e.g. a browser url bar or form field on the current page).

Usage with table or lists plugin

The nonbreaking_force_tab setting can break the following functionality:

  • The table plugin uses the Tab key for navigating between table cells.

  • The lists plugin uses the Tab key for item indentation.

Type: Boolean or Number

Default value: false

Possible values: true, false, or any positive number

Example: using nonbreaking_force_tab

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'nonbreaking',
  toolbar: 'nonbreaking',
  nonbreaking_force_tab: true
});

nonbreaking_wrap

This option allows you to force TinyMCE to wrap non-breaking space characters inserted by the plugin in a <span class="mce-nbsp-wrap"></span> element. This will prevent the non-breaking space being replaced by the editor or browser when typing additional spaces.

Type: Boolean

Default value: true

Possible values: true, false

Example: using nonbreaking_wrap

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'nonbreaking',
  toolbar: 'nonbreaking',
  nonbreaking_wrap: false
});

Toolbar buttons

The Nonbreaking Space plugin provides the following toolbar buttons:

Toolbar button identifier Description

nonbreaking

Inserts a nonbreaking space into the editor.

These toolbar buttons can be added to the editor using:

The Nonbreaking Space plugin provides the following menu items:

Menu item identifier Default Menu Location Description

nonbreaking

Insert

Inserts a nonbreaking space into the editor.

These menu items can be added to the editor using:

Commands

The Nonbreaking Space plugin provides the following TinyMCE command.

Command Description

mceNonBreaking

Inserts a non breaking space at the cursor location or overwrites the current selection.

Example
tinymce.activeEditor.execCommand('mceNonBreaking');