improve textAlign behavior within lists, see #72

This commit is contained in:
Philipp Kühn 2021-01-06 13:33:11 +01:00
parent 5e29cc1481
commit 43dc14b9fc

View File

@ -59,10 +59,14 @@ export const TextAlign = Extension.create({
return {
// TODO: re-use only 'textAlign' attribute
// TODO: use custom splitBlock only for `this.options.types`
// TODO: use complete default enter handler (chainCommand) with custom splitBlock
Enter: () => this.editor.commands.splitBlock({
withAttributes: true,
}),
Enter: () => this.editor.commands.first(({ commands }) => [
() => commands.newlineInCode(),
() => commands.createParagraphNear(),
() => commands.liftEmptyBlock(),
() => commands.splitBlock({
withAttributes: true,
}),
]),
'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'),
'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'),
'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),