feat(core): move blocksuite flags to experimental features (#6113)

This commit is contained in:
Peng Xiao
2024-03-14 05:24:47 +00:00
parent dd9a253772
commit d2bad68b74
6 changed files with 84 additions and 33 deletions

View File

@@ -1,17 +1,10 @@
/// <reference types="@blocksuite/global" />
import { assertEquals } from '@blocksuite/global/utils';
import type { DocCollection } from '@blocksuite/store';
import { z } from 'zod';
import { isDesktop, isServer } from './constant.js';
import { UaHelper } from './ua-helper.js';
export const blockSuiteFeatureFlags = z.object({
enable_synced_doc_block: z.boolean(),
enable_expand_database_block: z.boolean(),
enable_bultin_ledits: z.boolean(),
});
export const runtimeFlagsSchema = z.object({
enableTestProperties: z.boolean(),
enableBroadcastChannelProvider: z.boolean(),
@@ -36,7 +29,6 @@ export const runtimeFlagsSchema = z.object({
// this is for the electron app
serverUrlPrefix: z.string(),
enableMoveDatabase: z.boolean(),
editorFlags: blockSuiteFeatureFlags,
appVersion: z.string(),
editorVersion: z.string(),
appBuildType: z.union([
@@ -48,8 +40,6 @@ export const runtimeFlagsSchema = z.object({
isSelfHosted: z.boolean().optional(),
});
export type BlockSuiteFeatureFlags = z.infer<typeof blockSuiteFeatureFlags>;
export type RuntimeConfig = z.infer<typeof runtimeFlagsSchema>;
type BrowserBase = {
@@ -153,12 +143,3 @@ export function setupGlobal() {
globalThis.$AFFINE_SETUP = true;
}
export function setupEditorFlags(docCollection: DocCollection) {
Object.entries(runtimeConfig.editorFlags).forEach(([key, value]) => {
docCollection.awarenessStore.setFlag(
key as keyof BlockSuiteFeatureFlags,
value
);
});
}