mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 23:07:02 +08:00
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:
@@ -92,13 +92,6 @@ test('should format quick bar show when clicking drag handle', async ({
|
||||
|
||||
const { formatBar } = getFormatBar(page);
|
||||
await expect(formatBar).toBeVisible();
|
||||
|
||||
const box = await formatBar.boundingBox();
|
||||
if (!box) {
|
||||
throw new Error("formatBar doesn't exist");
|
||||
}
|
||||
assertAlmostEqual(box.x, 251, 5);
|
||||
assertAlmostEqual(box.y - dragHandleRect.y, -55.5, 5);
|
||||
});
|
||||
|
||||
test('should format quick bar show when select text by keyboard', async ({
|
||||
@@ -548,17 +541,6 @@ test('should format quick bar work in single block selection', async ({
|
||||
const { formatBar } = getFormatBar(page);
|
||||
await expect(formatBar).toBeVisible();
|
||||
|
||||
const formatRect = await formatBar.boundingBox();
|
||||
const selectionRect = await blockSelections.boundingBox();
|
||||
if (!formatRect) {
|
||||
throw new Error('formatRect is not found');
|
||||
}
|
||||
if (!selectionRect) {
|
||||
throw new Error('selectionRect is not found');
|
||||
}
|
||||
assertAlmostEqual(formatRect.x - selectionRect.x, 147.5, 10);
|
||||
assertAlmostEqual(formatRect.y - selectionRect.y, -48, 10);
|
||||
|
||||
const boldBtn = formatBar.getByTestId('bold');
|
||||
await boldBtn.click();
|
||||
const italicBtn = formatBar.getByTestId('italic');
|
||||
@@ -603,17 +585,6 @@ test('should format quick bar work in multiple block selection', async ({
|
||||
const formatBarController = getFormatBar(page);
|
||||
await expect(formatBarController.formatBar).toBeVisible();
|
||||
|
||||
const box = await formatBarController.formatBar.boundingBox();
|
||||
if (!box) {
|
||||
throw new Error("formatBar doesn't exist");
|
||||
}
|
||||
const rect = await blockSelections.first().boundingBox();
|
||||
if (!rect) {
|
||||
throw new Error('rect is not found');
|
||||
}
|
||||
assertAlmostEqual(box.x - rect.x, 147.5, 10);
|
||||
assertAlmostEqual(box.y - rect.y, -48, 10);
|
||||
|
||||
await formatBarController.boldBtn.click();
|
||||
await formatBarController.italicBtn.click();
|
||||
await formatBarController.underlineBtn.click();
|
||||
|
||||
@@ -606,7 +606,7 @@ test.describe('slash search', () => {
|
||||
await expect(slashMenu).toBeVisible();
|
||||
|
||||
await type(page, 'c');
|
||||
await expect(slashItems).toHaveCount(8);
|
||||
await expect(slashItems).toHaveCount(9);
|
||||
await expect(slashItems.nth(0).locator('.text')).toHaveText(['Copy']);
|
||||
await expect(slashItems.nth(1).locator('.text')).toHaveText(['Italic']);
|
||||
await expect(slashItems.nth(2).locator('.text')).toHaveText(['New Doc']);
|
||||
|
||||
Reference in New Issue
Block a user