mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
refactor(editor): use transformer from store when possible (#10453)
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
} from '@blocksuite/blocks';
|
||||
import { WithDisposable } from '@blocksuite/global/utils';
|
||||
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||
import { type DocSnapshot, Transformer } from '@blocksuite/store';
|
||||
import type { DocSnapshot } from '@blocksuite/store';
|
||||
import { effect } from '@preact/signals-core';
|
||||
import type SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
||||
import { css, html, type PropertyValues } from 'lit';
|
||||
@@ -101,24 +101,15 @@ export class AdaptersPanel extends WithDisposable(ShadowlessElement) {
|
||||
}
|
||||
|
||||
private _createJob() {
|
||||
return new Transformer({
|
||||
schema: this.doc.schema,
|
||||
blobCRUD: this.doc.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => this.doc.workspace.createDoc({ id }),
|
||||
get: (id: string) => this.doc.workspace.getDoc(id),
|
||||
delete: (id: string) => this.doc.workspace.removeDoc(id),
|
||||
},
|
||||
middlewares: [
|
||||
docLinkBaseURLMiddlewareBuilder(
|
||||
'https://example.com',
|
||||
this.doc.workspace.id
|
||||
).get(),
|
||||
titleMiddleware(this.doc.workspace.meta.docMetas),
|
||||
embedSyncedDocMiddleware('content'),
|
||||
defaultImageProxyMiddleware,
|
||||
],
|
||||
});
|
||||
return this.doc.getTransformer([
|
||||
docLinkBaseURLMiddlewareBuilder(
|
||||
'https://example.com',
|
||||
this.doc.workspace.id
|
||||
).get(),
|
||||
titleMiddleware(this.doc.workspace.meta.docMetas),
|
||||
embedSyncedDocMiddleware('content'),
|
||||
defaultImageProxyMiddleware,
|
||||
]);
|
||||
}
|
||||
|
||||
private _getDocSnapshot() {
|
||||
|
||||
Reference in New Issue
Block a user