refactor(editor): rename job to transformer (#9639)

This commit is contained in:
Mirone
2025-01-11 12:04:07 +08:00
committed by GitHub
parent 9fa35ed490
commit 446b31b621
56 changed files with 223 additions and 193 deletions

View File

@@ -58,8 +58,8 @@ import {
type BlockSnapshot,
BlockSnapshotSchema,
fromJSON,
Job,
type SliceSnapshot,
Transformer,
} from '@blocksuite/store';
import DOMPurify from 'dompurify';
import * as Y from 'yjs';
@@ -369,7 +369,7 @@ export class EdgelessClipboardController extends PageClipboard {
if (mayBeSurfaceDataJson !== undefined) {
const elementsRawData = JSON.parse(mayBeSurfaceDataJson);
const { snapshot, blobs } = elementsRawData;
const job = new Job({
const job = new Transformer({
schema: this.std.workspace.schema,
blobCRUD: this.std.workspace.blobSync,
docCRUD: {
@@ -1373,7 +1373,7 @@ export async function prepareClipboardData(
selectedAll: BlockSuite.EdgelessModel[],
std: BlockStdScope
) {
const job = new Job({
const job = new Transformer({
schema: std.workspace.schema,
blobCRUD: std.workspace.blobSync,
docCRUD: {

View File

@@ -15,8 +15,8 @@ import {
type BlockSnapshot,
type DocSnapshot,
DocSnapshotSchema,
Job,
type SnapshotNode,
Transformer,
} from '@blocksuite/store';
import type * as Y from 'yjs';
/**
@@ -72,7 +72,7 @@ export class TemplateJob {
private _template: DocSnapshot | null = null;
job: Job;
job: Transformer;
model: SurfaceBlockModel;
@@ -90,7 +90,7 @@ export class TemplateJob {
type: TemplateType;
constructor({ model, type, middlewares }: TemplateJobConfig) {
this.job = new Job({
this.job = new Transformer({
schema: model.doc.workspace.schema,
blobCRUD: model.doc.workspace.blobSync,
docCRUD: {

View File

@@ -18,7 +18,7 @@ import {
isGfxGroupCompatibleModel,
type SerializedElement,
} from '@blocksuite/block-std/gfx';
import { type BlockSnapshot, Job } from '@blocksuite/store';
import { type BlockSnapshot, Transformer } from '@blocksuite/store';
/**
* return all elements in the tree of the elements
@@ -39,7 +39,7 @@ export function getSortedCloneElements(elements: GfxModel[]) {
export function prepareCloneData(elements: GfxModel[], std: BlockStdScope) {
elements = sortEdgelessElements(elements);
const job = new Job({
const job = new Transformer({
schema: std.workspace.schema,
blobCRUD: std.workspace.blobSync,
docCRUD: {
@@ -58,7 +58,7 @@ export function prepareCloneData(elements: GfxModel[], std: BlockStdScope) {
export function serializeElement(
element: GfxModel,
elements: GfxModel[],
job: Job
job: Transformer
) {
if (element instanceof GfxBlockElementModel) {
const snapshot = job.blockToSnapshot(element);