Set up tab spaces
tabSpaces is the number of non-breaking spaces inserted when the Tab key is pressed. It defaults to 4. Pass a number — a string such as " " silently disables the behaviour, because the runtime tests tabSpaces > 0 before using it.
tabSpaces: 4
Saved HTML
Loading…
tabSpaces: null— Tab moves focus instead
With no tab-space width configured, Tab is left to the browser and moves focus out of the editing area. That is deliberate: an editor that swallows every Tab is a keyboard trap, and a keyboard user who cannot Tab out cannot reach the rest of your page.
Saved HTML
Loading…
What Tab does first
Tab spaces are the lastthing Tab tries. In order: expand a snippet, indent a list item, move to the next table cell, indent a non-empty selection — and only in a plain paragraph with an empty selection does it insert tab spaces. So Tab inside a list indents the list; it does not type spaces.
// tabSpaces is a NUMBER: how many to insert for one Tab.
var editor = new RichTextEditor("#div_editor1", { tabSpaces: 4 });
// Set it to null (or 0) to hand Tab back to the browser, so it moves
// focus out of the editor instead of typing into it.
var accessible = new RichTextEditor("#div_editor2", { tabSpaces: null });