fix(editor): reclaim the nine formats DSH has no preview for
The alpha.1 handover refused 27 extensions so DSH's own document preview could own them, but nine of those have NO host renderer at all: `avif` and `ods` sit in `document/unviewable.ts`'s "known binary, no renderer" list and get the unsupported empty state directly, while `xlsb` / `xlt` / `xltx` / `xltm` / `ots` / `dot` / `dotx` fall through to the plain-text body, fail the binary check and land on the same dead end. Before that handover these files reached the plugin's `code` catch-all and rendered the binary-download pane, so refusing them was a user-visible regression we introduced ourselves — and rc.1 did not restore it. They are claimed again (`fods` stays handed over: the host shows that flat XML as plain text, which beats a download pane). `canOpen` had zero test coverage, which is exactly why the regression went unnoticed, so `tests/native-surface.spec.ts` now pins both directions: every format the host renders must be refused, every format it cannot render must be claimed. Reverting to the old list makes it fail with `macro.xlsb: expected false to be true`.
This commit is contained in:
@@ -49,16 +49,25 @@ import {
|
||||
*
|
||||
* Refusing here is what hands the address over: `canOpen` returning false
|
||||
* leaves the built-in `text` type (the `fallback` band) as the only claimant.
|
||||
*
|
||||
* The list is exactly the set the host renders — nothing more. Nine extensions
|
||||
* that the host has NO renderer for (`xlsb xlt xltx xltm ots dot dotx avif`)
|
||||
* used to be refused here too, and refusing them turned "the plugin shows a
|
||||
* download panel" into "the host shows 'preview is not available for this file
|
||||
* type yet'" — a dead end. They are claimed again, so the `code` catch-all
|
||||
* takes them to the binary download pane. `fods` stays refused on purpose: the
|
||||
* host's plain-text fallback renders flat ODS XML, which beats a download.
|
||||
* `tests/native-surface.spec.ts` pins both directions of this boundary.
|
||||
*/
|
||||
const HOST_OWNED_EXTS: ReadonlySet<string> = new Set([
|
||||
// Spreadsheets: the built-in renders a table in a worker.
|
||||
'xlsx', 'xls', 'xlsb', 'xlt', 'xltx', 'xltm', 'ods', 'ots', 'fods', 'csv', 'tsv',
|
||||
'xlsx', 'xls', 'csv', 'tsv', 'fods',
|
||||
// PDF: the built-in viewer pages and zooms.
|
||||
'pdf',
|
||||
// Images: the built-in viewer adds a zoom viewport.
|
||||
'png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'ico', 'avif',
|
||||
'png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'ico',
|
||||
// Office documents: the built-in converts them to PDF host-side.
|
||||
'doc', 'docx', 'dot', 'dotx', 'ppt', 'pptx',
|
||||
'doc', 'docx', 'ppt', 'pptx',
|
||||
])
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user