feat(editor): add feature flag service (#9592)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { AffineSchemas } from '@blocksuite/blocks';
|
||||
import { AffineSchemas, SpecProvider } from '@blocksuite/blocks';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
import { TestWorkspace } from '@blocksuite/store/test';
|
||||
|
||||
export function createEmptyDoc() {
|
||||
const schema = new Schema().register(AffineSchemas);
|
||||
const collection = new TestWorkspace({ schema });
|
||||
collection.storeExtensions =
|
||||
SpecProvider.getInstance().getSpec('store').value;
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc();
|
||||
|
||||
|
||||
@@ -7,18 +7,14 @@ import {
|
||||
} from '@blocksuite/blocks';
|
||||
import { viewPresets } from '@blocksuite/data-view/view-presets';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { type DocCollection, Text } from '@blocksuite/store';
|
||||
import { Text, type Workspace } from '@blocksuite/store';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { propertyPresets } from '../../../../affine/data-view/src/property-presets';
|
||||
import type { InitFn } from './utils.js';
|
||||
|
||||
export const database: InitFn = (collection: DocCollection, id: string) => {
|
||||
export const database: InitFn = (collection: Workspace, id: string) => {
|
||||
const doc = collection.createDoc({ id });
|
||||
doc.awarenessStore.setFlag('enable_database_number_formatting', true);
|
||||
doc.awarenessStore.setFlag('enable_database_attachment_note', true);
|
||||
doc.awarenessStore.setFlag('enable_database_full_width', true);
|
||||
doc.awarenessStore.setFlag('enable_block_query', true);
|
||||
|
||||
doc.load(() => {
|
||||
// Add root block and surface block at root level
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AffineSchemas, TestUtils } from '@blocksuite/blocks';
|
||||
import { AffineSchemas, SpecProvider, TestUtils } from '@blocksuite/blocks';
|
||||
import type { BlockSuiteFlags } from '@blocksuite/global/types';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { type BlockCollection, Job, nanoid, Schema } from '@blocksuite/store';
|
||||
@@ -75,6 +75,8 @@ export function createStarterDocCollection() {
|
||||
blobSources,
|
||||
};
|
||||
const collection = new TestWorkspace(options);
|
||||
collection.storeExtensions =
|
||||
SpecProvider.getInstance().getSpec('store').value;
|
||||
collection.start();
|
||||
|
||||
// debug info
|
||||
|
||||
Reference in New Issue
Block a user