refactor(editor): rename presets to integration test (#10340)
This commit is contained in:
116 files changed
+156
-210
No files matched your search
@@ -17,7 +17,6 @@
|
|||||||
"@blocksuite/blocks": "workspace:*",
|
"@blocksuite/blocks": "workspace:*",
|
||||||
"@blocksuite/global": "workspace:*",
|
"@blocksuite/global": "workspace:*",
|
||||||
"@blocksuite/inline": "workspace:*",
|
"@blocksuite/inline": "workspace:*",
|
||||||
"@blocksuite/presets": "workspace:*",
|
|
||||||
"@blocksuite/store": "workspace:*",
|
"@blocksuite/store": "workspace:*",
|
||||||
"@blocksuite/sync": "workspace:*"
|
"@blocksuite/sync": "workspace:*"
|
||||||
},
|
},
|
||||||
@@ -37,7 +36,6 @@
|
|||||||
"./inline": "./src/inline/index.ts",
|
"./inline": "./src/inline/index.ts",
|
||||||
"./inline/consts": "./src/inline/consts.ts",
|
"./inline/consts": "./src/inline/consts.ts",
|
||||||
"./inline/types": "./src/inline/types.ts",
|
"./inline/types": "./src/inline/types.ts",
|
||||||
"./presets": "./src/presets/index.ts",
|
|
||||||
"./blocks": "./src/blocks/index.ts",
|
"./blocks": "./src/blocks/index.ts",
|
||||||
"./blocks/schemas": "./src/blocks/schemas.ts",
|
"./blocks/schemas": "./src/blocks/schemas.ts",
|
||||||
"./sync": "./src/sync/index.ts"
|
"./sync": "./src/sync/index.ts"
|
||||||
@@ -83,9 +81,6 @@
|
|||||||
"inline/types": [
|
"inline/types": [
|
||||||
"dist/inline/types.d.ts"
|
"dist/inline/types.d.ts"
|
||||||
],
|
],
|
||||||
"presets": [
|
|
||||||
"dist/presets/index.d.ts"
|
|
||||||
],
|
|
||||||
"blocks": [
|
"blocks": [
|
||||||
"dist/blocks/index.d.ts"
|
"dist/blocks/index.d.ts"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
|
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
|
||||||
import { effects as presetsEffects } from '@blocksuite/presets/effects';
|
|
||||||
|
|
||||||
export function effects() {
|
export function effects() {
|
||||||
blocksEffects();
|
blocksEffects();
|
||||||
presetsEffects();
|
|
||||||
}
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@blocksuite/presets';
|
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
{ "path": "../../blocks" },
|
{ "path": "../../blocks" },
|
||||||
{ "path": "../../framework/global" },
|
{ "path": "../../framework/global" },
|
||||||
{ "path": "../../framework/inline" },
|
{ "path": "../../framework/inline" },
|
||||||
{ "path": "../../presets" },
|
|
||||||
{ "path": "../../framework/store" },
|
{ "path": "../../framework/store" },
|
||||||
{ "path": "../../framework/sync" }
|
{ "path": "../../framework/sync" }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# `@blocksuite/integration-test`
|
||||||
|
|
||||||
|
Integration test for BlockSuite.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@blocksuite/presets",
|
"name": "@blocksuite/integration-test",
|
||||||
"description": "Prebuilt BlockSuite editors and opt-in additional UI components.",
|
"description": "Integration test for BlockSuite",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-5
@@ -5,9 +5,9 @@ import type {
|
|||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
import type { Store } from '@blocksuite/store';
|
import type { Store } from '@blocksuite/store';
|
||||||
|
|
||||||
import type { AffineEditorContainer } from '../../index.js';
|
import type { TestAffineEditorContainer } from '../../index.js';
|
||||||
|
|
||||||
export function getSurface(doc: Store, editor: AffineEditorContainer) {
|
export function getSurface(doc: Store, editor: TestAffineEditorContainer) {
|
||||||
const surfaceModel = doc.getBlockByFlavour('affine:surface');
|
const surfaceModel = doc.getBlockByFlavour('affine:surface');
|
||||||
|
|
||||||
return editor.host!.view.getBlock(
|
return editor.host!.view.getBlock(
|
||||||
@@ -17,17 +17,17 @@ export function getSurface(doc: Store, editor: AffineEditorContainer) {
|
|||||||
|
|
||||||
export function getDocRootBlock(
|
export function getDocRootBlock(
|
||||||
doc: Store,
|
doc: Store,
|
||||||
editor: AffineEditorContainer,
|
editor: TestAffineEditorContainer,
|
||||||
mode: 'page'
|
mode: 'page'
|
||||||
): PageRootBlockComponent;
|
): PageRootBlockComponent;
|
||||||
export function getDocRootBlock(
|
export function getDocRootBlock(
|
||||||
doc: Store,
|
doc: Store,
|
||||||
editor: AffineEditorContainer,
|
editor: TestAffineEditorContainer,
|
||||||
mode: 'edgeless'
|
mode: 'edgeless'
|
||||||
): EdgelessRootBlockComponent;
|
): EdgelessRootBlockComponent;
|
||||||
export function getDocRootBlock(
|
export function getDocRootBlock(
|
||||||
doc: Store,
|
doc: Store,
|
||||||
editor: AffineEditorContainer,
|
editor: TestAffineEditorContainer,
|
||||||
_?: 'edgeless' | 'page'
|
_?: 'edgeless' | 'page'
|
||||||
) {
|
) {
|
||||||
return editor.host!.view.getBlock(doc.root!.id) as
|
return editor.host!.view.getBlock(doc.root!.id) as
|
||||||
File renamed without changes.
File renamed without changes.
+4
-4
@@ -25,7 +25,7 @@ import {
|
|||||||
TestWorkspace,
|
TestWorkspace,
|
||||||
} from '@blocksuite/store/test';
|
} from '@blocksuite/store/test';
|
||||||
|
|
||||||
import { AffineEditorContainer } from '../../index.js';
|
import { TestAffineEditorContainer } from '../../index.js';
|
||||||
|
|
||||||
function createCollectionOptions() {
|
function createCollectionOptions() {
|
||||||
const schema = new Schema();
|
const schema = new Schema();
|
||||||
@@ -70,7 +70,7 @@ async function createEditor(
|
|||||||
const blockCollection = collection.docs.values().next().value;
|
const blockCollection = collection.docs.values().next().value;
|
||||||
assertExists(blockCollection, 'Need to create a doc first');
|
assertExists(blockCollection, 'Need to create a doc first');
|
||||||
const doc = blockCollection.getStore();
|
const doc = blockCollection.getStore();
|
||||||
const editor = new AffineEditorContainer();
|
const editor = new TestAffineEditorContainer();
|
||||||
editor.doc = doc;
|
editor.doc = doc;
|
||||||
editor.mode = mode;
|
editor.mode = mode;
|
||||||
editor.pageSpecs = [
|
editor.pageSpecs = [
|
||||||
@@ -127,12 +127,12 @@ export function cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
const editor: AffineEditorContainer;
|
const editor: TestAffineEditorContainer;
|
||||||
const doc: Store;
|
const doc: Store;
|
||||||
const collection: TestWorkspace;
|
const collection: TestWorkspace;
|
||||||
const job: Transformer;
|
const job: Transformer;
|
||||||
interface Window {
|
interface Window {
|
||||||
editor: AffineEditorContainer;
|
editor: TestAffineEditorContainer;
|
||||||
doc: Store;
|
doc: Store;
|
||||||
job: Transformer;
|
job: Transformer;
|
||||||
collection: TestWorkspace;
|
collection: TestWorkspace;
|
||||||
+2
-2
@@ -12,7 +12,7 @@ import { property } from 'lit/decorators.js';
|
|||||||
import { keyed } from 'lit/directives/keyed.js';
|
import { keyed } from 'lit/directives/keyed.js';
|
||||||
import { when } from 'lit/directives/when.js';
|
import { when } from 'lit/directives/when.js';
|
||||||
|
|
||||||
export class AffineEditorContainer extends SignalWatcher(
|
export class TestAffineEditorContainer extends SignalWatcher(
|
||||||
WithDisposable(ShadowlessElement)
|
WithDisposable(ShadowlessElement)
|
||||||
) {
|
) {
|
||||||
static override styles = css`
|
static override styles = css`
|
||||||
@@ -215,6 +215,6 @@ export class AffineEditorContainer extends SignalWatcher(
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
'affine-editor-container': AffineEditorContainer;
|
'affine-editor-container': TestAffineEditorContainer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,7 @@
|
|||||||
|
import '@blocksuite/blocks/effects';
|
||||||
|
|
||||||
|
import { TestAffineEditorContainer } from './editors/index.js';
|
||||||
|
|
||||||
|
export function effects() {
|
||||||
|
customElements.define('affine-editor-container', TestAffineEditorContainer);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './editors';
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -15,7 +15,7 @@ import {
|
|||||||
titleMiddleware,
|
titleMiddleware,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { type DocSnapshot, Transformer } from '@blocksuite/store';
|
import { type DocSnapshot, Transformer } from '@blocksuite/store';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import type SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
import type SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
|
||||||
@@ -284,7 +284,7 @@ export class AdaptersPanel extends WithDisposable(ShadowlessElement) {
|
|||||||
private accessor _plainTextContent = '';
|
private accessor _plainTextContent = '';
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { customElement, property, state } from 'lit/decorators.js';
|
import { customElement, property, state } from 'lit/decorators.js';
|
||||||
@@ -59,7 +59,7 @@ export class CustomFramePanel extends WithDisposable(ShadowlessElement) {
|
|||||||
private accessor _show = false;
|
private accessor _show = false;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { customElement, property, state } from 'lit/decorators.js';
|
import { customElement, property, state } from 'lit/decorators.js';
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export class CustomOutlinePanel extends WithDisposable(ShadowlessElement) {
|
|||||||
private accessor _show = false;
|
private accessor _show = false;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { css, html, LitElement, nothing } from 'lit';
|
import { css, html, LitElement, nothing } from 'lit';
|
||||||
import { customElement, property, state } from 'lit/decorators.js';
|
import { customElement, property, state } from 'lit/decorators.js';
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export class CustomOutlineViewer extends WithDisposable(LitElement) {
|
|||||||
private accessor _show = false;
|
private accessor _show = false;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor toggleOutlinePanel: (() => void) | null = null;
|
accessor toggleOutlinePanel: (() => void) | null = null;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
GenerateDocUrlProvider,
|
GenerateDocUrlProvider,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import type { Doc, Workspace } from '@blocksuite/store';
|
import type { Doc, Workspace } from '@blocksuite/store';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { customElement, property } from 'lit/decorators.js';
|
import { customElement, property } from 'lit/decorators.js';
|
||||||
@@ -163,7 +163,7 @@ export class DocsPanel extends WithDisposable(ShadowlessElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor onClose!: () => void;
|
accessor onClose!: () => void;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import {
|
|||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { SerializedXYWH } from '@blocksuite/global/utils';
|
import type { SerializedXYWH } from '@blocksuite/global/utils';
|
||||||
import type { DeltaInsert } from '@blocksuite/inline/types';
|
import type { DeltaInsert } from '@blocksuite/inline/types';
|
||||||
import { AffineEditorContainer, type CommentPanel } from '@blocksuite/presets';
|
import { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { Text, Transformer, type Workspace } from '@blocksuite/store';
|
import { Text, Transformer, type Workspace } from '@blocksuite/store';
|
||||||
import type { SlDropdown } from '@shoelace-style/shoelace';
|
import type { SlDropdown } from '@shoelace-style/shoelace';
|
||||||
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path.js';
|
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path.js';
|
||||||
@@ -57,6 +57,7 @@ import { customElement, property, query, state } from 'lit/decorators.js';
|
|||||||
import * as lz from 'lz-string';
|
import * as lz from 'lz-string';
|
||||||
import type { Pane } from 'tweakpane';
|
import type { Pane } from 'tweakpane';
|
||||||
|
|
||||||
|
import type { CommentPanel } from '../../comment/index.js';
|
||||||
import { createTestEditor } from '../../starter/utils/extensions.js';
|
import { createTestEditor } from '../../starter/utils/extensions.js';
|
||||||
import { mockEdgelessTheme } from '../mock-services.js';
|
import { mockEdgelessTheme } from '../mock-services.js';
|
||||||
import { AdaptersPanel } from './adapters-panel.js';
|
import { AdaptersPanel } from './adapters-panel.js';
|
||||||
@@ -647,7 +648,7 @@ export class StarterDebugMenu extends ShadowlessElement {
|
|||||||
const newEditor = createTestEditor(this.doc, this.collection);
|
const newEditor = createTestEditor(this.doc, this.collection);
|
||||||
app.append(newEditor);
|
app.append(newEditor);
|
||||||
app.childNodes.forEach(child => {
|
app.childNodes.forEach(child => {
|
||||||
if (child instanceof AffineEditorContainer) {
|
if (child instanceof TestAffineEditorContainer) {
|
||||||
child.style.flex = '1';
|
child.style.flex = '1';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1014,7 +1015,7 @@ export class StarterDebugMenu extends ShadowlessElement {
|
|||||||
accessor docsPanel!: DocsPanel;
|
accessor docsPanel!: DocsPanel;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor framePanel!: CustomFramePanel;
|
accessor framePanel!: CustomFramePanel;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { DocModeProvider } from '@blocksuite/blocks';
|
import type { DocModeProvider } from '@blocksuite/blocks';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import type { Doc, Store, Workspace } from '@blocksuite/store';
|
import type { Doc, Store, Workspace } from '@blocksuite/store';
|
||||||
|
|
||||||
export function getDocFromUrlParams(collection: Workspace, url: URL) {
|
export function getDocFromUrlParams(collection: Workspace, url: URL) {
|
||||||
@@ -40,7 +40,7 @@ export function setDocModeFromUrlParams(
|
|||||||
|
|
||||||
export function listenHashChange(
|
export function listenHashChange(
|
||||||
collection: Workspace,
|
collection: Workspace,
|
||||||
editor: AffineEditorContainer
|
editor: TestAffineEditorContainer
|
||||||
) {
|
) {
|
||||||
const panel = document.querySelector('docs-panel');
|
const panel = document.querySelector('docs-panel');
|
||||||
window.addEventListener('hashchange', () => {
|
window.addEventListener('hashchange', () => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
toast,
|
toast,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
import { Slot } from '@blocksuite/global/utils';
|
import { Slot } from '@blocksuite/global/utils';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { type Workspace } from '@blocksuite/store';
|
import { type Workspace } from '@blocksuite/store';
|
||||||
import { Signal, signal } from '@preact/signals-core';
|
import { Signal, signal } from '@preact/signals-core';
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export function removeModeFromStorage(docId: string) {
|
|||||||
const DEFAULT_MODE: DocMode = 'page';
|
const DEFAULT_MODE: DocMode = 'page';
|
||||||
const slotMap = new Map<string, Slot<DocMode>>();
|
const slotMap = new Map<string, Slot<DocMode>>();
|
||||||
|
|
||||||
export function mockDocModeService(editor: AffineEditorContainer) {
|
export function mockDocModeService(editor: TestAffineEditorContainer) {
|
||||||
const getEditorModeCallback: () => DocMode = () => editor.mode;
|
const getEditorModeCallback: () => DocMode = () => editor.mode;
|
||||||
const setEditorModeCallback: (mode: DocMode) => void = mode =>
|
const setEditorModeCallback: (mode: DocMode) => void = mode =>
|
||||||
editor.switchEditor(mode);
|
editor.switchEditor(mode);
|
||||||
@@ -78,7 +78,7 @@ export function mockDocModeService(editor: AffineEditorContainer) {
|
|||||||
return docModeService;
|
return docModeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mockNotificationService(editor: AffineEditorContainer) {
|
export function mockNotificationService(editor: TestAffineEditorContainer) {
|
||||||
const notificationService: NotificationService = {
|
const notificationService: NotificationService = {
|
||||||
toast: (message, options) => {
|
toast: (message, options) => {
|
||||||
toast(editor.host!, message, options?.duration);
|
toast(editor.host!, message, options?.duration);
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { ShadowlessElement, TextSelection } from '@blocksuite/block-std';
|
import { ShadowlessElement, TextSelection } from '@blocksuite/block-std';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
|
|
||||||
import type { AffineEditorContainer } from '../../editors/editor-container.js';
|
|
||||||
import { CommentInput } from './comment-input.js';
|
import { CommentInput } from './comment-input.js';
|
||||||
import { CommentManager } from './comment-manager.js';
|
import { CommentManager } from './comment-manager.js';
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ export class CommentPanel extends WithDisposable(ShadowlessElement) {
|
|||||||
private accessor _container!: HTMLDivElement;
|
private accessor _container!: HTMLDivElement;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editor!: AffineEditorContainer;
|
accessor editor!: TestAffineEditorContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { CommentInput } from './comment-input.js';
|
||||||
|
import { CommentPanel } from './comment-panel.js';
|
||||||
|
|
||||||
|
export function effects() {
|
||||||
|
customElements.define('comment-input', CommentInput);
|
||||||
|
customElements.define('comment-panel', CommentPanel);
|
||||||
|
}
|
||||||
File renamed without changes.
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import type { EditorHost } from '@blocksuite/block-std';
|
import type { EditorHost } from '@blocksuite/block-std';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||||
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';
|
||||||
import type * as Y from 'yjs';
|
import type * as Y from 'yjs';
|
||||||
@@ -12,7 +12,7 @@ declare global {
|
|||||||
];
|
];
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
editor: AffineEditorContainer;
|
editor: TestAffineEditorContainer;
|
||||||
doc: Blocks;
|
doc: Blocks;
|
||||||
collection: Workspace;
|
collection: Workspace;
|
||||||
blockSchemas: z.infer<typeof BlockSchema>[];
|
blockSchemas: z.infer<typeof BlockSchema>[];
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import * as blockStd from '@blocksuite/block-std';
|
|||||||
import * as blocks from '@blocksuite/blocks';
|
import * as blocks from '@blocksuite/blocks';
|
||||||
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
|
import { effects as blocksEffects } from '@blocksuite/blocks/effects';
|
||||||
import * as globalUtils from '@blocksuite/global/utils';
|
import * as globalUtils from '@blocksuite/global/utils';
|
||||||
import * as editor from '@blocksuite/presets';
|
import * as editor from '@blocksuite/integration-test';
|
||||||
import { effects as presetsEffects } from '@blocksuite/presets/effects';
|
import { effects as presetsEffects } from '@blocksuite/integration-test/effects';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||||
import * as store from '@blocksuite/store';
|
import * as store from '@blocksuite/store';
|
||||||
|
|
||||||
import { setupEdgelessTemplate } from '../_common/setup.js';
|
import { setupEdgelessTemplate } from '../_common/setup.js';
|
||||||
|
import { effects as commentEffects } from '../comment/effects.js';
|
||||||
import {
|
import {
|
||||||
createStarterDocCollection,
|
createStarterDocCollection,
|
||||||
initStarterDocCollection,
|
initStarterDocCollection,
|
||||||
@@ -19,6 +20,7 @@ import { prepareTestApp } from './utils/test';
|
|||||||
|
|
||||||
blocksEffects();
|
blocksEffects();
|
||||||
presetsEffects();
|
presetsEffects();
|
||||||
|
commentEffects();
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
if (window.collection) return;
|
if (window.collection) return;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { CommentPanel } from '@blocksuite/presets';
|
|
||||||
import type { Store, Workspace } from '@blocksuite/store';
|
import type { Store, Workspace } from '@blocksuite/store';
|
||||||
|
|
||||||
import { AttachmentViewerPanel } from '../../_common/components/attachment-viewer-panel';
|
import { AttachmentViewerPanel } from '../../_common/components/attachment-viewer-panel';
|
||||||
@@ -8,6 +7,7 @@ import { CustomOutlineViewer } from '../../_common/components/custom-outline-vie
|
|||||||
import { DocsPanel } from '../../_common/components/docs-panel';
|
import { DocsPanel } from '../../_common/components/docs-panel';
|
||||||
import { LeftSidePanel } from '../../_common/components/left-side-panel';
|
import { LeftSidePanel } from '../../_common/components/left-side-panel';
|
||||||
import { StarterDebugMenu } from '../../_common/components/starter-debug-menu';
|
import { StarterDebugMenu } from '../../_common/components/starter-debug-menu';
|
||||||
|
import { CommentPanel } from '../../comment/comment-panel';
|
||||||
import { createTestEditor } from './extensions';
|
import { createTestEditor } from './extensions';
|
||||||
|
|
||||||
export async function createTestApp(doc: Store, collection: Workspace) {
|
export async function createTestApp(doc: Store, collection: Workspace) {
|
||||||
|
|||||||
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user