Merge 51325e2f4a91f08519510e199673ba8c4bc045e9 into f18ecfa524211365c36c67e90a50fbc61afe23c5

This commit is contained in:
Jon Fuller 2026-01-30 21:47:16 +02:00 committed by GitHub
commit a7510cee9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,21 +8,33 @@ export default class IndentBlockShortcutPlugin extends Plugin {
init() { init() {
this.editor.keystrokes.set( 'Tab', ( _, cancel ) => { this.editor.keystrokes.set( 'Tab', ( _, cancel ) => {
const command = this.editor.commands.get( 'indentBlock' ); // In tables, allow default Tab behavior for cell navigation
if (this.isInTable()) {
if (command && command.isEnabled && !this.isInTable() ) { return;
command.execute();
cancel();
} }
const command = this.editor.commands.get( 'indentBlock' );
if (command?.isEnabled) {
command.execute();
}
// Always cancel in non-table contexts to prevent widget navigation
cancel();
} ); } );
this.editor.keystrokes.set( 'Shift+Tab', ( _, cancel ) => { this.editor.keystrokes.set( 'Shift+Tab', ( _, cancel ) => {
const command = this.editor.commands.get( 'outdentBlock' ); // In tables, allow default Shift+Tab behavior for cell navigation
if (this.isInTable()) {
if (command && command.isEnabled && !this.isInTable() ) { return;
command.execute();
cancel();
} }
const command = this.editor.commands.get( 'outdentBlock' );
if (command?.isEnabled) {
command.execute();
}
// Always cancel in non-table contexts to prevent widget navigation
cancel();
} ); } );
} }