reference-node external configuration
Closed this issue · 4 comments
xiaofeiniuuu commented
How to update the config value of
const config = provider.getOptional(ReferenceNodeConfigIdentifier) ?? {}; after upgrading
Do I need to use ReferenceNodeConfigExtension? How to use it?
I see that affine-paragraph no longer has referenceNodeConfig
xiaofeiniuuu commented
xiaofeiniuuu commented
L-Sun commented
You can add a ConfigExtension
to editor.pageSpecs
and editor.edgelessSpecs
. For example, in the setup stage of playground editor:
- Before
blocksuite/packages/playground/apps/default/utils/editor.ts
Lines 58 to 66 in bfb0c7f
- After
const referenceNodeConfigExtension : ExtensionType = { setup: di => { const prev = di.getFactory(ReferenceNodeConfigIdentifier); di.override(ReferenceNodeConfigIdentifier, provider => { return { ...prev?.(provider), // If you wan to fully control the configs, remove this line // Your configs put here } satisfies ReferenceNodeConfig; }); } } editor.pageSpecs = patchPageRootSpec([ refNodeSlotsExtension, ...specs.pageModeSpecs, referenceNodeConfigExtension, ]); editor.edgelessSpecs = patchPageRootSpec([ refNodeSlotsExtension, ...specs.edgelessModeSpecs, referenceNodeConfigExtension, ]);
L-Sun commented
This is what I'm doing now. Is this correct?
Basically correct if there is no other reference node configuration. More precisely,
- you also need to push the extension to
EdgelessEditorBlockSpecs
- you can override the configuration in this way,
- or partially modify the configuration by following the instructions in the my comments above.