refactor: move utils and cleanup test helpers (#10261)
This commit is contained in:
@@ -33,4 +33,4 @@ export const ImageBlockSpec: ExtensionType[] = [
|
|||||||
ImageBlockAdapterExtensions,
|
ImageBlockAdapterExtensions,
|
||||||
].flat();
|
].flat();
|
||||||
|
|
||||||
export const ImageStoreSpec: ExtensionType[] = [ImageProxyService].flat();
|
export const ImageStoreSpec: ExtensionType[] = [ImageProxyService];
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Return `true` if the element has class name in the class list.
|
||||||
|
*/
|
||||||
|
export function hasClassNameInList(element: Element, classList: string[]) {
|
||||||
|
return classList.some(className => element.classList.contains(className));
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './checker.js';
|
export * from './checker.js';
|
||||||
|
export * from './has-classname-in-list.js';
|
||||||
export * from './point-to-block.js';
|
export * from './point-to-block.js';
|
||||||
export * from './point-to-range.js';
|
export * from './point-to-range.js';
|
||||||
export * from './query.js';
|
export * from './query.js';
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import { AssetsManager, MemoryBlobCRUD } from '@blocksuite/store';
|
|||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
|
|
||||||
import { defaultBlockHtmlAdapterMatchers } from '../../_common/adapters/html/block-matcher.js';
|
import { defaultBlockHtmlAdapterMatchers } from '../../_common/adapters/html/block-matcher.js';
|
||||||
import { nanoidReplacement } from '../../_common/test-utils/test-utils.js';
|
|
||||||
import { embedSyncedDocMiddleware } from '../../_common/transformers/middlewares.js';
|
import { embedSyncedDocMiddleware } from '../../_common/transformers/middlewares.js';
|
||||||
import { createJob } from '../utils/create-job.js';
|
import { createJob } from '../utils/create-job.js';
|
||||||
|
import { nanoidReplacement } from '../utils/nanoid-replacement.js';
|
||||||
|
|
||||||
const container = new Container();
|
const container = new Container();
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import { AssetsManager, MemoryBlobCRUD } from '@blocksuite/store';
|
|||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
|
|
||||||
import { defaultBlockMarkdownAdapterMatchers } from '../../_common/adapters/markdown/block-matcher.js';
|
import { defaultBlockMarkdownAdapterMatchers } from '../../_common/adapters/markdown/block-matcher.js';
|
||||||
import { nanoidReplacement } from '../../_common/test-utils/test-utils.js';
|
|
||||||
import { embedSyncedDocMiddleware } from '../../_common/transformers/middlewares.js';
|
import { embedSyncedDocMiddleware } from '../../_common/transformers/middlewares.js';
|
||||||
import { createJob } from '../utils/create-job.js';
|
import { createJob } from '../utils/create-job.js';
|
||||||
|
import { nanoidReplacement } from '../utils/nanoid-replacement.js';
|
||||||
|
|
||||||
const container = new Container();
|
const container = new Container();
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import {
|
|||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
|
|
||||||
import { defaultBlockNotionHtmlAdapterMatchers } from '../../_common/adapters/notion-html/block-matcher.js';
|
import { defaultBlockNotionHtmlAdapterMatchers } from '../../_common/adapters/notion-html/block-matcher.js';
|
||||||
import { nanoidReplacement } from '../../_common/test-utils/test-utils.js';
|
|
||||||
import { createJob } from '../utils/create-job.js';
|
import { createJob } from '../utils/create-job.js';
|
||||||
|
import { nanoidReplacement } from '../utils/nanoid-replacement.js';
|
||||||
|
|
||||||
const container = new Container();
|
const container = new Container();
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { NotionTextAdapter } from '@blocksuite/affine-shared/adapters';
|
|||||||
import type { SliceSnapshot } from '@blocksuite/store';
|
import type { SliceSnapshot } from '@blocksuite/store';
|
||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
|
|
||||||
import { nanoidReplacement } from '../../_common/test-utils/test-utils.js';
|
|
||||||
import { createJob } from '../utils/create-job.js';
|
import { createJob } from '../utils/create-job.js';
|
||||||
|
import { nanoidReplacement } from '../utils/nanoid-replacement.js';
|
||||||
|
|
||||||
describe('notion-text to snapshot', () => {
|
describe('notion-text to snapshot', () => {
|
||||||
test('basic', () => {
|
test('basic', () => {
|
||||||
|
|||||||
@@ -1,20 +1,5 @@
|
|||||||
import {
|
|
||||||
mergeToCodeModel,
|
|
||||||
transformModel,
|
|
||||||
} from '@blocksuite/affine-shared/utils';
|
|
||||||
import type { BlockSnapshot, SliceSnapshot } from '@blocksuite/store';
|
import type { BlockSnapshot, SliceSnapshot } from '@blocksuite/store';
|
||||||
|
|
||||||
class DocTestUtils {
|
|
||||||
// block model operations (data layer)
|
|
||||||
mergeToCodeModel = mergeToCodeModel;
|
|
||||||
|
|
||||||
transformModel = transformModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TestUtils {
|
|
||||||
docTestUtils = new DocTestUtils();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function nanoidReplacement(snapshot: BlockSnapshot | SliceSnapshot) {
|
export function nanoidReplacement(snapshot: BlockSnapshot | SliceSnapshot) {
|
||||||
return JSON.parse(nanoidReplacementString(JSON.stringify(snapshot)));
|
return JSON.parse(nanoidReplacementString(JSON.stringify(snapshot)));
|
||||||
}
|
}
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export * from '../types.js';
|
|
||||||
export * from './query.js';
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import type { EditorHost } from '@blocksuite/block-std';
|
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
|
||||||
|
|
||||||
import type { RootBlockComponent } from '../../index.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used to build model's "normal" block path.
|
|
||||||
* If this function does not meet your needs, you may need to build path manually to satisfy your needs.
|
|
||||||
* You should not modify this function.
|
|
||||||
*/
|
|
||||||
export function buildPath(model: BlockModel | null): string[] {
|
|
||||||
const path: string[] = [];
|
|
||||||
let current = model;
|
|
||||||
while (current) {
|
|
||||||
path.unshift(current.id);
|
|
||||||
current = current.doc.getParent(current);
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getRootByEditorHost(
|
|
||||||
editorHost: EditorHost
|
|
||||||
): RootBlockComponent | null {
|
|
||||||
return (
|
|
||||||
getPageRootByEditorHost(editorHost) ??
|
|
||||||
getEdgelessRootByEditorHost(editorHost)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If it's not in the page mode, it will return `null` directly */
|
|
||||||
export function getPageRootByEditorHost(editorHost: EditorHost) {
|
|
||||||
return editorHost.querySelector('affine-page-root');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If it's not in the edgeless mode, it will return `null` directly */
|
|
||||||
export function getEdgelessRootByEditorHost(editorHost: EditorHost) {
|
|
||||||
return editorHost.querySelector('affine-edgeless-root');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get block component by model.
|
|
||||||
* Note that this function is used for compatibility only, and may be removed in the future.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export function getBlockComponentByModel(
|
|
||||||
editorHost: EditorHost,
|
|
||||||
model: BlockModel | null
|
|
||||||
) {
|
|
||||||
if (!model) return null;
|
|
||||||
return editorHost.view.getBlock(model.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return `true` if the element has class name in the class list.
|
|
||||||
*/
|
|
||||||
export function hasClassNameInList(element: Element, classList: string[]) {
|
|
||||||
return classList.some(className => element.classList.contains(className));
|
|
||||||
}
|
|
||||||
@@ -71,11 +71,12 @@ export const CommonBlockSpecs: ExtensionType[] = [
|
|||||||
BookmarkBlockSpec,
|
BookmarkBlockSpec,
|
||||||
EmbedExtensions,
|
EmbedExtensions,
|
||||||
AttachmentBlockSpec,
|
AttachmentBlockSpec,
|
||||||
AdapterFactoryExtensions,
|
|
||||||
CodeBlockSpec,
|
CodeBlockSpec,
|
||||||
ImageBlockSpec,
|
ImageBlockSpec,
|
||||||
ParagraphBlockSpec,
|
ParagraphBlockSpec,
|
||||||
DefaultOpenDocExtension,
|
DefaultOpenDocExtension,
|
||||||
|
FontLoaderService,
|
||||||
|
AdapterFactoryExtensions,
|
||||||
].flat();
|
].flat();
|
||||||
|
|
||||||
export const PageFirstPartyBlockSpecs: ExtensionType[] = [
|
export const PageFirstPartyBlockSpecs: ExtensionType[] = [
|
||||||
@@ -83,7 +84,6 @@ export const PageFirstPartyBlockSpecs: ExtensionType[] = [
|
|||||||
NoteBlockSpec,
|
NoteBlockSpec,
|
||||||
PageSurfaceBlockSpec,
|
PageSurfaceBlockSpec,
|
||||||
PageSurfaceRefBlockSpec,
|
PageSurfaceRefBlockSpec,
|
||||||
FontLoaderService,
|
|
||||||
].flat();
|
].flat();
|
||||||
|
|
||||||
export const EdgelessFirstPartyBlockSpecs: ExtensionType[] = [
|
export const EdgelessFirstPartyBlockSpecs: ExtensionType[] = [
|
||||||
@@ -94,11 +94,9 @@ export const EdgelessFirstPartyBlockSpecs: ExtensionType[] = [
|
|||||||
EdgelessSurfaceRefBlockSpec,
|
EdgelessSurfaceRefBlockSpec,
|
||||||
FrameBlockSpec,
|
FrameBlockSpec,
|
||||||
EdgelessTextBlockSpec,
|
EdgelessTextBlockSpec,
|
||||||
FontLoaderService,
|
|
||||||
].flat();
|
].flat();
|
||||||
|
|
||||||
export const StoreExtensions: ExtensionType[] = [
|
export const StoreExtensions: ExtensionType[] = [
|
||||||
FeatureFlagService,
|
|
||||||
BlockSelectionExtension,
|
BlockSelectionExtension,
|
||||||
TextSelectionExtension,
|
TextSelectionExtension,
|
||||||
SurfaceSelectionExtension,
|
SurfaceSelectionExtension,
|
||||||
@@ -107,8 +105,9 @@ export const StoreExtensions: ExtensionType[] = [
|
|||||||
ImageSelectionExtension,
|
ImageSelectionExtension,
|
||||||
DatabaseSelectionExtension,
|
DatabaseSelectionExtension,
|
||||||
TableSelectionExtension,
|
TableSelectionExtension,
|
||||||
|
|
||||||
|
FeatureFlagService,
|
||||||
LinkPreviewerService,
|
LinkPreviewerService,
|
||||||
FileSizeLimitService,
|
FileSizeLimitService,
|
||||||
|
|
||||||
ImageStoreSpec,
|
ImageStoreSpec,
|
||||||
].flat();
|
].flat();
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { isCanvasElement } from './root-block/edgeless/utils/query.js';
|
|||||||
|
|
||||||
export * from './_common/adapters/index.js';
|
export * from './_common/adapters/index.js';
|
||||||
export { type NavigatorMode } from './_common/edgeless/frame/consts.js';
|
export { type NavigatorMode } from './_common/edgeless/frame/consts.js';
|
||||||
export * from './_common/test-utils/test-utils.js';
|
|
||||||
export * from './_common/transformers/index.js';
|
export * from './_common/transformers/index.js';
|
||||||
export { type AbstractEditor } from './_common/types.js';
|
export { type AbstractEditor } from './_common/types.js';
|
||||||
export * from './_specs/index.js';
|
export * from './_specs/index.js';
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ import {
|
|||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import { getRootByEditorHost } from '../../../_common/utils/query.js';
|
|
||||||
import { ClipboardAdapter } from '../../clipboard/adapter.js';
|
import { ClipboardAdapter } from '../../clipboard/adapter.js';
|
||||||
import { PageClipboard } from '../../clipboard/index.js';
|
import { PageClipboard } from '../../clipboard/index.js';
|
||||||
import {
|
import {
|
||||||
decodeClipboardBlobs,
|
decodeClipboardBlobs,
|
||||||
encodeClipboardBlobs,
|
encodeClipboardBlobs,
|
||||||
} from '../../clipboard/utils.js';
|
} from '../../clipboard/utils.js';
|
||||||
|
import type { RootBlockComponent } from '../../types.js';
|
||||||
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
||||||
import { edgelessElementsBoundFromRawData } from '../utils/bound-utils.js';
|
import { edgelessElementsBoundFromRawData } from '../utils/bound-utils.js';
|
||||||
import { createNewPresentationIndexes } from '../utils/clipboard-utils.js';
|
import { createNewPresentationIndexes } from '../utils/clipboard-utils.js';
|
||||||
@@ -1439,3 +1439,12 @@ function tryGetSvgFromClipboard(clipboardData: DataTransfer) {
|
|||||||
const file = new File([blob], 'pasted-image.svg', { type: 'image/svg+xml' });
|
const file = new File([blob], 'pasted-image.svg', { type: 'image/svg+xml' });
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRootByEditorHost(
|
||||||
|
editorHost: EditorHost
|
||||||
|
): RootBlockComponent | null {
|
||||||
|
const model = editorHost.doc.root;
|
||||||
|
if (!model) return null;
|
||||||
|
const root = editorHost.view.getBlock(model.id);
|
||||||
|
return root as RootBlockComponent | null;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import {
|
|||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
||||||
import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types';
|
import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types';
|
||||||
|
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import { Point } from '@blocksuite/global/utils';
|
import { Point } from '@blocksuite/global/utils';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
import { hasClassNameInList } from '../../../_common/utils/index.js';
|
|
||||||
import { EXCLUDING_MOUSE_OUT_CLASS_LIST } from '../utils/consts.js';
|
import { EXCLUDING_MOUSE_OUT_CLASS_LIST } from '../utils/consts.js';
|
||||||
import { DraggingNoteOverlay, NoteOverlay } from '../utils/tool-overlay.js';
|
import { DraggingNoteOverlay, NoteOverlay } from '../utils/tool-overlay.js';
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import {
|
|||||||
TelemetryProvider,
|
TelemetryProvider,
|
||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
|
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound } from '@blocksuite/global/utils';
|
import type { IBound } from '@blocksuite/global/utils';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/utils';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
import { hasClassNameInList } from '../../../_common/utils/index.js';
|
|
||||||
import {
|
import {
|
||||||
EXCLUDING_MOUSE_OUT_CLASS_LIST,
|
EXCLUDING_MOUSE_OUT_CLASS_LIST,
|
||||||
SHAPE_OVERLAY_HEIGHT,
|
SHAPE_OVERLAY_HEIGHT,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
||||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
|
|
||||||
import type { Connectable } from '../../../_common/utils/index.js';
|
import type { Connectable } from '../../../_common/types.js';
|
||||||
import type { EdgelessRootBlockComponent } from '../index.js';
|
import type { EdgelessRootBlockComponent } from '../index.js';
|
||||||
import { isConnectable } from './query.js';
|
import { isConnectable } from './query.js';
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import type { PointLocation } from '@blocksuite/global/utils';
|
|||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/utils';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
|
|
||||||
import type { Connectable } from '../../../_common/utils/index.js';
|
import type { Connectable } from '../../../_common/types';
|
||||||
|
|
||||||
export function isMindmapNode(element: GfxBlockElementModel | GfxModel | null) {
|
export function isMindmapNode(element: GfxBlockElementModel | GfxModel | null) {
|
||||||
return element?.group instanceof MindmapElementModel;
|
return element?.group instanceof MindmapElementModel;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import { css, html } from 'lit';
|
|||||||
import { query } from 'lit/decorators.js';
|
import { query } from 'lit/decorators.js';
|
||||||
import { repeat } from 'lit/directives/repeat.js';
|
import { repeat } from 'lit/directives/repeat.js';
|
||||||
|
|
||||||
import { buildPath } from '../../_common/utils/index.js';
|
|
||||||
import { PageClipboard } from '../clipboard/index.js';
|
import { PageClipboard } from '../clipboard/index.js';
|
||||||
import type { PageRootBlockWidgetName } from '../index.js';
|
import type { PageRootBlockWidgetName } from '../index.js';
|
||||||
import { PageKeyboardManager } from '../keyboard/keyboard-manager.js';
|
import { PageKeyboardManager } from '../keyboard/keyboard-manager.js';
|
||||||
@@ -269,13 +268,13 @@ export class PageRootBlockComponent extends BlockComponent<
|
|||||||
);
|
);
|
||||||
if (!sel) return;
|
if (!sel) return;
|
||||||
let model: BlockModel | null = null;
|
let model: BlockModel | null = null;
|
||||||
let path: string[] = buildPath(this.doc.getBlockById(sel.blockId));
|
let current = this.doc.getBlockById(sel.blockId);
|
||||||
while (path.length > 0 && !model) {
|
while (current && !model) {
|
||||||
const m = this.doc.getBlockById(path[path.length - 1]);
|
if (current.flavour === 'affine:note') {
|
||||||
if (m && m.flavour === 'affine:note') {
|
model = current;
|
||||||
model = m;
|
} else {
|
||||||
|
current = this.doc.getParent(current);
|
||||||
}
|
}
|
||||||
path = path.slice(0, -1);
|
|
||||||
}
|
}
|
||||||
if (!model) return;
|
if (!model) return;
|
||||||
const prevNote = this.doc.getPrev(model);
|
const prevNote = this.doc.getPrev(model);
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
import { RootBlockSchema } from '@blocksuite/affine-model';
|
import { RootBlockSchema } from '@blocksuite/affine-model';
|
||||||
import type { Viewport } from '@blocksuite/affine-shared/types';
|
|
||||||
import { Slot } from '@blocksuite/global/utils';
|
|
||||||
|
|
||||||
import { RootService } from '../root-service.js';
|
import { RootService } from '../root-service.js';
|
||||||
|
|
||||||
export class PageRootService extends RootService {
|
export class PageRootService extends RootService {
|
||||||
static override readonly flavour = RootBlockSchema.model.flavour;
|
static override readonly flavour = RootBlockSchema.model.flavour;
|
||||||
|
|
||||||
slots = {
|
|
||||||
viewportUpdated: new Slot<Viewport>(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
blocksuite/playground/apps/env.d.ts
vendored
2
blocksuite/playground/apps/env.d.ts
vendored
@@ -1,5 +1,4 @@
|
|||||||
import type { EditorHost } from '@blocksuite/block-std';
|
import type { EditorHost } from '@blocksuite/block-std';
|
||||||
import type { TestUtils } from '@blocksuite/blocks';
|
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||||
import type { BlockSchema, Blocks, Workspace, Transformer } from '@blocksuite/store';
|
import type { BlockSchema, Blocks, Workspace, Transformer } from '@blocksuite/store';
|
||||||
import type { z } from 'zod';
|
import type { z } from 'zod';
|
||||||
@@ -20,7 +19,6 @@ declare global {
|
|||||||
job: Transformer;
|
job: Transformer;
|
||||||
Y: typeof Y;
|
Y: typeof Y;
|
||||||
std: typeof std;
|
std: typeof std;
|
||||||
testUtils: TestUtils;
|
|
||||||
host: EditorHost;
|
host: EditorHost;
|
||||||
testWorker: Worker;
|
testWorker: Worker;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AffineSchemas, SpecProvider, TestUtils } from '@blocksuite/blocks';
|
import { AffineSchemas, SpecProvider } from '@blocksuite/blocks';
|
||||||
import { nanoid, Schema, Transformer } from '@blocksuite/store';
|
import { nanoid, Schema, Transformer } from '@blocksuite/store';
|
||||||
import {
|
import {
|
||||||
createAutoIncrementIdGenerator,
|
createAutoIncrementIdGenerator,
|
||||||
@@ -73,7 +73,6 @@ export function createStarterDocCollection() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
window.Y = Y;
|
window.Y = Y;
|
||||||
window.testUtils = new TestUtils();
|
|
||||||
|
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import type { EditorHost } from '@blocksuite/block-std';
|
import type { EditorHost } from '@blocksuite/block-std';
|
||||||
import type { RefNodeSlotsProvider, TestUtils } from '@blocksuite/blocks';
|
import type { RefNodeSlotsProvider } from '@blocksuite/blocks';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||||
import type {
|
import type {
|
||||||
BlockModel,
|
BlockModel,
|
||||||
@@ -47,7 +47,6 @@ declare global {
|
|||||||
debugMenu: HTMLElement;
|
debugMenu: HTMLElement;
|
||||||
editor: AffineEditorContainer;
|
editor: AffineEditorContainer;
|
||||||
host: EditorHost;
|
host: EditorHost;
|
||||||
testUtils: TestUtils;
|
|
||||||
job: Transformer;
|
job: Transformer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user