mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
feat(editor): rich text package (#10689)
This PR performs a significant architectural refactoring by extracting rich text functionality into a dedicated package. Here are the key changes: 1. **New Package Creation** - Created a new package `@blocksuite/affine-rich-text` to house rich text related functionality - Moved rich text components, utilities, and types from `@blocksuite/affine-components` to this new package 2. **Dependency Updates** - Updated multiple block packages to include the new `@blocksuite/affine-rich-text` as a direct dependency: - block-callout - block-code - block-database - block-edgeless-text - block-embed - block-list - block-note - block-paragraph 3. **Import Path Updates** - Refactored all imports that previously referenced rich text functionality from `@blocksuite/affine-components/rich-text` to now use `@blocksuite/affine-rich-text` - Updated imports for components like: - DefaultInlineManagerExtension - RichText types and interfaces - Text manipulation utilities (focusTextModel, textKeymap, etc.) - Reference node components and providers 4. **Build Configuration Updates** - Added references to the new rich text package in the `tsconfig.json` files of all affected packages - Maintained workspace dependencies using the `workspace:*` version specifier The primary motivation appears to be: 1. Better separation of concerns by isolating rich text functionality 2. Improved maintainability through more modular package structure 3. Clearer dependencies between packages 4. Potential for better tree-shaking and bundle optimization This is primarily an architectural improvement that should make the codebase more maintainable and better organized.
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import type {
|
||||
RichTextCell,
|
||||
RichTextCellEditing,
|
||||
} from '@blocksuite/affine-block-database';
|
||||
import type { RichTextCell, RichTextCellEditing } from '@blocksuite/blocks';
|
||||
import { ZERO_WIDTH_SPACE } from '@blocksuite/inline';
|
||||
import { expect, type Locator, type Page } from '@playwright/test';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { EdgelessTextBlockComponent } from '@blocksuite/affine-block-edgeless-text';
|
||||
import type { EdgelessTextBlockComponent } from '@blocksuite/blocks';
|
||||
import { Bound } from '@blocksuite/global/gfx';
|
||||
import { expect, type Page } from '@playwright/test';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseBlockModel } from '@blocksuite/affine-model';
|
||||
import type { DatabaseBlockModel } from '@blocksuite/blocks';
|
||||
import { expect, type Page } from '@playwright/test';
|
||||
|
||||
import { switchEditorMode } from './utils/actions/edgeless.js';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import './declare-test-window.js';
|
||||
|
||||
import type { EdgelessNoteBackground } from '@blocksuite/affine-block-note';
|
||||
import type {
|
||||
BlockComponent,
|
||||
EditorHost,
|
||||
@@ -8,6 +7,7 @@ import type {
|
||||
} from '@blocksuite/block-std';
|
||||
import type {
|
||||
AffineInlineEditor,
|
||||
EdgelessNoteBackground,
|
||||
NoteBlockModel,
|
||||
RichText,
|
||||
RootBlockModel,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { EditorHost } from '@blocksuite/block-std';
|
||||
import type * as Effects from '@blocksuite/blocks/effects';
|
||||
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
|
||||
import type { Store, Transformer, Workspace } from '@blocksuite/store';
|
||||
|
||||
declare const _GLOBAL_: typeof Effects;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
/** Available on playground window
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
MindmapElementModel,
|
||||
MindmapNode,
|
||||
ShapeElementModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
} from '@blocksuite/blocks';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
import { clickView } from './actions/click.js';
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
"test": "yarn playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/affine-model": "workspace:*",
|
||||
"@blocksuite/affine-shared": "workspace:*",
|
||||
"@blocksuite/block-std": "workspace:*",
|
||||
"@blocksuite/blocks": "workspace:*",
|
||||
"@blocksuite/global": "workspace:*",
|
||||
"@blocksuite/inline": "workspace:*",
|
||||
"@blocksuite/integration-test": "workspace:*",
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
},
|
||||
"include": ["./e2e"],
|
||||
"references": [
|
||||
{ "path": "../affine/components" },
|
||||
{ "path": "../affine/model" },
|
||||
{ "path": "../affine/shared" },
|
||||
{ "path": "../blocks" },
|
||||
{ "path": "../framework/block-std" },
|
||||
{ "path": "../framework/global" },
|
||||
{ "path": "../framework/inline" },
|
||||
|
||||
Reference in New Issue
Block a user