feat(core): import progress & perf (#15197)

#### PR Dependency Tree


* **PR #15197** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

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

* **New Features**
* Added a new import pipeline with “plan then commit” batch handling for
Markdown, Notion HTML, Obsidian, and Bear backups.
* Enabled native import sessions with progress, cancellation, and
batch-by-batch committing (including assets, folders, icons, and tags).
  * Added web preflight limits for ZIP and multi-file imports.
* **Bug Fixes**
* Improved import error/warning reporting and continued processing when
some items fail.
* Strengthened snapshot-based file/directory picking to preserve paths.
* **Chores**
  * Updated project packaging/configuration for the new import workflow.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-07-06 01:29:24 +08:00
committed by GitHub
parent 477015f064
commit 8d72e4dc29
106 changed files with 3329 additions and 11690 deletions
@@ -54,6 +54,7 @@ import {
type Workspace,
} from '@blocksuite/affine/store';
import {
commitImportBatchToWorkspace,
createAssetsArchive,
download,
HtmlTransformer,
@@ -436,12 +437,17 @@ export class StarterDebugMenu extends ShadowlessElement {
try {
const file = await openSingleFileWith('Zip');
if (!file) return;
const { docIds } = await MarkdownTransformer.importMarkdownZip({
const { batch } = await MarkdownTransformer.planMarkdownZip({
collection: this.collection,
schema: this.editor.doc.schema,
imported: file,
extensions: this._getStoreManager().get('store'),
});
const { docIds } = await commitImportBatchToWorkspace(
this.collection,
this.editor.doc.schema,
batch
);
if (!this.editor.host) return;
toast(
this.editor.host,
@@ -473,16 +479,21 @@ export class StarterDebugMenu extends ShadowlessElement {
try {
const file = await openSingleFileWith('Zip');
if (!file) return;
const result = await NotionHtmlTransformer.importNotionZip({
const { batch } = await NotionHtmlTransformer.planNotionHtmlZip({
collection: this.collection,
schema: this.editor.doc.schema,
imported: file,
extensions: this._getStoreManager().get('store'),
});
const result = await commitImportBatchToWorkspace(
this.collection,
this.editor.doc.schema,
batch
);
if (!this.editor.host) return;
toast(
this.editor.host,
`Successfully imported ${result.pageIds.length} Notion HTML pages.`
`Successfully imported ${result.docIds.length} Notion HTML pages.`
);
} catch (error) {
console.error('Failed to import Notion HTML Zip:', error);