feat(server): add table support for doc parse (#11508)

fix AF-2478
This commit is contained in:
darkskygit
2025-04-07 09:59:20 +00:00
parent 43809838ef
commit e1bd2047c4

View File

@@ -28,7 +28,8 @@ type KnownFlavour =
| 'affine:image'
| 'affine:attachment'
| 'affine:transcription'
| 'affine:callout';
| 'affine:callout'
| 'affine:table';
export function parseWorkspaceDoc(doc: Doc): WorkspaceDocContent | null {
// not a workspace doc
@@ -118,6 +119,21 @@ export function parsePageDoc(
}
break;
}
case 'affine:table': {
// only extract text in full content mode
if (summaryLenNeeded === -1) {
const contents: string[] = [...block.keys()]
.map(key => {
if (key.startsWith('prop:cells.') && key.endsWith('.text')) {
return block.get(key)?.toString() ?? '';
}
return '';
})
.filter(Boolean);
content.summary += contents.join('|');
}
break;
}
case 'affine:paragraph':
case 'affine:list':
case 'affine:code': {