-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3b6841
commit 29dbd06
Showing
10 changed files
with
64 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 12 additions & 17 deletions
29
packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/edgeless.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 11 additions & 15 deletions
26
packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
import { AIPageRootBlockSpec } from '@affine/core/blocksuite/presets/ai'; | ||
import { FeatureFlagService } from '@affine/core/modules/feature-flag'; | ||
import type { ExtensionType } from '@blocksuite/affine/block-std'; | ||
import { | ||
NoteBlockSpec, | ||
PageSurfaceBlockSpec, | ||
PageSurfaceRefBlockSpec, | ||
} from '@blocksuite/affine/blocks'; | ||
import { PageRootBlockSpec, SpecProvider } from '@blocksuite/affine/blocks'; | ||
import { type FrameworkProvider } from '@toeverything/infra'; | ||
|
||
import { AIBlockSpecs, DefaultBlockSpecs } from './common'; | ||
import { createPageRootBlockSpec } from './custom/root-block'; | ||
import { enableAffineExtension, enableAIExtension } from './custom/root-block'; | ||
|
||
export function createPageModeSpecs( | ||
framework: FrameworkProvider | ||
): ExtensionType[] { | ||
const featureFlagService = framework.get(FeatureFlagService); | ||
const enableAI = featureFlagService.flags.enable_ai.value; | ||
return [ | ||
...(enableAI ? AIBlockSpecs : DefaultBlockSpecs), | ||
PageSurfaceBlockSpec, | ||
PageSurfaceRefBlockSpec, | ||
NoteBlockSpec, | ||
// special | ||
createPageRootBlockSpec(framework), | ||
].flat(); | ||
const provider = SpecProvider.getInstance(); | ||
const pageSpec = provider.getSpec('page'); | ||
enableAffineExtension(framework, pageSpec); | ||
if (enableAI) { | ||
enableAIExtension(pageSpec); | ||
pageSpec.replace(PageRootBlockSpec, AIPageRootBlockSpec); | ||
} | ||
return pageSpec.value; | ||
} |