refactor(editor): orgnize exports (#10709)

This commit is contained in:
Saul-Mirone
2025-03-10 02:04:01 +00:00
parent 6540b568b0
commit ec709925ee
266 changed files with 522 additions and 889 deletions

View File

@@ -9,12 +9,15 @@ export async function updateBlockType(
) {
await page.evaluate(
([flavour, type]) => {
window.host.std.command.exec(window.$blocksuite.blocks.updateBlockType, {
flavour,
props: {
type,
},
});
window.host.std.command.exec(
window.$blocksuite.blocks.note.updateBlockType,
{
flavour,
props: {
type,
},
}
);
},
[flavour, type] as [string, string?]
);

View File

@@ -1,11 +1,8 @@
import '../declare-test-window.js';
import type {
DatabaseBlockModel,
ListType,
RichText,
} from '@blocksuite/affine/blocks';
import type { InlineRange, InlineRootElement } from '@blocksuite/affine/inline';
import type { DatabaseBlockModel, ListType } from '@blocksuite/affine/model';
import type { RichText } from '@blocksuite/affine/rich-text';
import type { BlockModel } from '@blocksuite/affine/store';
import { uuidv4 } from '@blocksuite/affine/store';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
@@ -341,9 +338,8 @@ export async function initEmptyDatabaseState(page: Page, rootId?: string) {
noteId
);
const model = doc.getBlockById(databaseId) as DatabaseBlockModel;
const datasource = new window.$blocksuite.blocks.DatabaseBlockDataSource(
model
);
const datasource =
new window.$blocksuite.blocks.database.DatabaseBlockDataSource(model);
datasource.viewManager.viewAdd('table');
doc.captureSync();
return { rootId, noteId, databaseId };
@@ -378,9 +374,8 @@ export async function initKanbanViewState(
noteId
);
const model = doc.getBlockById(databaseId) as DatabaseBlockModel;
const datasource = new window.$blocksuite.blocks.DatabaseBlockDataSource(
model
);
const datasource =
new window.$blocksuite.blocks.database.DatabaseBlockDataSource(model);
const rowIds = config.rows.map(rowText => {
const rowId = doc.addBlock(
'affine:paragraph',
@@ -435,9 +430,8 @@ export async function initEmptyDatabaseWithParagraphState(
noteId
);
const model = doc.getBlockById(databaseId) as DatabaseBlockModel;
const datasource = new window.$blocksuite.blocks.DatabaseBlockDataSource(
model
);
const datasource =
new window.$blocksuite.blocks.database.DatabaseBlockDataSource(model);
datasource.viewManager.viewAdd('table');
doc.addBlock('affine:paragraph', {}, noteId);
doc.captureSync();

View File

@@ -5,14 +5,13 @@ import type {
EditorHost,
TextSelection,
} from '@blocksuite/affine/block-std';
import type { EdgelessNoteBackground } from '@blocksuite/affine/blocks/note';
import type { InlineRootElement } from '@blocksuite/affine/inline';
import type { NoteBlockModel, RootBlockModel } from '@blocksuite/affine/model';
import type {
AffineInlineEditor,
EdgelessNoteBackground,
NoteBlockModel,
RichText,
RootBlockModel,
} from '@blocksuite/affine/blocks';
import type { InlineRootElement } from '@blocksuite/affine/inline';
} from '@blocksuite/affine/rich-text';
import type { BlockModel } from '@blocksuite/affine/store';
import { expect, type Locator, type Page } from '@playwright/test';

View File

@@ -12,7 +12,10 @@ declare global {
*/
$blocksuite: {
store: typeof import('@blocksuite/affine/store');
blocks: typeof import('@blocksuite/affine/blocks');
blocks: {
database: typeof import('@blocksuite/affine/blocks/database');
note: typeof import('@blocksuite/affine/blocks/note');
};
global: {
utils: typeof import('@blocksuite/affine/global/utils');
};

View File

@@ -2,7 +2,7 @@ import type {
MindmapElementModel,
MindmapNode,
ShapeElementModel,
} from '@blocksuite/affine/blocks';
} from '@blocksuite/affine/model';
import type { Page } from '@playwright/test';
import { clickView } from './actions/click.js';