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:
Saul-Mirone
2025-03-07 04:08:47 +00:00
parent 8da12025af
commit fe5f0f62ec
176 changed files with 503 additions and 180 deletions
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,7 +1,7 @@
import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption'; import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
import { createLitPortal } from '@blocksuite/affine-components/portal'; import { createLitPortal } from '@blocksuite/affine-components/portal';
import { DefaultInlineManagerExtension } from '@blocksuite/affine-components/rich-text';
import { type CalloutBlockModel } from '@blocksuite/affine-model'; import { type CalloutBlockModel } from '@blocksuite/affine-model';
import { DefaultInlineManagerExtension } from '@blocksuite/affine-rich-text';
import { NOTE_SELECTOR } from '@blocksuite/affine-shared/consts'; import { NOTE_SELECTOR } from '@blocksuite/affine-shared/consts';
import { import {
DocModeProvider, DocModeProvider,
@@ -9,6 +9,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,4 +1,4 @@
import { deleteTextCommand } from '@blocksuite/affine-components/rich-text'; import { deleteTextCommand } from '@blocksuite/affine-rich-text';
import { import {
HtmlAdapter, HtmlAdapter,
pasteMiddleware, pasteMiddleware,
@@ -10,7 +10,7 @@ import {
LinkInlineSpecExtension, LinkInlineSpecExtension,
StrikeInlineSpecExtension, StrikeInlineSpecExtension,
UnderlineInlineSpecExtension, UnderlineInlineSpecExtension,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { html } from 'lit'; import { html } from 'lit';
import { z } from 'zod'; import { z } from 'zod';
@@ -1,5 +1,5 @@
import { textKeymap } from '@blocksuite/affine-components/rich-text';
import { CodeBlockSchema, ColorScheme } from '@blocksuite/affine-model'; import { CodeBlockSchema, ColorScheme } from '@blocksuite/affine-model';
import { textKeymap } from '@blocksuite/affine-rich-text';
import { ThemeProvider } from '@blocksuite/affine-shared/services'; import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { BlockService } from '@blocksuite/block-std'; import { BlockService } from '@blocksuite/block-std';
import { type Signal, signal } from '@preact/signals-core'; import { type Signal, signal } from '@preact/signals-core';
@@ -1,9 +1,6 @@
import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption'; import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
import {
focusTextModel,
type RichText,
} from '@blocksuite/affine-components/rich-text';
import type { CodeBlockModel } from '@blocksuite/affine-model'; import type { CodeBlockModel } from '@blocksuite/affine-model';
import { focusTextModel, type RichText } from '@blocksuite/affine-rich-text';
import { BRACKET_PAIRS, NOTE_SELECTOR } from '@blocksuite/affine-shared/consts'; import { BRACKET_PAIRS, NOTE_SELECTOR } from '@blocksuite/affine-shared/consts';
import { import {
DocModeProvider, DocModeProvider,
@@ -1,4 +1,4 @@
import { affineTextStyles } from '@blocksuite/affine-components/rich-text'; import { affineTextStyles } from '@blocksuite/affine-rich-text';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types'; import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { type DeltaInsert, ZERO_WIDTH_SPACE } from '@blocksuite/inline'; import { type DeltaInsert, ZERO_WIDTH_SPACE } from '@blocksuite/inline';
@@ -9,6 +9,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/affine-widget-drag-handle": "workspace:*", "@blocksuite/affine-widget-drag-handle": "workspace:*",
"@blocksuite/affine-widget-slash-menu": "workspace:*", "@blocksuite/affine-widget-slash-menu": "workspace:*",
@@ -1,4 +1,4 @@
import { DefaultInlineManagerExtension } from '@blocksuite/affine-components/rich-text'; import { DefaultInlineManagerExtension } from '@blocksuite/affine-rich-text';
import type { EditorHost } from '@blocksuite/block-std'; import type { EditorHost } from '@blocksuite/block-std';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import type { DetailSlotProps } from '@blocksuite/data-view'; import type { DetailSlotProps } from '@blocksuite/data-view';
@@ -1,4 +1,4 @@
import { RefNodeSlotsProvider } from '@blocksuite/affine-components/rich-text'; import { RefNodeSlotsProvider } from '@blocksuite/affine-rich-text';
import { ParseDocUrlProvider } from '@blocksuite/affine-shared/services'; import { ParseDocUrlProvider } from '@blocksuite/affine-shared/services';
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme'; import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
import { import {
@@ -1,8 +1,8 @@
import type { import type {
AffineInlineEditor, AffineInlineEditor,
RichText, RichText,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { DefaultInlineManagerExtension } from '@blocksuite/affine-components/rich-text'; import { DefaultInlineManagerExtension } from '@blocksuite/affine-rich-text';
import { import {
ParseDocUrlProvider, ParseDocUrlProvider,
TelemetryProvider, TelemetryProvider,
@@ -1,8 +1,8 @@
import type { RootBlockModel } from '@blocksuite/affine-model';
import { import {
DefaultInlineManagerExtension, DefaultInlineManagerExtension,
type RichText, type RichText,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import type { RootBlockModel } from '@blocksuite/affine-model';
import { import {
ParseDocUrlProvider, ParseDocUrlProvider,
TelemetryProvider, TelemetryProvider,
@@ -10,6 +10,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../widget-drag-handle" }, { "path": "../widget-drag-handle" },
{ "path": "../widget-slash-menu" }, { "path": "../widget-slash-menu" },
@@ -16,6 +16,7 @@
"@blocksuite/affine-block-surface": "workspace:*", "@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -2,7 +2,7 @@ import {
EdgelessCRUDIdentifier, EdgelessCRUDIdentifier,
getSurfaceBlock, getSurfaceBlock,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import { focusTextModel } from '@blocksuite/affine-components/rich-text'; import { focusTextModel } from '@blocksuite/affine-rich-text';
import type { Command } from '@blocksuite/block-std'; import type { Command } from '@blocksuite/block-std';
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx'; import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
import { Bound } from '@blocksuite/global/gfx'; import { Bound } from '@blocksuite/global/gfx';
@@ -1,10 +1,10 @@
import { TextUtils } from '@blocksuite/affine-block-surface'; import { TextUtils } from '@blocksuite/affine-block-surface';
import { formatBlockCommand } from '@blocksuite/affine-components/rich-text';
import { import {
type EdgelessTextBlockModel, type EdgelessTextBlockModel,
ListBlockModel, ListBlockModel,
ParagraphBlockModel, ParagraphBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { formatBlockCommand } from '@blocksuite/affine-rich-text';
import { ThemeProvider } from '@blocksuite/affine-shared/services'; import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { matchModels } from '@blocksuite/affine-shared/utils'; import { matchModels } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/block-std'; import type { BlockComponent } from '@blocksuite/block-std';
@@ -10,6 +10,7 @@
{ "path": "../block-surface" }, { "path": "../block-surface" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -16,6 +16,7 @@
"@blocksuite/affine-block-surface": "workspace:*", "@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,11 +1,11 @@
import { SurfaceBlockModel } from '@blocksuite/affine-block-surface'; import { SurfaceBlockModel } from '@blocksuite/affine-block-surface';
import { isPeekable, Peekable } from '@blocksuite/affine-components/peek'; import { isPeekable, Peekable } from '@blocksuite/affine-components/peek';
import { RefNodeSlotsProvider } from '@blocksuite/affine-components/rich-text';
import type { import type {
DocMode, DocMode,
EmbedLinkedDocModel, EmbedLinkedDocModel,
EmbedLinkedDocStyles, EmbedLinkedDocStyles,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { RefNodeSlotsProvider } from '@blocksuite/affine-rich-text';
import { import {
EMBED_CARD_HEIGHT, EMBED_CARD_HEIGHT,
EMBED_CARD_WIDTH, EMBED_CARD_WIDTH,
@@ -1,8 +1,4 @@
import { Peekable } from '@blocksuite/affine-components/peek'; import { Peekable } from '@blocksuite/affine-components/peek';
import {
type DocLinkClickedEvent,
RefNodeSlotsProvider,
} from '@blocksuite/affine-components/rich-text';
import { import {
type AliasInfo, type AliasInfo,
type DocMode, type DocMode,
@@ -10,6 +6,10 @@ import {
NoteDisplayMode, NoteDisplayMode,
type ReferenceInfo, type ReferenceInfo,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import {
type DocLinkClickedEvent,
RefNodeSlotsProvider,
} from '@blocksuite/affine-rich-text';
import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts'; import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts';
import { import {
DocDisplayMetaProvider, DocDisplayMetaProvider,
@@ -10,6 +10,7 @@
{ "path": "../block-surface" }, { "path": "../block-surface" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,5 +1,5 @@
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import { ListBlockModel } from '@blocksuite/affine-model'; import { ListBlockModel } from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import { matchModels } from '@blocksuite/affine-shared/utils'; import { matchModels } from '@blocksuite/affine-shared/utils';
import type { Command } from '@blocksuite/block-std'; import type { Command } from '@blocksuite/block-std';
@@ -1,5 +1,5 @@
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import { ListBlockModel } from '@blocksuite/affine-model'; import { ListBlockModel } from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import { import {
getNextContinuousNumberedLists, getNextContinuousNumberedLists,
matchModels, matchModels,
@@ -2,12 +2,12 @@ import '@blocksuite/affine-shared/commands';
import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption'; import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
import { playCheckAnimation } from '@blocksuite/affine-components/icons'; import { playCheckAnimation } from '@blocksuite/affine-components/icons';
import { TOGGLE_BUTTON_PARENT_CLASS } from '@blocksuite/affine-components/toggle-button';
import type { ListBlockModel } from '@blocksuite/affine-model';
import { import {
DefaultInlineManagerExtension, DefaultInlineManagerExtension,
type RichText, type RichText,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { TOGGLE_BUTTON_PARENT_CLASS } from '@blocksuite/affine-components/toggle-button';
import type { ListBlockModel } from '@blocksuite/affine-model';
import { import {
BLOCK_CHILDREN_CONTAINER_PADDING_LEFT, BLOCK_CHILDREN_CONTAINER_PADDING_LEFT,
NOTE_SELECTOR, NOTE_SELECTOR,
@@ -1,8 +1,5 @@
import {
markdownInput,
textKeymap,
} from '@blocksuite/affine-components/rich-text';
import { ListBlockSchema } from '@blocksuite/affine-model'; import { ListBlockSchema } from '@blocksuite/affine-model';
import { markdownInput, textKeymap } from '@blocksuite/affine-rich-text';
import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands'; import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands';
import { KeymapExtension, TextSelection } from '@blocksuite/block-std'; import { KeymapExtension, TextSelection } from '@blocksuite/block-std';
import { IS_MAC } from '@blocksuite/global/env'; import { IS_MAC } from '@blocksuite/global/env';
@@ -9,6 +9,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -16,7 +16,9 @@
"@blocksuite/affine-block-embed": "workspace:*", "@blocksuite/affine-block-embed": "workspace:*",
"@blocksuite/affine-block-surface": "workspace:*", "@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-fragment-doc-title": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,13 +1,13 @@
import {
asyncSetInlineRange,
focusTextModel,
onModelTextUpdated,
} from '@blocksuite/affine-components/rich-text';
import { import {
CodeBlockModel, CodeBlockModel,
ListBlockModel, ListBlockModel,
ParagraphBlockModel, ParagraphBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import {
asyncSetInlineRange,
focusTextModel,
onModelTextUpdated,
} from '@blocksuite/affine-rich-text';
import { import {
getBlockSelectionsCommand, getBlockSelectionsCommand,
getSelectedBlocksCommand, getSelectedBlocksCommand,
@@ -1,5 +1,5 @@
import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface'; import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
import type { DocTitle } from '@blocksuite/affine-components/doc-title'; import type { DocTitle } from '@blocksuite/affine-fragment-doc-title';
import { NoteDisplayMode } from '@blocksuite/affine-model'; import { NoteDisplayMode } from '@blocksuite/affine-model';
import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts'; import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts';
import { TelemetryProvider } from '@blocksuite/affine-shared/services'; import { TelemetryProvider } from '@blocksuite/affine-shared/services';
@@ -1,4 +1,3 @@
import { textConversionConfigs } from '@blocksuite/affine-components/rich-text';
import { import {
CodeBlockModel, CodeBlockModel,
ListBlockModel, ListBlockModel,
@@ -6,6 +5,7 @@ import {
NoteBlockSchema, NoteBlockSchema,
ParagraphBlockModel, ParagraphBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { textConversionConfigs } from '@blocksuite/affine-rich-text';
import { import {
focusBlockEnd, focusBlockEnd,
focusBlockStart, focusBlockStart,
@@ -10,7 +10,9 @@
{ "path": "../block-embed" }, { "path": "../block-embed" },
{ "path": "../block-surface" }, { "path": "../block-surface" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../fragment-doc-title" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,4 +1,4 @@
import { focusTextModel } from '@blocksuite/affine-components/rich-text'; import { focusTextModel } from '@blocksuite/affine-rich-text';
import { type Command, TextSelection } from '@blocksuite/block-std'; import { type Command, TextSelection } from '@blocksuite/block-std';
/** /**
@@ -1,4 +1,4 @@
import { focusTextModel } from '@blocksuite/affine-components/rich-text'; import { focusTextModel } from '@blocksuite/affine-rich-text';
import { getLastNoteBlock } from '@blocksuite/affine-shared/utils'; import { getLastNoteBlock } from '@blocksuite/affine-shared/utils';
import type { Command } from '@blocksuite/block-std'; import type { Command } from '@blocksuite/block-std';
import { Text } from '@blocksuite/store'; import { Text } from '@blocksuite/store';
@@ -1,8 +1,8 @@
import { ParagraphBlockModel } from '@blocksuite/affine-model';
import { import {
focusTextModel, focusTextModel,
getInlineEditorByModel, getInlineEditorByModel,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { ParagraphBlockModel } from '@blocksuite/affine-model';
import { matchModels } from '@blocksuite/affine-shared/utils'; import { matchModels } from '@blocksuite/affine-shared/utils';
import { type Command, TextSelection } from '@blocksuite/block-std'; import { type Command, TextSelection } from '@blocksuite/block-std';
@@ -1,10 +1,10 @@
import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption'; import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
import { TOGGLE_BUTTON_PARENT_CLASS } from '@blocksuite/affine-components/toggle-button';
import type { ParagraphBlockModel } from '@blocksuite/affine-model';
import { import {
DefaultInlineManagerExtension, DefaultInlineManagerExtension,
type RichText, type RichText,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { TOGGLE_BUTTON_PARENT_CLASS } from '@blocksuite/affine-components/toggle-button';
import type { ParagraphBlockModel } from '@blocksuite/affine-model';
import { import {
BLOCK_CHILDREN_CONTAINER_PADDING_LEFT, BLOCK_CHILDREN_CONTAINER_PADDING_LEFT,
NOTE_SELECTOR, NOTE_SELECTOR,
@@ -1,14 +1,14 @@
import {
focusTextModel,
getInlineEditorByModel,
markdownInput,
textKeymap,
} from '@blocksuite/affine-components/rich-text';
import { import {
CalloutBlockModel, CalloutBlockModel,
ParagraphBlockModel, ParagraphBlockModel,
ParagraphBlockSchema, ParagraphBlockSchema,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import {
focusTextModel,
getInlineEditorByModel,
markdownInput,
textKeymap,
} from '@blocksuite/affine-rich-text';
import { import {
calculateCollapsedSiblings, calculateCollapsedSiblings,
matchModels, matchModels,
@@ -1,7 +1,3 @@
import {
asyncSetInlineRange,
focusTextModel,
} from '@blocksuite/affine-components/rich-text';
import { import {
AttachmentBlockModel, AttachmentBlockModel,
BookmarkBlockModel, BookmarkBlockModel,
@@ -14,6 +10,10 @@ import {
ParagraphBlockModel, ParagraphBlockModel,
type RootBlockModel, type RootBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import {
asyncSetInlineRange,
focusTextModel,
} from '@blocksuite/affine-rich-text';
import { EMBED_BLOCK_MODEL_LIST } from '@blocksuite/affine-shared/consts'; import { EMBED_BLOCK_MODEL_LIST } from '@blocksuite/affine-shared/consts';
import type { ExtendedModel } from '@blocksuite/affine-shared/types'; import type { ExtendedModel } from '@blocksuite/affine-shared/types';
import { import {
@@ -9,6 +9,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -29,7 +29,9 @@
"@blocksuite/affine-block-surface-ref": "workspace:*", "@blocksuite/affine-block-surface-ref": "workspace:*",
"@blocksuite/affine-block-table": "workspace:*", "@blocksuite/affine-block-table": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-fragment-doc-title": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/affine-widget-drag-handle": "workspace:*", "@blocksuite/affine-widget-drag-handle": "workspace:*",
"@blocksuite/affine-widget-edgeless-auto-connect": "workspace:*", "@blocksuite/affine-widget-edgeless-auto-connect": "workspace:*",
@@ -1,4 +1,4 @@
import { deleteTextCommand } from '@blocksuite/affine-components/rich-text'; import { deleteTextCommand } from '@blocksuite/affine-rich-text';
import { import {
pasteMiddleware, pasteMiddleware,
replaceIdMiddleware, replaceIdMiddleware,
@@ -9,6 +9,7 @@ import {
promptDocTitle, promptDocTitle,
} from '@blocksuite/affine-block-embed'; } from '@blocksuite/affine-block-embed';
import { updateBlockType } from '@blocksuite/affine-block-note'; import { updateBlockType } from '@blocksuite/affine-block-note';
import { toast } from '@blocksuite/affine-components/toast';
import { import {
deleteTextCommand, deleteTextCommand,
formatBlockCommand, formatBlockCommand,
@@ -17,8 +18,7 @@ import {
isFormatSupported, isFormatSupported,
textConversionConfigs, textConversionConfigs,
textFormatConfigs, textFormatConfigs,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { toast } from '@blocksuite/affine-components/toast';
import { import {
copySelectedModelsCommand, copySelectedModelsCommand,
deleteSelectedModelsCommand, deleteSelectedModelsCommand,
@@ -2,8 +2,8 @@ import {
EdgelessCRUDIdentifier, EdgelessCRUDIdentifier,
TextUtils, TextUtils,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import type { RichText } from '@blocksuite/affine-components/rich-text';
import type { ConnectorElementModel } from '@blocksuite/affine-model'; import type { ConnectorElementModel } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { ThemeProvider } from '@blocksuite/affine-shared/services'; import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { almostEqual } from '@blocksuite/affine-shared/utils'; import { almostEqual } from '@blocksuite/affine-shared/utils';
import { import {
@@ -1,5 +1,5 @@
import type { RichText } from '@blocksuite/affine-components/rich-text';
import { FrameBlockModel } from '@blocksuite/affine-model'; import { FrameBlockModel } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { import {
AFFINE_FRAME_TITLE_WIDGET, AFFINE_FRAME_TITLE_WIDGET,
type AffineFrameTitleWidget, type AffineFrameTitleWidget,
@@ -3,8 +3,8 @@ import {
GROUP_TITLE_OFFSET, GROUP_TITLE_OFFSET,
GROUP_TITLE_PADDING, GROUP_TITLE_PADDING,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import type { RichText } from '@blocksuite/affine-components/rich-text';
import type { GroupElementModel } from '@blocksuite/affine-model'; import type { GroupElementModel } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { import {
RANGE_SYNC_EXCLUDE_ATTR, RANGE_SYNC_EXCLUDE_ATTR,
ShadowlessElement, ShadowlessElement,
@@ -2,9 +2,9 @@ import {
EdgelessCRUDIdentifier, EdgelessCRUDIdentifier,
TextUtils, TextUtils,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import type { RichText } from '@blocksuite/affine-components/rich-text';
import type { ShapeElementModel } from '@blocksuite/affine-model'; import type { ShapeElementModel } from '@blocksuite/affine-model';
import { MindmapElementModel, TextResizing } from '@blocksuite/affine-model'; import { MindmapElementModel, TextResizing } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { ThemeProvider } from '@blocksuite/affine-shared/services'; import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { getSelectedRect } from '@blocksuite/affine-shared/utils'; import { getSelectedRect } from '@blocksuite/affine-shared/utils';
import { import {
@@ -2,8 +2,8 @@ import {
EdgelessCRUDIdentifier, EdgelessCRUDIdentifier,
TextUtils, TextUtils,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import type { RichText } from '@blocksuite/affine-components/rich-text';
import type { TextElementModel } from '@blocksuite/affine-model'; import type { TextElementModel } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { ThemeProvider } from '@blocksuite/affine-shared/services'; import { ThemeProvider } from '@blocksuite/affine-shared/services';
import { getSelectedRect } from '@blocksuite/affine-shared/utils'; import { getSelectedRect } from '@blocksuite/affine-shared/utils';
import { import {
@@ -9,7 +9,6 @@ import {
isNoteBlock, isNoteBlock,
OverlayIdentifier, OverlayIdentifier,
} from '@blocksuite/affine-block-surface'; } from '@blocksuite/affine-block-surface';
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import type { import type {
EdgelessTextBlockModel, EdgelessTextBlockModel,
FrameBlockModel, FrameBlockModel,
@@ -22,6 +21,7 @@ import {
ShapeElementModel, ShapeElementModel,
TextElementModel, TextElementModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import { import {
FeatureFlagService, FeatureFlagService,
TelemetryProvider, TelemetryProvider,
@@ -1,5 +1,4 @@
import { appendParagraphCommand } from '@blocksuite/affine-block-paragraph'; import { appendParagraphCommand } from '@blocksuite/affine-block-paragraph';
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import { import {
CodeBlockModel, CodeBlockModel,
ListBlockModel, ListBlockModel,
@@ -8,6 +7,7 @@ import {
ParagraphBlockModel, ParagraphBlockModel,
type RootBlockModel, type RootBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import { PageViewportService } from '@blocksuite/affine-shared/services'; import { PageViewportService } from '@blocksuite/affine-shared/services';
import type { Viewport } from '@blocksuite/affine-shared/types'; import type { Viewport } from '@blocksuite/affine-shared/types';
import { import {
@@ -18,6 +18,8 @@ import {
import { getSurfaceBlock } from '@blocksuite/affine-block-surface'; import { getSurfaceBlock } from '@blocksuite/affine-block-surface';
import { insertSurfaceRefBlockCommand } from '@blocksuite/affine-block-surface-ref'; import { insertSurfaceRefBlockCommand } from '@blocksuite/affine-block-surface-ref';
import { toggleEmbedCardCreateModal } from '@blocksuite/affine-components/embed-card-modal'; import { toggleEmbedCardCreateModal } from '@blocksuite/affine-components/embed-card-modal';
import { toast } from '@blocksuite/affine-components/toast';
import type { FrameBlockModel } from '@blocksuite/affine-model';
import { import {
formatBlockCommand, formatBlockCommand,
formatNativeCommand, formatNativeCommand,
@@ -32,9 +34,7 @@ import {
toggleLink, toggleLink,
toggleStrike, toggleStrike,
toggleUnderline, toggleUnderline,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { toast } from '@blocksuite/affine-components/toast';
import type { FrameBlockModel } from '@blocksuite/affine-model';
import { import {
copySelectedModelsCommand, copySelectedModelsCommand,
deleteSelectedModelsCommand, deleteSelectedModelsCommand,
@@ -1,4 +1,4 @@
import { getDocTitleByEditorHost } from '@blocksuite/affine-components/doc-title'; import { getDocTitleByEditorHost } from '@blocksuite/affine-fragment-doc-title';
import type { RootBlockModel } from '@blocksuite/affine-model'; import type { RootBlockModel } from '@blocksuite/affine-model';
import { FeatureFlagService } from '@blocksuite/affine-shared/services'; import { FeatureFlagService } from '@blocksuite/affine-shared/services';
import { WidgetComponent } from '@blocksuite/block-std'; import { WidgetComponent } from '@blocksuite/block-std';
@@ -4,11 +4,11 @@ import {
LinkedEdgelessIcon, LinkedEdgelessIcon,
NewDocIcon, NewDocIcon,
} from '@blocksuite/affine-components/icons'; } from '@blocksuite/affine-components/icons';
import { toast } from '@blocksuite/affine-components/toast';
import { import {
type AffineInlineEditor, type AffineInlineEditor,
insertLinkedNode, insertLinkedNode,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { toast } from '@blocksuite/affine-components/toast';
import { import {
DocModeProvider, DocModeProvider,
TelemetryProvider, TelemetryProvider,
@@ -3,7 +3,7 @@ import type { IconButton } from '@blocksuite/affine-components/icon-button';
import { import {
cleanSpecifiedTail, cleanSpecifiedTail,
getTextContentFromInlineRange, getTextContentFromInlineRange,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { unsafeCSSVar } from '@blocksuite/affine-shared/theme'; import { unsafeCSSVar } from '@blocksuite/affine-shared/theme';
import { import {
createKeydownObserver, createKeydownObserver,
@@ -1,7 +1,7 @@
import { import {
cleanSpecifiedTail, cleanSpecifiedTail,
getTextContentFromInlineRange, getTextContentFromInlineRange,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import { VirtualKeyboardProvider } from '@blocksuite/affine-shared/services'; import { VirtualKeyboardProvider } from '@blocksuite/affine-shared/services';
import { import {
createKeydownObserver, createKeydownObserver,
@@ -23,7 +23,9 @@
{ "path": "../block-surface-ref" }, { "path": "../block-surface-ref" },
{ "path": "../block-table" }, { "path": "../block-table" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../fragment-doc-title" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../widget-drag-handle" }, { "path": "../widget-drag-handle" },
{ "path": "../widget-edgeless-auto-connect" }, { "path": "../widget-edgeless-auto-connect" },
@@ -15,6 +15,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,4 +1,3 @@
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
import { import {
DEFAULT_NOTE_HEIGHT, DEFAULT_NOTE_HEIGHT,
DEFAULT_NOTE_WIDTH, DEFAULT_NOTE_WIDTH,
@@ -6,6 +5,7 @@ import {
type NoteBlockModel, type NoteBlockModel,
NoteDisplayMode, NoteDisplayMode,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { focusTextModel } from '@blocksuite/affine-rich-text';
import { TelemetryProvider } from '@blocksuite/affine-shared/services'; import { TelemetryProvider } from '@blocksuite/affine-shared/services';
import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types'; import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types';
import { handleNativeRangeAtPoint } from '@blocksuite/affine-shared/utils'; import { handleNativeRangeAtPoint } from '@blocksuite/affine-shared/utils';
@@ -9,6 +9,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -16,6 +16,7 @@
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0", "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/data-view": "workspace:*", "@blocksuite/data-view": "workspace:*",
@@ -5,11 +5,11 @@ import {
popupTargetFromElement, popupTargetFromElement,
} from '@blocksuite/affine-components/context-menu'; } from '@blocksuite/affine-components/context-menu';
import { TextBackgroundDuotoneIcon } from '@blocksuite/affine-components/icons'; import { TextBackgroundDuotoneIcon } from '@blocksuite/affine-components/icons';
import type { TableColumn, TableRow } from '@blocksuite/affine-model';
import { import {
DefaultInlineManagerExtension, DefaultInlineManagerExtension,
RichText, RichText,
} from '@blocksuite/affine-components/rich-text'; } from '@blocksuite/affine-rich-text';
import type { TableColumn, TableRow } from '@blocksuite/affine-model';
import { cssVarV2 } from '@blocksuite/affine-shared/theme'; import { cssVarV2 } from '@blocksuite/affine-shared/theme';
import { getViewportElement } from '@blocksuite/affine-shared/utils'; import { getViewportElement } from '@blocksuite/affine-shared/utils';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
@@ -10,6 +10,7 @@
"references": [ "references": [
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../data-view" }, { "path": "../data-view" },
@@ -50,7 +50,6 @@
"./icon-button": "./src/icon-button/index.ts", "./icon-button": "./src/icon-button/index.ts",
"./toolbar": "./src/toolbar/index.ts", "./toolbar": "./src/toolbar/index.ts",
"./toast": "./src/toast/index.ts", "./toast": "./src/toast/index.ts",
"./rich-text": "./src/rich-text/index.ts",
"./smooth-corner": "./src/smooth-corner/index.ts", "./smooth-corner": "./src/smooth-corner/index.ts",
"./caption": "./src/caption/index.ts", "./caption": "./src/caption/index.ts",
"./context-menu": "./src/context-menu/index.ts", "./context-menu": "./src/context-menu/index.ts",
@@ -62,7 +61,6 @@
"./notification": "./src/notification/index.ts", "./notification": "./src/notification/index.ts",
"./block-zero-width": "./src/block-zero-width/index.ts", "./block-zero-width": "./src/block-zero-width/index.ts",
"./block-selection": "./src/block-selection/index.ts", "./block-selection": "./src/block-selection/index.ts",
"./doc-title": "./src/doc-title/index.ts",
"./embed-card-modal": "./src/embed-card-modal/index.ts", "./embed-card-modal": "./src/embed-card-modal/index.ts",
"./link-preview": "./src/link-preview/index.ts", "./link-preview": "./src/link-preview/index.ts",
"./linked-doc-title": "./src/linked-doc-title/index.ts", "./linked-doc-title": "./src/linked-doc-title/index.ts",
@@ -1,10 +1,8 @@
import { stopPropagation } from '@blocksuite/affine-shared/utils'; import { stopPropagation } from '@blocksuite/affine-shared/utils';
import type { BlockComponent } from '@blocksuite/block-std'; import { type BlockComponent, TextSelection } from '@blocksuite/block-std';
import { css, html, LitElement } from 'lit'; import { css, html, LitElement } from 'lit';
import { property } from 'lit/decorators.js'; import { property } from 'lit/decorators.js';
import { focusTextModel } from '../rich-text';
export class BlockZeroWidth extends LitElement { export class BlockZeroWidth extends LitElement {
static override styles = css` static override styles = css`
.block-zero-width { .block-zero-width {
@@ -25,7 +23,13 @@ export class BlockZeroWidth extends LitElement {
const [paragraphId] = this.block.doc.addSiblingBlocks(this.block.model, [ const [paragraphId] = this.block.doc.addSiblingBlocks(this.block.model, [
{ flavour: 'affine:paragraph' }, { flavour: 'affine:paragraph' },
]); ]);
focusTextModel(this.block.host.std, paragraphId); const std = this.block.std;
std.selection.setGroup('note', [
std.selection.create(TextSelection, {
from: { blockId: paragraphId, index: 0, length: 0 },
to: null,
}),
]);
} }
}; };
@@ -6,6 +6,7 @@ import {
modelContext, modelContext,
ShadowlessElement, ShadowlessElement,
stdContext, stdContext,
TextSelection,
} from '@blocksuite/block-std'; } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import type { BlockModel, Store } from '@blocksuite/store'; import type { BlockModel, Store } from '@blocksuite/store';
@@ -14,8 +15,6 @@ import { consume } from '@lit/context';
import { css, html, nothing } from 'lit'; import { css, html, nothing } from 'lit';
import { query, state } from 'lit/decorators.js'; import { query, state } from 'lit/decorators.js';
import { focusTextModel } from '../rich-text/index.js';
export interface BlockCaptionProps { export interface BlockCaptionProps {
caption: string | null | undefined; caption: string | null | undefined;
} }
@@ -92,7 +91,13 @@ export class BlockCaptionEditor<
index + 1 index + 1
); );
focusTextModel(this.std, id); const std = this.std;
std.selection.setGroup('note', [
std.selection.create(TextSelection, {
from: { blockId: id, index: 0, length: 0 },
to: null,
}),
]);
} }
} }
@@ -0,0 +1,46 @@
{
"name": "@blocksuite/affine-fragment-doc-title",
"description": "Doc title fragment for BlockSuite.",
"type": "module",
"scripts": {
"build": "tsc",
"test:unit": "nx vite:test --run --passWithNoTests",
"test:unit:coverage": "nx vite:test --run --coverage",
"test:e2e": "playwright test"
},
"sideEffects": false,
"keywords": [],
"author": "toeverything",
"license": "MIT",
"dependencies": {
"@blocksuite/affine-block-frame": "workspace:*",
"@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*",
"@blocksuite/icons": "^2.2.1",
"@blocksuite/inline": "workspace:*",
"@blocksuite/store": "workspace:*",
"@floating-ui/dom": "^1.6.13",
"@lit/context": "^1.1.2",
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.12",
"lit": "^3.2.0",
"minimatch": "^10.0.1",
"zod": "^3.23.8"
},
"exports": {
".": "./src/index.ts",
"./effects": "./src/effects.ts"
},
"files": [
"src",
"dist",
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.20.0"
}
@@ -6,6 +6,7 @@ import {
ParagraphBlockModel, ParagraphBlockModel,
type RootBlockModel, type RootBlockModel,
} from '@blocksuite/affine-model'; } from '@blocksuite/affine-model';
import { focusTextModel, type RichText } from '@blocksuite/affine-rich-text';
import { matchModels } from '@blocksuite/affine-shared/utils'; import { matchModels } from '@blocksuite/affine-shared/utils';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
@@ -14,8 +15,6 @@ import { effect } from '@preact/signals-core';
import { css, html } from 'lit'; import { css, html } from 'lit';
import { property, query, state } from 'lit/decorators.js'; import { property, query, state } from 'lit/decorators.js';
import { focusTextModel, type RichText } from '../rich-text';
const DOC_BLOCK_CHILD_PADDING = 24; const DOC_BLOCK_CHILD_PADDING = 24;
export class DocTitle extends WithDisposable(ShadowlessElement) { export class DocTitle extends WithDisposable(ShadowlessElement) {
@@ -1,3 +1,2 @@
export { DocTitle } from './doc-title'; export { DocTitle } from './doc-title';
export { effects } from './effects';
export { getDocTitleByEditorHost } from './utils'; export { getDocTitleByEditorHost } from './utils';
@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
},
"include": ["./src"],
"references": [
{ "path": "../block-frame" },
{ "path": "../block-surface" },
{ "path": "../components" },
{ "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" },
{ "path": "../../framework/block-std" },
{ "path": "../../framework/global" },
{ "path": "../../framework/inline" },
{ "path": "../../framework/store" }
]
}
@@ -17,6 +17,7 @@
"@blocksuite/affine-block-surface": "workspace:*", "@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,5 +1,5 @@
import type { RichText } from '@blocksuite/affine-components/rich-text';
import type { FrameBlockModel } from '@blocksuite/affine-model'; import type { FrameBlockModel } from '@blocksuite/affine-model';
import type { RichText } from '@blocksuite/affine-rich-text';
import { ShadowlessElement } from '@blocksuite/block-std'; import { ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/lit'; import { WithDisposable } from '@blocksuite/global/lit';
import { css, html } from 'lit'; import { css, html } from 'lit';
@@ -11,6 +11,7 @@
{ "path": "../block-surface" }, { "path": "../block-surface" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
@@ -15,7 +15,9 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-block-note": "workspace:*", "@blocksuite/affine-block-note": "workspace:*",
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-fragment-doc-title": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-rich-text": "workspace:*",
"@blocksuite/affine-shared": "workspace:*", "@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
@@ -1,4 +1,4 @@
import { getDocTitleByEditorHost } from '@blocksuite/affine-components/doc-title'; import { getDocTitleByEditorHost } from '@blocksuite/affine-fragment-doc-title';
import { NoteDisplayMode } from '@blocksuite/affine-model'; import { NoteDisplayMode } from '@blocksuite/affine-model';
import { DocModeProvider } from '@blocksuite/affine-shared/services'; import { DocModeProvider } from '@blocksuite/affine-shared/services';
import type { Viewport } from '@blocksuite/affine-shared/types'; import type { Viewport } from '@blocksuite/affine-shared/types';
@@ -9,7 +9,9 @@
"references": [ "references": [
{ "path": "../block-note" }, { "path": "../block-note" },
{ "path": "../components" }, { "path": "../components" },
{ "path": "../fragment-doc-title" },
{ "path": "../model" }, { "path": "../model" },
{ "path": "../rich-text" },
{ "path": "../shared" }, { "path": "../shared" },
{ "path": "../../framework/block-std" }, { "path": "../../framework/block-std" },
{ "path": "../../framework/global" }, { "path": "../../framework/global" },
+55
View File
@@ -0,0 +1,55 @@
{
"name": "@blocksuite/affine-rich-text",
"description": "Inline rich text for BlockSuite.",
"type": "module",
"scripts": {
"build": "tsc",
"test:unit": "nx vite:test --run --passWithNoTests",
"test:unit:coverage": "nx vite:test --run --coverage",
"test:e2e": "playwright test"
},
"sideEffects": false,
"keywords": [],
"author": "toeverything",
"license": "MIT",
"dependencies": {
"@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*",
"@blocksuite/icons": "^2.2.1",
"@blocksuite/inline": "workspace:*",
"@blocksuite/store": "workspace:*",
"@floating-ui/dom": "^1.6.13",
"@lit/context": "^1.1.2",
"@lottiefiles/dotlottie-wc": "^0.4.0",
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.12",
"@types/hast": "^3.0.4",
"@types/katex": "^0.16.7",
"@types/lodash-es": "^4.17.12",
"@types/mdast": "^4.0.4",
"collapse-white-space": "^2.1.0",
"date-fns": "^4.0.0",
"katex": "^0.16.11",
"lit": "^3.2.0",
"lit-html": "^3.2.1",
"lodash-es": "^4.17.21",
"remark-math": "^6.0.0",
"shiki": "^3.0.0",
"yjs": "^13.6.21",
"zod": "^3.23.8"
},
"exports": {
".": "./src/index.ts",
"./effects": "./src/effects.ts"
},
"files": [
"src",
"dist",
"!src/__tests__",
"!dist/__tests__"
],
"version": "0.20.0"
}
@@ -1,5 +1,3 @@
import type { TemplateResult } from 'lit';
import { import {
BulletedListIcon, BulletedListIcon,
CheckBoxIcon, CheckBoxIcon,
@@ -14,7 +12,8 @@ import {
NumberedListIcon, NumberedListIcon,
QuoteIcon, QuoteIcon,
TextIcon, TextIcon,
} from '../icons'; } from '@blocksuite/affine-components/icons';
import type { TemplateResult } from 'lit';
/** /**
* Text primitive entries used in slash menu and format bar, * Text primitive entries used in slash menu and format bar,
@@ -1,6 +1,3 @@
import { type EditorHost, TextSelection } from '@blocksuite/block-std';
import type { TemplateResult } from 'lit';
import { import {
BoldIcon, BoldIcon,
CodeIcon, CodeIcon,
@@ -8,7 +5,10 @@ import {
LinkIcon, LinkIcon,
StrikethroughIcon, StrikethroughIcon,
UnderlineIcon, UnderlineIcon,
} from '../../icons/index.js'; } from '@blocksuite/affine-components/icons';
import { type EditorHost, TextSelection } from '@blocksuite/block-std';
import type { TemplateResult } from 'lit';
import { import {
isTextStyleActive, isTextStyleActive,
toggleBold, toggleBold,

Some files were not shown because too many files have changed in this diff Show More