mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-15 00:56:26 +08:00
feat(editor): feature flag store extension builder (#12235)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced feature flag synchronization for enhanced control over feature availability. - Added new configuration options for store management, allowing initialization and feature flag setup. - **Improvements** - Updated how store extensions are accessed throughout the app for more robust initialization and configuration. - Enhanced workspace entities to support feature flag services, improving flexibility for workspace-specific features. - Centralized configuration of storage implementations for Electron environments. - **Refactor** - Simplified editor module by removing direct feature flag synchronization logic. - Streamlined imports and configuration for storage modules, especially in Electron-based apps. - **Bug Fixes** - Ensured consistent retrieval of store extensions across various modules and platforms. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -146,7 +146,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown: text,
|
||||
fileName,
|
||||
extensions: getStoreManager().get('store'),
|
||||
extensions: getStoreManager().config.init().value.get('store'),
|
||||
});
|
||||
if (docId) docIds.push(docId);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
imported: file,
|
||||
extensions: getStoreManager().get('store'),
|
||||
extensions: getStoreManager().config.init().value.get('store'),
|
||||
});
|
||||
return {
|
||||
docIds,
|
||||
@@ -185,7 +185,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
const docId = await HtmlTransformer.importHTMLToDoc({
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
extensions: getStoreManager().get('store'),
|
||||
extensions: getStoreManager().config.init().value.get('store'),
|
||||
html: text,
|
||||
fileName,
|
||||
});
|
||||
@@ -207,7 +207,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
imported: file,
|
||||
extensions: getStoreManager().get('store'),
|
||||
extensions: getStoreManager().config.init().value.get('store'),
|
||||
});
|
||||
return {
|
||||
docIds: pageIds,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { DesktopApiService } from '@affine/core/modules/desktop-api';
|
||||
import {
|
||||
CacheStorage,
|
||||
GlobalCache,
|
||||
GlobalState,
|
||||
} from '@affine/core/modules/storage';
|
||||
import {
|
||||
ElectronGlobalCache,
|
||||
ElectronGlobalState,
|
||||
} from '@affine/core/modules/storage/impls/electron';
|
||||
import { IDBGlobalState } from '@affine/core/modules/storage/impls/storage';
|
||||
import type { Framework } from '@toeverything/infra';
|
||||
|
||||
export function configureElectronStateStorageImpls(framework: Framework) {
|
||||
framework.impl(GlobalCache, ElectronGlobalCache, [DesktopApiService]);
|
||||
framework.impl(GlobalState, ElectronGlobalState, [DesktopApiService]);
|
||||
framework.impl(CacheStorage, IDBGlobalState);
|
||||
}
|
||||
Reference in New Issue
Block a user