feat(editor): root block extension (#12063)

Closes: BS-3202

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced new root block store and view extensions, enhancing modularity and integration options for root block functionality.
  - Exported the EdgelessLocker class for broader usage.

- **Improvements**
  - Updated export paths for root block modules, enabling clearer and more flexible module access.
  - Enhanced view extension setup to better tailor user interface and interactions based on context.

- **Removals**
  - Removed legacy migrating store and view extension logic, streamlining extension management and reducing unused code.
  - Removed multiple deprecated block specifications and common extension collections to simplify the codebase.
  - Deleted AI page root block specification, retaining only lifecycle watcher functionality.

- **Chores**
  - Updated dependencies and project references to support new extension loader integration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-04-29 09:15:51 +00:00
parent b5edd7a6bb
commit d6ab958e15
22 changed files with 138 additions and 246 deletions

View File

@@ -1,20 +1,9 @@
import { PageRootBlockSpec } from '@blocksuite/affine/blocks/root';
import { ToolbarModuleExtension } from '@blocksuite/affine/shared/services';
import {
BlockFlavourIdentifier,
LifeCycleWatcher,
} from '@blocksuite/affine/std';
import type { ExtensionType } from '@blocksuite/affine/store';
import { LifeCycleWatcher } from '@blocksuite/affine/std';
import type { FrameworkProvider } from '@toeverything/infra';
import { buildAIPanelConfig } from '../ai-panel';
import { toolbarAIEntryConfig } from '../entries';
import { setupSpaceAIEntry } from '../entries/space/setup-space';
import {
AffineAIPanelWidget,
aiPanelWidget,
} from '../widgets/ai-panel/ai-panel';
import { AiSlashMenuConfigExtension } from './ai-slash-menu';
import { AffineAIPanelWidget } from '../widgets/ai-panel/ai-panel';
export function getAIPageRootWatcher(framework: FrameworkProvider) {
class AIPageRootWatcher extends LifeCycleWatcher {
@@ -38,18 +27,3 @@ export function getAIPageRootWatcher(framework: FrameworkProvider) {
}
return AIPageRootWatcher;
}
export function createAIPageRootBlockSpec(
framework: FrameworkProvider
): ExtensionType[] {
return [
...PageRootBlockSpec,
aiPanelWidget,
getAIPageRootWatcher(framework),
ToolbarModuleExtension({
id: BlockFlavourIdentifier('custom:affine:note'),
config: toolbarAIEntryConfig(),
}),
AiSlashMenuConfigExtension(),
];
}