mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
refactor(editor): use transformer from store when possible (#10453)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user