feat(editor): use store extension manager (#11891)

Closes: BS-3284
This commit is contained in:
Saul-Mirone
2025-04-22 15:51:22 +00:00
parent 99ad4e871e
commit 43966a6c6b
25 changed files with 160 additions and 54 deletions
@@ -19,6 +19,7 @@ import './left-side-panel.js';
import { defaultImageProxyMiddleware } from '@blocksuite/affine/blocks/image';
import { ExportManager } from '@blocksuite/affine/blocks/surface';
import { toast } from '@blocksuite/affine/components/toast';
import { StoreExtensionManagerIdentifier } from '@blocksuite/affine/ext-loader';
import {
BlockSuiteError,
ErrorCode,
@@ -331,6 +332,10 @@ export class StarterDebugMenu extends ShadowlessElement {
);
}
private _getStoreManager() {
return this.editor.std.get(StoreExtensionManagerIdentifier);
}
private async _importHTML() {
try {
const files = await openFileOrFiles({
@@ -349,6 +354,7 @@ export class StarterDebugMenu extends ShadowlessElement {
schema: this.editor.doc.schema,
html: text,
fileName,
extensions: this._getStoreManager().get('store'),
});
if (pageId) {
pageIds.push(pageId);
@@ -372,6 +378,7 @@ export class StarterDebugMenu extends ShadowlessElement {
collection: this.collection,
schema: this.editor.doc.schema,
imported: file,
extensions: this._getStoreManager().get('store'),
});
if (!this.editor.host) return;
toast(
@@ -401,6 +408,7 @@ export class StarterDebugMenu extends ShadowlessElement {
schema: this.editor.doc.schema,
markdown: text,
fileName,
extensions: this._getStoreManager().get('store'),
});
if (pageId) {
pageIds.push(pageId);
@@ -424,6 +432,7 @@ export class StarterDebugMenu extends ShadowlessElement {
collection: this.collection,
schema: this.editor.doc.schema,
imported: file,
extensions: this._getStoreManager().get('store'),
});
if (!this.editor.host) return;
toast(
@@ -463,6 +472,7 @@ export class StarterDebugMenu extends ShadowlessElement {
collection: this.collection,
schema: this.editor.doc.schema,
imported: file,
extensions: this._getStoreManager().get('store'),
});
if (!this.editor.host) return;
toast(