refactor(editor): merge inline to std (#11025)

This commit is contained in:
Saul-Mirone
2025-03-20 05:46:56 +00:00
parent 5aa36efab0
commit 92d76ba571
176 changed files with 142 additions and 534 deletions

View File

@@ -1,5 +1,4 @@
import type { RichTextCell } from '@blocksuite/affine/blocks/database';
import { ZERO_WIDTH_SPACE } from '@blocksuite/affine/inline';
import { expect, type Locator, type Page } from '@playwright/test';
import {
@@ -13,6 +12,7 @@ import {
getEditorLocator,
waitNextFrame,
} from '../utils/actions/misc.js';
import { ZERO_WIDTH_SPACE } from '../utils/inline-editor.js';
export async function press(page: Page, content: string) {
await page.keyboard.press(content, { delay: 50 });

View File

@@ -1,8 +1,11 @@
import type {
InlineEditor,
InlineRange,
} from '@blocksuite/affine/block-std/inline';
import type { DeltaInsert } from '@blocksuite/affine/store';
import type { InlineEditor, InlineRange } from '@blocksuite/inline';
import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import { expect, type Page, test } from '@playwright/test';
import { ZERO_WIDTH_SPACE } from '../utils/inline-editor.js';
// FIXME(mirone): copy paste from framework/inline/__tests__/utils.ts
const defaultPlaygroundURL = new URL(
`http://localhost:${process.env.CI ? 4173 : 5173}/`

View File

@@ -1,4 +1,3 @@
import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
import { expect } from '@playwright/test';
import {
@@ -25,6 +24,7 @@ import {
assertRichTextInlineDeltas,
assertRichTextInlineRange,
} from '../utils/asserts.js';
import { ZERO_WIDTH_SPACE } from '../utils/inline-editor.js';
import { test } from '../utils/playwright.js';
test('add inline latex at the start of line', async ({ page }) => {

View File

@@ -1,6 +1,9 @@
import '../declare-test-window.js';
import type { InlineRange, InlineRootElement } from '@blocksuite/affine/inline';
import type {
InlineRange,
InlineRootElement,
} from '@blocksuite/affine/block-std/inline';
import type { DatabaseBlockModel, ListType } from '@blocksuite/affine/model';
import type { RichText } from '@blocksuite/affine/rich-text';
import type { BlockModel } from '@blocksuite/affine/store';

View File

@@ -5,8 +5,8 @@ import type {
EditorHost,
TextSelection,
} from '@blocksuite/affine/block-std';
import type { InlineRootElement } from '@blocksuite/affine/block-std/inline';
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,

View File

@@ -20,3 +20,10 @@ export async function getStringFromRichText(
[index]
);
}
// Why? we can't import from `@blocksuite/affine/block-std/inline` because playwright will throw an error
export const ZERO_WIDTH_SPACE = /Apple Computer/.test(
globalThis.navigator?.vendor
)
? '\u200C'
: '\u200B';