Skip to content

Commit

Permalink
feat: export-override-params
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Nov 27, 2024
1 parent 27d7c14 commit 1f24a87
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/presets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@ interface IPresetOptions {
type CreateUniverOptions = Partial<IUniverConfig> & {
presets: Array<IPreset | [IPreset, IPresetOptions]>;
plugins?: Array<PluginCtor<Plugin> | [PluginCtor<Plugin>, ConstructorParameters<PluginCtor<Plugin>>[0]]>;

/**
* Overrides the dependencies defined in the plugin. Only dependencies that are identified by `IdentifierDecorator` can be overridden.
* If you override a dependency with `null`, the original dependency will be removed.
*/
override?: DependencyOverride;
collaboration?: true;
};

export function createUniver(options: CreateUniverOptions) {
const { presets, plugins, collaboration, ...univerOptions } = options;
const { presets, plugins, collaboration, override, ...univerOptions } = options;

const override: DependencyOverride = [];
const _override: DependencyOverride = override ?? [];
if (collaboration) {
override.push([IUndoRedoService, null]);
override.push([IAuthzIoService, null]);
_override.push([IUndoRedoService, null]);
_override.push([IAuthzIoService, null]);
}

const univer = new Univer({
logLevel: LogLevel.WARN,

...univerOptions,
override,
override: _override,
});

const pluginsMap = new Map<string, {
Expand Down

0 comments on commit 1f24a87

Please sign in to comment.