feat(editor): insert embed doc with quick search by default (#12165)

Close [BS-3404](https://linear.app/affine-design/issue/BS-3404/通过embed-doc时,插入的doc还是card-view,应该要默认embed-view)

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

- **New Features**
  - Added the ability to insert and display embedded synced documents, supporting different link types based on editor mode and user preferences.
  - Introduced new UI interactions and view options for embedded synced documents in edgeless mode.

- **Bug Fixes**
  - Updated UI selectors and preference keys to ensure consistent behavior and correct application of user settings.

- **Tests**
  - Added and updated end-to-end tests for embedding synced documents, including header interactions and viewport fitting.
  - Improved test coverage for quick search insertion and edgeless embed synced doc features.

- **Chores**
  - Renamed settings and updated exports to align with new embedding functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-05-08 10:21:32 +00:00
parent d379143db3
commit 11dfc1d1df
14 changed files with 113 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import type { Command } from '@blocksuite/std';
export type LinkableFlavour =
| 'affine:bookmark'
| 'affine:embed-linked-doc'
| 'affine:embed-synced-doc'
| 'affine:embed-iframe'
| 'affine:embed-figma'
| 'affine:embed-github'

View File

@@ -224,7 +224,7 @@ const conversionsActionGroup = {
) {
const editorSetting = ctx.std.getOptional(EditorSettingProvider);
editorSetting?.set?.(
'docDropCanvasPreferView',
'docCanvasPreferView',
'affine:embed-synced-doc'
);
}

View File

@@ -0,0 +1 @@
export { insertEmbedSyncedDocCommand } from './insert-embed-synced-doc';

View File

@@ -0,0 +1,20 @@
import { insertEmbedCard } from '@blocksuite/affine-block-embed';
import type { EmbedCardStyle, ReferenceParams } from '@blocksuite/affine-model';
import type { Command } from '@blocksuite/std';
export const insertEmbedSyncedDocCommand: Command<
{
docId: string;
params?: ReferenceParams;
},
{ blockId: string }
> = (ctx, next) => {
const { docId, params, std } = ctx;
const flavour = 'affine:embed-synced-doc';
const targetStyle: EmbedCardStyle = 'syncedDoc';
const props: Record<string, unknown> = { pageId: docId };
if (params) props.params = params;
const blockId = insertEmbedCard(std, { flavour, targetStyle, props });
if (!blockId) return;
next({ blockId });
};

View File

@@ -171,7 +171,7 @@ const conversionsActionGroup = {
) {
const editorSetting = ctx.std.getOptional(EditorSettingProvider);
editorSetting?.set?.(
'docDropCanvasPreferView',
'docCanvasPreferView',
'affine:embed-linked-doc'
);
}

View File

@@ -1,4 +1,5 @@
export * from './adapters';
export * from './commands';
export * from './configs';
export * from './edgeless-clipboard-config';
export * from './embed-synced-doc-block';