diff --git a/blocksuite/affine/all/src/__tests__/adapters/notion-html.unit.spec.ts b/blocksuite/affine/all/src/__tests__/adapters/notion-html.unit.spec.ts
index 8dbd196aa2..16a6015ff1 100644
--- a/blocksuite/affine/all/src/__tests__/adapters/notion-html.unit.spec.ts
+++ b/blocksuite/affine/all/src/__tests__/adapters/notion-html.unit.spec.ts
@@ -1263,6 +1263,37 @@ describe('notion html to snapshot', () => {
});
expect(nanoidReplacement(rawBlockSnapshot)).toEqual(blockSnapshot);
});
+
+ const userAvatar = `
Alice`;
+
+ test.each([
+ {
+ location: 'a database person cell',
+ body: `
+ | Name | Person |
+ | Row | ${userAvatar} |
+
`,
+ },
+ {
+ location: 'a paragraph',
+ body: `${userAvatar}
`,
+ },
+ ])(
+ 'does not import a user avatar in $location as an image',
+ async ({ body }) => {
+ const adapter = new NotionHtmlAdapter(createJob(), provider);
+ const snapshot = await adapter.toBlockSnapshot({
+ file: `${body}
`,
+ assets: new AssetsManager({ blob: new MemoryBlobCRUD() }),
+ });
+
+ const flavours = (block: BlockSnapshot): string[] => [
+ block.flavour,
+ ...block.children.flatMap(flavours),
+ ];
+ expect(flavours(snapshot)).not.toContain('affine:image');
+ }
+ );
});
test('bookmark', async () => {
diff --git a/blocksuite/affine/blocks/image/src/adapters/notion-html.ts b/blocksuite/affine/blocks/image/src/adapters/notion-html.ts
index 9af231ca1a..8a4343ac05 100644
--- a/blocksuite/affine/blocks/image/src/adapters/notion-html.ts
+++ b/blocksuite/affine/blocks/image/src/adapters/notion-html.ts
@@ -11,11 +11,16 @@ export const imageBlockNotionHtmlAdapterMatcher: BlockNotionHtmlAdapterMatcher =
{
flavour: ImageBlockSchema.model.flavour,
toMatch: o => {
+ if (!HastUtils.isElement(o.node)) {
+ return false;
+ }
+ if (o.node.tagName === 'img') {
+ const className = o.node.properties.className;
+ return !(Array.isArray(className) && className.includes('user-icon'));
+ }
return (
- HastUtils.isElement(o.node) &&
- (o.node.tagName === 'img' ||
- (o.node.tagName === 'figure' &&
- !!HastUtils.querySelector(o.node, '.image')))
+ o.node.tagName === 'figure' &&
+ !!HastUtils.querySelector(o.node, '.image')
);
},
fromMatch: () => false,