A Tiptap extension for managing text indentation in documents
npm install @docs.plus/extension-indentA professional Tiptap extension for text indentation management with customizable options.
- Indent/outdent at cursor position or for text selections
- Configurable indentation characters and behavior
- Node-type filtering for targeted indentation
- Tab and Shift+Tab keyboard shortcuts (configurable)
- Typescript support with full type definitions
``bash`
npm install @docs.plus/extension-indent
`js
import { Editor } from '@tiptap/core'
import { Indent } from '@docs.plus/extension-indent'
new Editor({
extensions: [
// ...other extensions
Indent,
],
})
`
`js
Indent.configure({
// Character(s) for each indentation (default: ' ' - 2 spaces)
indentChars: ' ', // 4 spaces
// Enable/disable the extension (default: true)
enabled: true,
// Control which node types can be indented (default: paragraph, listItem, orderedList)
// Empty array allows all nodes to be indented
allowedNodeTypes: ['paragraph', 'listItem', 'orderedList'],
})
`
`js
// Use tabs instead of spaces
Indent.configure({
indentChars: '\t'
})
// Allow indentation only for paragraphs
Indent.configure({
allowedNodeTypes: ['paragraph']
})
`
`js
// Add indentation
editor.commands.indent()
// Remove indentation
editor.commands.outdent()
`
Default keyboard bindings:
- Tab - IndentShift+Tab
- - Outdent
`bashInstall dependencies
npm install
MIT