Clear formatting
Description
clearFormat() strips every wing feature that covers the caret.
| Kind | What happens |
|---|---|
| Inline mark | Stripped. Over the selection if there is one, the whole enclosing mark if only a caret |
| Block attribute | Removed — alignment, drop cap |
| Block type | Demoted to a paragraph — headings |
| List | Unwrapped — one paragraph per item |
| Object block | Left alone — table, image, YouTube, details box, code |
That last row is this wing's boundary — structure is not formatting. Removing a table through "clear formatting" would not be clearing, it would be deleting. Press it inside a table cell and only that cell's character formatting goes; the grid stays. Objects are removed through each wing's own command or Backspace.
- It owns no tag and no attribute. It is the one kind of wing that takes no part in filtering, so registering it does not change the shape of your value at all — you just get one more button.
- What counts as formatting is asked of the schema. No list is baked in, so newly registered wings are cleared along with the rest automatically.
- It is not a toggle; it only ever runs one way (there is no "on" state). If there is nothing to clear it creates no undo point, and when it does clear, a single undo brings everything back.
- It appears in the toolbar only where marks are usable (paragraphs, headings, list items, table cells).
Demo
Wings
HTMLLoading the editor…
PreviewThe value above, drawn the way a reader sees it (nabiViewer). Click a table header to sort.
Install
npm install nabi-noteCode
import { nabi } from 'nabi-note'
import 'nabi-note/style.css'
nabi.create('#editor', {
wings: [],
locale: 'en',
onChange: (html) => save(html),
})