feat: implement textAlign property (#11790)

for paragraph blocks, image blocks, list blocks, and table blocks

Should fix #8617 and #11254.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added text alignment options (left, center, right) for paragraph,
list, image, note, and table blocks.
- Introduced alignment controls in toolbars and slash menus for easier
formatting.
- Enabled keyboard shortcuts for quick text alignment changes (supports
Mac and Windows).
- **Localization**
- Added English, Simplified Chinese, and Traditional Chinese
translations for new alignment commands and shortcuts.
- **Style**
  - Blocks now visually reflect selected text alignment in their layout.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: L-Sun <zover.v@gmail.com>
This commit is contained in:
Xun Sun
2025-09-26 15:23:28 +08:00
committed by GitHub
parent bf87178c26
commit 5b52349b96
23 changed files with 353 additions and 37 deletions

View File

@@ -38,6 +38,9 @@ type KeyboardShortcutsI18NKeys =
| 'bodyText'
| 'increaseIndent'
| 'reduceIndent'
| 'alignLeft'
| 'alignCenter'
| 'alignRight'
| 'groupDatabase'
| 'moveUp'
| 'moveDown'
@@ -185,6 +188,9 @@ export const useMacPageKeyboardShortcuts = (): ShortcutMap => {
[tH('6')]: ['⌘', '⌥', '6'],
[t('increaseIndent')]: ['Tab'],
[t('reduceIndent')]: ['⇧', 'Tab'],
[t('alignLeft')]: ['⌘', '⇧', 'L'],
[t('alignCenter')]: ['⌘', '⇧', 'E'],
[t('alignRight')]: ['⌘', '⇧', 'R'],
[t('groupDatabase')]: ['⌘', 'G'],
[t('switch')]: ['⌥', 'S'],
// not implement yet
@@ -242,6 +248,9 @@ export const useWinPageKeyboardShortcuts = (): ShortcutMap => {
[tH('6')]: ['Ctrl', 'Shift', '6'],
[t('increaseIndent')]: ['Tab'],
[t('reduceIndent')]: ['Shift+Tab'],
[t('alignLeft')]: ['Ctrl', 'Shift', 'L'],
[t('alignCenter')]: ['Ctrl', 'Shift', 'E'],
[t('alignRight')]: ['Ctrl', 'Shift', 'R'],
[t('groupDatabase')]: ['Ctrl + G'],
['Switch']: ['Alt + S'],
// not implement yet