refactor(editor): use transformer from store when possible (#10453)

This commit is contained in:
Saul-Mirone
2025-02-26 14:15:03 +00:00
parent 1c5e360d7e
commit fd6d96a38e
17 changed files with 75 additions and 215 deletions

View File

@@ -285,7 +285,7 @@ export class Clipboard extends LifeCycleWatcher {
}
private _getJob() {
return this.std.getTransformer(this._jobMiddlewares);
return this.std.store.getTransformer(this._jobMiddlewares);
}
readFromClipboard(clipboardData: DataTransfer) {

View File

@@ -4,8 +4,6 @@ import {
type ExtensionType,
type Store,
StoreSelectionExtension,
Transformer,
type TransformerMiddleware,
} from '@blocksuite/store';
import { Clipboard } from '../clipboard/index.js';
@@ -140,19 +138,6 @@ export class BlockStdScope {
return this.getOptional(BlockViewIdentifier(flavour));
}
getTransformer(middlewares: TransformerMiddleware[] = []) {
return new Transformer({
schema: this.store.schema,
blobCRUD: this.workspace.blobSync,
docCRUD: {
create: (id: string) => this.workspace.createDoc({ id }),
get: (id: string) => this.workspace.getDoc(id),
delete: (id: string) => this.workspace.removeDoc(id),
},
middlewares,
});
}
mount() {
this._lifeCycleWatchers.forEach(watcher => {
watcher.mounted();