sourse editor update fix

This commit is contained in:
zude.hzd 2020-07-21 14:21:07 +08:00
parent 2916c4421c
commit d0137877d9
2 changed files with 7 additions and 35 deletions

View File

@ -198,7 +198,6 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
}, },
setValue(field: SettingTarget, eventDataList: any[]) { setValue(field: SettingTarget, eventDataList: any[]) {
// todo:
eventDataList.map((item)=>{ eventDataList.map((item)=>{
field.setPropValue(item.name,{ field.setPropValue(item.name,{
type: 'JSFunction', type: 'JSFunction',
@ -207,6 +206,7 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
}) })
return item; return item;
}) })
return; return;
}, },
}, },

View File

@ -54,52 +54,27 @@ export default class SourceEditor extends Component<{
private editorParentNode: Object; private editorParentNode: Object;
state = { state = {
isShow: false, isShow: true,
tabKey: TAB_KEY.JS_TAB, tabKey: TAB_KEY.JS_TAB,
}; };
componentWillMount() { componentWillMount() {
const { editor } = this.props; const { editor } = this.props;
editor.on('leftPanel.show', (key: String) => {
// debugger;
if (key === 'sourceEditor' && !this.monocoEditor) {
this.setState({
isShow: true,
});
// setTimeout(() => {
// this.editorNode = this.editorCssRef.current; //记录当前dom节点
// debugger
// this.editorParentNode = this.editorNode.parentNode; //记录父节点;
// console.log(this.editorNode);
// }, 0);
}
});
// 添加函数 // 添加函数
editor.on('sourceEditor.addFunction', (params: FunctionEventParam) => { editor.on('sourceEditor.addFunction', (params: FunctionEventParam) => {
this.callEditorEvent('sourceEditor.addFunction', params); this.callEditorEvent('sourceEditor.addFunction', params);
// this.openPluginPannel();
}); });
// 定位函数 // 定位函数
editor.on('sourceEditor.focusByFunction', (params: FunctionEventParam) => { editor.on('sourceEditor.focusByFunction', (params: FunctionEventParam) => {
this.callEditorEvent('sourceEditor.focusByFunction', params); this.callEditorEvent('sourceEditor.focusByFunction', params);
// this.openPluginPannel();
}); });
//editor.once('designer.mount', (designer: Designer) => {
// let schema = designer.project.getSchema();
// mock data
//debugger;
let schema = editor.get('designer').project.getSchema(); let schema = editor.get('designer').project.getSchema();
this.initCode(schema); this.initCode(schema);
//});
} }
/** /**
* *
*/ */
@ -162,7 +137,6 @@ export default class SourceEditor extends Component<{
this.monocoEditor.focus(); this.monocoEditor.focus();
}, 100); }, 100);
this.updateCode(this.monocoEditor.getModel().getValue()); this.updateCode(this.monocoEditor.getModel().getValue());
} }
@ -196,9 +170,7 @@ export default class SourceEditor extends Component<{
} }
}; };
fullScreen = () => { fullScreen = () => {};
}
onTabChange = (key) => { onTabChange = (key) => {
const { editor } = this.props; const { editor } = this.props;