mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat(editor): fragment extensions (#12066)
Closes: BS-3382 Closes: BS-3381 Closes: BS-3380 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new view extensions for document title, frame panel, and outline fragments, enhancing modularity and extensibility. - **Refactor** - Updated export structure for fragments to support directory-based modules and added dedicated view module exports. - Replaced a centralized view extension with individual fragment-based view extensions for improved clarity. - **Chores** - Updated dependencies and TypeScript project references to ensure compatibility and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -194,9 +194,12 @@
|
||||
"./widgets/viewport-overlay/view": "./src/widgets/viewport-overlay/view.ts",
|
||||
"./widgets/page-dragging-area": "./src/widgets/page-dragging-area/index.ts",
|
||||
"./widgets/page-dragging-area/view": "./src/widgets/page-dragging-area/view.ts",
|
||||
"./fragments/doc-title": "./src/fragments/doc-title.ts",
|
||||
"./fragments/frame-panel": "./src/fragments/frame-panel.ts",
|
||||
"./fragments/outline": "./src/fragments/outline.ts",
|
||||
"./fragments/doc-title": "./src/fragments/doc-title/index.ts",
|
||||
"./fragments/doc-title/view": "./src/fragments/doc-title/view.ts",
|
||||
"./fragments/frame-panel": "./src/fragments/frame-panel/index.ts",
|
||||
"./fragments/frame-panel/view": "./src/fragments/frame-panel/view.ts",
|
||||
"./fragments/outline": "./src/fragments/outline/index.ts",
|
||||
"./fragments/outline/view": "./src/fragments/outline/view.ts",
|
||||
"./gfx/text": "./src/gfx/text/index.ts",
|
||||
"./gfx/text/store": "./src/gfx/text/store.ts",
|
||||
"./gfx/text/view": "./src/gfx/text/view.ts",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { effects as fragmentDocTitleEffects } from '@blocksuite/affine-fragment-doc-title/effects';
|
||||
import { effects as fragmentFramePanelEffects } from '@blocksuite/affine-fragment-frame-panel/effects';
|
||||
import { effects as fragmentOutlineEffects } from '@blocksuite/affine-fragment-outline/effects';
|
||||
|
||||
export function effects() {
|
||||
fragmentDocTitleEffects();
|
||||
fragmentFramePanelEffects();
|
||||
fragmentOutlineEffects();
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import {
|
||||
type ViewExtensionContext,
|
||||
ViewExtensionProvider,
|
||||
} from '@blocksuite/affine-ext-loader';
|
||||
|
||||
import { effects } from './effects';
|
||||
|
||||
export class MigratingViewExtension extends ViewExtensionProvider {
|
||||
override name = 'migrating';
|
||||
|
||||
override effect() {
|
||||
super.effect();
|
||||
effects();
|
||||
}
|
||||
|
||||
override setup(context: ViewExtensionContext) {
|
||||
super.setup(context);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ import { SurfaceViewExtension } from '@blocksuite/affine-block-surface/view';
|
||||
import { SurfaceRefViewExtension } from '@blocksuite/affine-block-surface-ref/view';
|
||||
import { TableViewExtension } from '@blocksuite/affine-block-table/view';
|
||||
import { FoundationViewExtension } from '@blocksuite/affine-foundation/view';
|
||||
import { DocTitleViewExtension } from '@blocksuite/affine-fragment-doc-title/view';
|
||||
import { FramePanelViewExtension } from '@blocksuite/affine-fragment-frame-panel/view';
|
||||
import { OutlineViewExtension } from '@blocksuite/affine-fragment-outline/view';
|
||||
import { BrushViewExtension } from '@blocksuite/affine-gfx-brush/view';
|
||||
import { ConnectorViewExtension } from '@blocksuite/affine-gfx-connector/view';
|
||||
import { GroupViewExtension } from '@blocksuite/affine-gfx-group/view';
|
||||
@@ -48,8 +51,6 @@ import { SlashMenuViewExtension } from '@blocksuite/affine-widget-slash-menu/vie
|
||||
import { ToolbarViewExtension } from '@blocksuite/affine-widget-toolbar/view';
|
||||
import { ViewportOverlayViewExtension } from '@blocksuite/affine-widget-viewport-overlay/view';
|
||||
|
||||
import { MigratingViewExtension } from './migrating-view';
|
||||
|
||||
export function getInternalViewExtensions() {
|
||||
return [
|
||||
FoundationViewExtension,
|
||||
@@ -99,7 +100,6 @@ export function getInternalViewExtensions() {
|
||||
DragHandleViewExtension,
|
||||
EdgelessAutoConnectViewExtension,
|
||||
EdgelessToolbarViewExtension,
|
||||
MigratingViewExtension,
|
||||
FrameTitleViewExtension,
|
||||
KeyboardToolbarViewExtension,
|
||||
LinkedDocViewExtension,
|
||||
@@ -110,5 +110,10 @@ export function getInternalViewExtensions() {
|
||||
ViewportOverlayViewExtension,
|
||||
EdgelessZoomToolbarViewExtension,
|
||||
PageDraggingAreaViewExtension,
|
||||
|
||||
// Fragment
|
||||
DocTitleViewExtension,
|
||||
FramePanelViewExtension,
|
||||
OutlineViewExtension,
|
||||
];
|
||||
}
|
||||
|
||||
1
blocksuite/affine/all/src/fragments/doc-title/view.ts
Normal file
1
blocksuite/affine/all/src/fragments/doc-title/view.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@blocksuite/affine-fragment-doc-title/view';
|
||||
1
blocksuite/affine/all/src/fragments/frame-panel/view.ts
Normal file
1
blocksuite/affine/all/src/fragments/frame-panel/view.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@blocksuite/affine-fragment-frame-panel/view';
|
||||
1
blocksuite/affine/all/src/fragments/outline/view.ts
Normal file
1
blocksuite/affine/all/src/fragments/outline/view.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@blocksuite/affine-fragment-outline/view';
|
||||
@@ -13,6 +13,7 @@
|
||||
"@blocksuite/affine-block-frame": "workspace:*",
|
||||
"@blocksuite/affine-block-surface": "workspace:*",
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/affine-ext-loader": "workspace:*",
|
||||
"@blocksuite/affine-model": "workspace:*",
|
||||
"@blocksuite/affine-rich-text": "workspace:*",
|
||||
"@blocksuite/affine-shared": "workspace:*",
|
||||
@@ -31,7 +32,8 @@
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./effects": "./src/effects.ts"
|
||||
"./effects": "./src/effects.ts",
|
||||
"./view": "./src/view.ts"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
|
||||
12
blocksuite/affine/fragments/doc-title/src/view.ts
Normal file
12
blocksuite/affine/fragments/doc-title/src/view.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ViewExtensionProvider } from '@blocksuite/affine-ext-loader';
|
||||
|
||||
import { effects } from './effects';
|
||||
|
||||
export class DocTitleViewExtension extends ViewExtensionProvider {
|
||||
override name = 'affine-doc-title-fragment';
|
||||
|
||||
override effect() {
|
||||
super.effect();
|
||||
effects();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
{ "path": "../../blocks/frame" },
|
||||
{ "path": "../../blocks/surface" },
|
||||
{ "path": "../../components" },
|
||||
{ "path": "../../ext-loader" },
|
||||
{ "path": "../../model" },
|
||||
{ "path": "../../rich-text" },
|
||||
{ "path": "../../shared" },
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./effects": "./src/effects.ts"
|
||||
"./effects": "./src/effects.ts",
|
||||
"./view": "./src/view.ts"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
|
||||
12
blocksuite/affine/fragments/frame-panel/src/view.ts
Normal file
12
blocksuite/affine/fragments/frame-panel/src/view.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ViewExtensionProvider } from '@blocksuite/affine-ext-loader';
|
||||
|
||||
import { effects } from './effects';
|
||||
|
||||
export class FramePanelViewExtension extends ViewExtensionProvider {
|
||||
override name = 'affine-frame-panel-fragment';
|
||||
|
||||
override effect() {
|
||||
super.effect();
|
||||
effects();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
"dependencies": {
|
||||
"@blocksuite/affine-block-note": "workspace:*",
|
||||
"@blocksuite/affine-components": "workspace:*",
|
||||
"@blocksuite/affine-ext-loader": "workspace:*",
|
||||
"@blocksuite/affine-fragment-doc-title": "workspace:*",
|
||||
"@blocksuite/affine-model": "workspace:*",
|
||||
"@blocksuite/affine-rich-text": "workspace:*",
|
||||
@@ -32,7 +33,8 @@
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./effects": "./src/effects.ts"
|
||||
"./effects": "./src/effects.ts",
|
||||
"./view": "./src/view.ts"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
|
||||
12
blocksuite/affine/fragments/outline/src/view.ts
Normal file
12
blocksuite/affine/fragments/outline/src/view.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ViewExtensionProvider } from '@blocksuite/affine-ext-loader';
|
||||
|
||||
import { effects } from './effects';
|
||||
|
||||
export class OutlineViewExtension extends ViewExtensionProvider {
|
||||
override name = 'affine-outline-fragment';
|
||||
|
||||
override effect() {
|
||||
super.effect();
|
||||
effects();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
"references": [
|
||||
{ "path": "../../blocks/note" },
|
||||
{ "path": "../../components" },
|
||||
{ "path": "../../ext-loader" },
|
||||
{ "path": "../doc-title" },
|
||||
{ "path": "../../model" },
|
||||
{ "path": "../../rich-text" },
|
||||
|
||||
Reference in New Issue
Block a user