fix bug: editor 的 editorDidMount 支持 string格式 (#6697)

This commit is contained in:
包周涛 2023-05-05 20:44:26 +08:00 committed by GitHub
parent f4922e0c40
commit 6143cd8b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,7 +247,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
if (this.props.editorDidMount) {
let editorDidMount = this.props.editorDidMount;
if (typeof editorDidMount === 'string') {
editorDidMount = new Function('editor', 'monaco');
editorDidMount = new Function('editor', 'monaco', editorDidMount);
}
const dispose = editorDidMount(editor, monaco);
if (typeof dispose === 'function') {