feat(core): edit icon in navigation panel (#13595)

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

- **New Features**
- Rename dialog now edits per-item explorer icons (emoji or custom) and
can skip name-change callbacks. Doc icon picker added to the editor with
localized "Add icon" placeholder and readonly rendering. Icon editor
supports fallbacks, trigger variants, and improved input/test-id wiring.

- **Style**
- Updated icon picker and trigger sizing and placeholder visuals;
title/icon layout adjustments.

- **Chores**
- Explorer icon storage and module added to persist and serve icons
across the app.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Cats Juice
2025-09-22 18:24:11 +08:00
committed by GitHub
parent 93554304e2
commit 195864fc88
25 changed files with 450 additions and 136 deletions
+41 -41
View File
@@ -821,64 +821,64 @@ test.describe('Customize linked doc title and description', () => {
await expect(cardDescription).toBeHidden();
});
test('should show emoji doc icon in normal document', async ({ page }) => {
await enableEmojiDocIcon(page);
// test('should show emoji doc icon in normal document', async ({ page }) => {
// await enableEmojiDocIcon(page);
await clickNewPageButton(page);
const title = getBlockSuiteEditorTitle(page);
await title.click();
// await clickNewPageButton(page);
// const title = getBlockSuiteEditorTitle(page);
// await title.click();
await page.keyboard.press('Enter');
await createLinkedPage(page, 'Test Page');
// await page.keyboard.press('Enter');
// await createLinkedPage(page, 'Test Page');
const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
// const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
const inlineLink = page.locator('affine-reference');
await inlineLink.hover();
// const inlineLink = page.locator('affine-reference');
// await inlineLink.hover();
// Edits title
await toolbar.getByRole('button', { name: 'Edit' }).click();
// // Edits title
// await toolbar.getByRole('button', { name: 'Edit' }).click();
// Title alias
await page.keyboard.type('🦀hello');
await page.keyboard.press('Enter');
// // Title alias
// await page.keyboard.type('🦀hello');
// await page.keyboard.press('Enter');
const a = inlineLink.locator('a');
// const a = inlineLink.locator('a');
await expect(a).toHaveText('🦀hello');
await expect(a.locator('svg')).toBeHidden();
await expect(a.locator('.affine-reference-title')).toHaveText('hello');
});
// await expect(a).toHaveText('🦀hello');
// await expect(a.locator('svg')).toBeHidden();
// await expect(a.locator('.affine-reference-title')).toHaveText('hello');
// });
test('should show emoji doc icon in journal document', async ({ page }) => {
await enableEmojiDocIcon(page);
// test('should show emoji doc icon in journal document', async ({ page }) => {
// await enableEmojiDocIcon(page);
await clickNewPageButton(page);
const title = getBlockSuiteEditorTitle(page);
await title.click();
// await clickNewPageButton(page);
// const title = getBlockSuiteEditorTitle(page);
// await title.click();
await page.keyboard.press('Enter');
await createTodayPage(page);
// await page.keyboard.press('Enter');
// await createTodayPage(page);
const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
// const toolbar = page.locator('affine-toolbar-widget editor-toolbar');
const inlineLink = page.locator('affine-reference');
await inlineLink.hover();
// const inlineLink = page.locator('affine-reference');
// await inlineLink.hover();
// Edits title
await toolbar.getByRole('button', { name: 'Edit' }).click();
// // Edits title
// await toolbar.getByRole('button', { name: 'Edit' }).click();
// Title alias
await page.keyboard.type('🦀');
await page.keyboard.press('Enter');
// // Title alias
// await page.keyboard.type('🦀');
// await page.keyboard.press('Enter');
const a = inlineLink.locator('a');
// const a = inlineLink.locator('a');
const year = String(new Date().getFullYear());
await expect(a).toContainText('🦀');
await expect(a.locator('svg')).toBeHidden();
await expect(a.locator('.affine-reference-title')).toContainText(year);
});
// const year = String(new Date().getFullYear());
// await expect(a).toContainText('🦀');
// await expect(a.locator('svg')).toBeHidden();
// await expect(a.locator('.affine-reference-title')).toContainText(year);
// });
});
test('should save open doc mode of internal links', async ({ page }) => {