feat: enhance markdown preview for backlinks (#8956)

fix AF-1770
fix AF-1771

---

fix: doc link middlewares
feat: markdown renderer
feat: allow multiple backlink for a single doc
feat: showing correct doc ref link
feat: trim long para & ident lists
feat: list indentition fix
feat: database/latext handling
feat: other block types handling
fix: lint
This commit is contained in:
pengx17
2024-12-02 10:29:44 +00:00
parent b8467a91b8
commit 31bab2507e
19 changed files with 942 additions and 186 deletions
+29
View File
@@ -7,6 +7,7 @@ import { coreUrl, openHomePage } from '@affine-test/kit/utils/load-page';
import {
clickNewPageButton,
createLinkedPage,
getBlockSuiteEditorTitle,
waitForEmptyEditor,
} from '@affine-test/kit/utils/page-logic';
import { expect, type Locator } from '@playwright/test';
@@ -418,3 +419,31 @@ test('@ popover with click "select a specific date" should show a date picker',
page.locator('affine-reference:has-text("' + date + '")')
).toBeVisible();
});
test('linked doc should show markdown preview in the backlink section', async ({
page,
}) => {
await waitForEmptyEditor(page);
await page.keyboard.type('source page');
await page.keyboard.press('Enter');
await page.keyboard.type('some inline content');
await page.keyboard.press('Enter');
await createLinkedPage(page, 'Test Page');
await page.locator('affine-reference:has-text("Test Page")').click();
await expect(getBlockSuiteEditorTitle(page)).toHaveText('Test Page');
await page
.getByRole('button', {
name: 'Show',
})
.click();
await page.getByRole('button', { name: 'source page' }).click();
await expect(page.locator('text-renderer')).toContainText(
'some inline content'
);
await expect(page.locator('text-renderer')).toContainText('Test Page');
});