angular-editor
angular-editor copied to clipboard
Tab keypress does not indent content or bulleted lists
Can we have the capability to add indentation when you press the tab on the keyboard for paragraphs and bullets?
Good news! Tab key functionality can be added using custom event handling.
Solution:
@ViewChild('editor') editor: AngularEditorComponent;
ngAfterViewInit() {
const textarea = this.editor.textArea.nativeElement;
textarea.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.key === 'Tab') {
e.preventDefault();
if (e.shiftKey) {
document.execCommand('outdent');
} else {
document.execCommand('indent');
}
}
});
}
This enables:
- Tab → indent
- Shift+Tab → outdent
Works for both paragraphs and lists!
Note: Built-in Tab support is planned for v3.2+ with keyboard shortcuts feature (#552).
If you have additional questions, feel free to open a new issue!