editor

Docs › Text and paragraphs

Clear and copy formatting

Clear formatting, the format painter, and changing letter case.

Strip formatting from text that came from somewhere else, or copy the look of one spot onto another.

Try it

Code for this demo

createEditor('#editor', {
  toolbar: 'bold color | clearFormat formatPainter caseChange',
});

Clear formatting (clearFormat)

Removes bold, italic, underline, strikethrough, sub/superscript, inline code, text and highlight colors, font and size from the selection. Shortcut Ctrl+\. Links and paragraph formats such as headings, alignment and lists stay; code blocks are left alone. It needs a selection.

Format painter (formatPainter)

  • Put the caret in the text whose look you want and press formatPainter. A short message confirms the copy.
  • Drag over the target text, or select it with Shift+arrow keys: its formatting is cleared and the copied one applied.
  • Copied: bold, italic, underline, strikethrough, sub/superscript, text color, highlight, size and font. Paragraph formats like alignment or line height are not.
  • It applies once. Press the button again or Esc to cancel before applying.

Letter case (caseChange)

Turns the selected text into UPPERCASE, lowercase or Title Case.

Presets

  • board (default): clearFormat at the end of the first row, formatPainter under ⋯ more, no caseChange
  • full: all three under more
  • The selection toolbar has clear formatting too.

Text pasted from Word or HWP is already cleaned on paste. For plain text, paste with Ctrl+Shift+V (Paste cleanup).

API

editor.exec('clearFormat');
editor.exec('caseChange', 'upper'); // upper | lower | title
editor.exec('formatPainter');

Options

NameTypeDefaultDescription
clearFormattoolbar item—Clear formatting from the selection
formatPaintertoolbar item—Copy formatting and paint it once
caseChangetoolbar item—Letter case menu