mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 12:06:35 +08:00
refactor(editor): rename doc to blocks (#9510)
This commit is contained in:
@@ -25,7 +25,7 @@ import type { GfxBlockElementModel } from '@blocksuite/block-std/gfx';
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import type { IBound } from '@blocksuite/global/utils';
|
||||
import { Bound } from '@blocksuite/global/utils';
|
||||
import type { Doc } from '@blocksuite/store';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
|
||||
import {
|
||||
getBlockComponentByModel,
|
||||
@@ -110,7 +110,7 @@ export class ExportManager {
|
||||
await Promise.all(promises);
|
||||
};
|
||||
|
||||
get doc(): Doc {
|
||||
get doc(): Blocks {
|
||||
return this.std.doc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HtmlAdapter } from '@blocksuite/affine-shared/adapters';
|
||||
import { Container } from '@blocksuite/global/di';
|
||||
import { sha } from '@blocksuite/global/utils';
|
||||
import type { Doc, Workspace } from '@blocksuite/store';
|
||||
import type { Blocks, Workspace } from '@blocksuite/store';
|
||||
import { extMimeMap, Job } from '@blocksuite/store';
|
||||
|
||||
import { defaultBlockHtmlAdapterMatchers } from '../adapters/html/block-matcher.js';
|
||||
@@ -43,7 +43,7 @@ const provider = container.provider();
|
||||
* @param doc - The doc to be exported.
|
||||
* @returns A Promise that resolves when the export is complete.
|
||||
*/
|
||||
async function exportDoc(doc: Doc) {
|
||||
async function exportDoc(doc: Blocks) {
|
||||
const job = new Job({
|
||||
schema: doc.schema,
|
||||
blobCRUD: doc.blobSync,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { MarkdownAdapter } from '@blocksuite/affine-shared/adapters';
|
||||
import { Container } from '@blocksuite/global/di';
|
||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||
import { assertExists, sha } from '@blocksuite/global/utils';
|
||||
import type { Doc, Workspace } from '@blocksuite/store';
|
||||
import type { Blocks, Workspace } from '@blocksuite/store';
|
||||
import { extMimeMap, Job } from '@blocksuite/store';
|
||||
|
||||
import { defaultBlockMarkdownAdapterMatchers } from '../adapters/index.js';
|
||||
@@ -28,7 +28,7 @@ const container = new Container();
|
||||
const provider = container.provider();
|
||||
|
||||
type ImportMarkdownToBlockOptions = {
|
||||
doc: Doc;
|
||||
doc: Blocks;
|
||||
markdown: string;
|
||||
blockId: string;
|
||||
};
|
||||
@@ -49,7 +49,7 @@ type ImportMarkdownZipOptions = {
|
||||
* @param doc The doc to export
|
||||
* @returns A Promise that resolves when the export is complete
|
||||
*/
|
||||
async function exportDoc(doc: Doc) {
|
||||
async function exportDoc(doc: Blocks) {
|
||||
const job = new Job({
|
||||
schema: doc.schema,
|
||||
blobCRUD: doc.blobSync,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { sha } from '@blocksuite/global/utils';
|
||||
import type { Doc, DocSnapshot, Workspace } from '@blocksuite/store';
|
||||
import type { Blocks, DocSnapshot, Workspace } from '@blocksuite/store';
|
||||
import { extMimeMap, getAssetName, Job } from '@blocksuite/store';
|
||||
|
||||
import { download, Unzip, Zip } from '../transformers/utils.js';
|
||||
import { replaceIdMiddleware, titleMiddleware } from './middlewares.js';
|
||||
|
||||
async function exportDocs(collection: Workspace, docs: Doc[]) {
|
||||
async function exportDocs(collection: Workspace, docs: Blocks[]) {
|
||||
const zip = new Zip();
|
||||
const job = new Job({
|
||||
schema: collection.schema,
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
GroupElementModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import type { Slot } from '@blocksuite/global/utils';
|
||||
import type { Doc } from '@blocksuite/store';
|
||||
import type { Blocks } from '@blocksuite/store';
|
||||
|
||||
/** Common context interface definition for block models. */
|
||||
|
||||
@@ -14,7 +14,7 @@ type EditorSlots = {
|
||||
};
|
||||
|
||||
export type AbstractEditor = {
|
||||
doc: Doc;
|
||||
doc: Blocks;
|
||||
mode: DocMode;
|
||||
readonly slots: EditorSlots;
|
||||
} & HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user