Skip to content

Commit 5eda362

Browse files
authored
fix(editor-client): postpone the sequence of custom service registration (bytedance#135)
1 parent 25356df commit 5eda362

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

packages/client/editor/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,5 @@ export * from './clients';
7070
*/
7171

7272
export * from '@flowgram.ai/node-variable-plugin';
73+
74+
export { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';

packages/client/editor/src/preset/editor-default-preset.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { interfaces } from 'inversify';
22
import { FlowRendererContainerModule, FlowRendererRegistry } from '@flowgram.ai/renderer';
33
import { createReduxDevToolPlugin } from '@flowgram.ai/redux-devtool-plugin';
4-
import { createPlaygroundReactPreset } from '@flowgram.ai/playground-react';
54
import { createNodeVariablePlugin } from '@flowgram.ai/node-variable-plugin';
65
import { createNodeCorePlugin } from '@flowgram.ai/node-core-plugin';
76
import { createMaterialsPlugin } from '@flowgram.ai/materials-plugin';
@@ -121,6 +120,6 @@ export function createDefaultPreset<CTX extends EditorPluginContext = EditorPlug
121120
})
122121
);
123122

124-
return createPlaygroundReactPreset<CTX>(opts, plugins)(ctx);
123+
return plugins;
125124
};
126125
}

packages/client/fixed-layout-editor/src/preset/fixed-layout-preset.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
FlowNodesTransformLayer,
2020
FlowScrollBarLayer,
2121
FlowScrollLimitLayer,
22+
createPlaygroundReactPreset,
2223
} from '@flowgram.ai/editor';
2324

2425
import { FlowOperationService } from '../types';
@@ -152,6 +153,7 @@ export function createFixedLayoutPreset(
152153
},
153154
})
154155
);
155-
return plugins;
156+
157+
return createPlaygroundReactPreset(opts, plugins)(ctx);
156158
};
157159
}

packages/client/free-layout-editor/src/preset/free-layout-preset.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
FlowNodesTransformLayer,
3030
FlowScrollBarLayer,
3131
FlowScrollLimitLayer,
32+
createPlaygroundReactPreset,
3233
} from '@flowgram.ai/editor';
3334

3435
import { FreeLayoutProps, FreeLayoutPluginContext } from './free-layout-props';
@@ -240,6 +241,7 @@ export function createFreeLayoutPreset(
240241
...(opts.selectBox || {}),
241242
})
242243
);
243-
return plugins;
244+
245+
return createPlaygroundReactPreset(opts, plugins)(ctx);
244246
};
245247
}

packages/client/playground-react/src/preset/playground-react-preset.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export function createPlaygroundReactPreset<CTX extends PluginContext = PluginCo
1717
): PluginsProvider<CTX> {
1818
return (ctx: CTX) => {
1919
plugins = plugins.slice();
20+
/**
21+
* 注册背景 (放前面插入), 默认打开
22+
*/
23+
if (opts.background || opts.background === undefined) {
24+
plugins.push(createBackgroundPlugin(opts.background || {}));
25+
}
2026
/**
2127
* 注册快捷键
2228
*/
@@ -70,13 +76,6 @@ export function createPlaygroundReactPreset<CTX extends PluginContext = PluginCo
7076
containerModules: opts.containerModules || [],
7177
})
7278
);
73-
74-
/**
75-
* 注册背景 (放最后插入), 默认打开
76-
*/
77-
if (opts.background || opts.background === undefined) {
78-
plugins.push(createBackgroundPlugin(opts.background || {}));
79-
}
8079
return plugins;
8180
};
8281
}

0 commit comments

Comments
 (0)