Skip to content

Commit

Permalink
fix: fix setting panel cant show
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Dec 22, 2022
1 parent fa20830 commit fc16ab8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/editor-skeleton/src/components/settings/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SettingsMain {

private _sessionId = '';

@obx.ref private _settings?: SettingTopEntry;
@obx.ref private _settings?: SettingTopEntry | null = null;

@computed get length(): number | undefined {
return this._settings?.nodes.length;
Expand All @@ -23,7 +23,7 @@ export class SettingsMain {
return this._settings?.componentMeta;
}

get settings() {
@computed get settings() {
return this._settings;
}

Expand All @@ -48,7 +48,7 @@ export class SettingsMain {
this.disposeListener = () => {
this.editor.removeListener('designer.selection.change', setupSelection);
};
const designer = await this.editor.onceGot(Designer);
const designer = await this.editor.onceGot('designer');
this.designer = designer;
setupSelection(designer.currentSelection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,23 @@ import { SkeletonContext } from '../../context';
import { createIcon, isSettingField } from '@alilc/lowcode-utils';

@observer
export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any }, { shouldIgnoreRoot: boolean }> {
export class SettingsPrimaryPane extends Component<{ engineEditor: Editor; config: any }, { shouldIgnoreRoot: boolean }> {
state = {
shouldIgnoreRoot: false,
};
private main;
private main = new SettingsMain(this.props.engineEditor);

@obx.ref private _activeKey?: any;

constructor(props) {
super(props);
makeObservable(this);
const workspace = globalContext.get('workspace');
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
this.main = new SettingsMain(editor);
}

componentDidMount() {
this.setShouldIgnoreRoot();

const workspace = globalContext.get('workspace');
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
const editor = this.props.engineEditor;

editor.eventBus.on('designer.selection.change', () => {
if (!engineConfig.get('stayOnTheSameSettingTab', false)) {
Expand Down Expand Up @@ -135,8 +131,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any

render() {
const { settings } = this.main;
const workspace = globalContext.get('workspace');
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
const editor = this.props.engineEditor;
if (!settings) {
// 未选中节点,提示选中 或者 显示根节点设置
return (
Expand Down
6 changes: 0 additions & 6 deletions packages/editor-skeleton/src/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@ export class Skeleton {
...this.parseConfig(config),
...extraConfig,
};
parsedConfig.contentProps = {
pluginContext: this.editor.get('innerPlugins')?._getLowCodePluginContext({
pluginName: parsedConfig.pluginName,
}),
...(parsedConfig.contentProps || {}),
};
let { area } = parsedConfig;
if (!area) {
if (parsedConfig.type === 'Panel') {
Expand Down
4 changes: 3 additions & 1 deletion packages/engine/src/inner-plugins/default-panel-registry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export const defaultPanelRegistry = (editor: any, designer: any) => {
area: 'rightArea',
name: 'settingsPane',
type: 'Panel',
content: SettingsPrimaryPane,
content: <SettingsPrimaryPane
engineEditor={editor}
/>,
props: {
ignoreRoot: true,
},
Expand Down

0 comments on commit fc16ab8

Please sign in to comment.