editor

Docs › Text and paragraphs

Alignment and indent

Left, center, right and justify, the align menu, indent and outdent.

Center or right-align paragraphs and add or remove space in front of them. Alignment applies to whole paragraphs, not to words.

Try it

Code for this demo

createEditor('#editor', {
  toolbar: 'alignMenu | alignLeft alignCenter alignRight alignJustify | indent outdent',
});

Alignment

Toolbar nameActionShortcut
alignLeftAlign left (removes alignment)Ctrl+Shift+L
alignCenterCenterCtrl+Shift+E
alignRightAlign rightCtrl+Shift+R
alignJustifyJustifyCtrl+Shift+J
alignMenuAll four in one menu button—
alignCenterToggleOne button that switches center and left—

With an image selected, left, center and right align the image instead of the paragraph (Images).

Indent and outdent

  • indent / outdent, shortcuts Ctrl+] / Ctrl+[
  • Normal paragraphs get 40px more or less left margin per step.
  • In a list, the item moves into or out of a nested list. Tab / Shift+Tab do the same in lists.
  • Table cells are not indented.

Presets and phones

  • board (default) and basic: alignMenu on the first row; in board, indent and outdent are under ⋯ more
  • full: four align buttons plus indent and outdent on the first row
  • The phone toolbar shows a single alignCenterToggle button to save room.

Saved HTML

<p style="text-align: center">Centered</p>
<p style="text-align: right">Right</p>
<p style="margin-left: 40px">Indented</p>

API

editor.exec('alignCenter');
editor.exec('align', 'justify'); // what the menu runs: left | center | right | justify
editor.exec('indent');

Options

NameTypeDefaultDescription
alignLeft alignCenter alignRight alignJustifytoolbar item—Align buttons
alignMenutoolbar item—Align menu (one button)
alignCenterToggletoolbar item—Toggle centering
indent outdenttoolbar item—Indent, outdent