mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-11-30 01:00:27 +03:00
### Summary Fixes #15818. 1. **`blocksuite/affine/blocks/table/src/adapters/{utils,markdown,plain-text}.ts`**: - Match `database/src/adapters/` and `table/src/adapters/html.ts` by supporting plain-string cell values (`typeof v.value === 'string'`) and missing/undefined `.text` in `processTable` (`utils.ts`), `tableBlockMarkdownAdapterMatcher` (`markdown.ts`), and `tableBlockPlainTextAdapterMatcher` (`plain-text.ts`). - Previously, `table/src/adapters/markdown.ts` and `plain-text.ts` unconditionally called `deltaConverter.deltaToAST(v.value.delta)`, which threw `TypeError: Cannot read properties of undefined (reading 'map')` when `cell.text` was a string or missing `.delta`, causing both `Export -> Markdown` and `Export -> Copy as Markdown` (`copy-markdown`) to fail inside `adapter.fromDoc(doc)`. 2. **`packages/frontend/core/src/components/hooks/affine/use-export-page.ts` & `blocksuite/affine/widgets/linked-doc/src/transformers/{markdown,html}.ts`**: - Propagate `Promise<boolean>` from `exportDoc`, `exportToHtml`, `exportToMarkdown`, `HtmlTransformer.exportDoc`, and `MarkdownTransformer.exportDoc` instead of hardcoding `return true` in `exportHandler`. - When `adapter.fromDoc(doc)` or `docToSnapshot(doc)` fails and returns `undefined` (or produces empty output with no assets), `exportHandler` now returns `false` so the user sees the error notification rather than a false-positive `"Exported successfully / Please open the download folder to check."` toast. - In `copyAsMarkdown`, fall back to `new MarkdownAdapter(transformer, doc.provider)` when `std` is not present (matching `MarkdownTransformer.exportDoc`). 3. **`blocksuite/affine/widgets/linked-doc/src/transformers/utils.ts`**: - Defer `element.remove()` and `URL.revokeObjectURL(fileURL)` in `download()` via `setTimeout(..., 100)` (consistent with `packages/frontend/admin/src/modules/accounts/utils/csv-utils.ts` and `packages/frontend/core/src/blocksuite/database-block/properties/file/view.tsx`) so the blob URL is not revoked synchronously before the download initiates. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Table exports now handle missing or empty cell text consistently. * HTML and Markdown export actions now report whether an export was downloaded, and avoid reporting success when no export is available. * Copying as Markdown works even when an editor standard scope is unavailable. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DarkSky <darksky2048@gmail.com>