chore: sdk embed 方法添加 callback 在 callback 中可确保 scoped 方法是可用的 (#5698)

* publish beta

* chore: sdk embed 方法添加 callback 在 callback 中可确保 scoped 方法是可用的
This commit is contained in:
liaoxuezhi 2022-11-04 15:44:26 +08:00 committed by GitHub
parent ee472ec367
commit fdb09001e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -27,7 +27,8 @@ export function embed(
container: string | HTMLElement,
schema: any,
props: any = {},
env?: any
env?: any,
callback?: () => void
) {
const __ = makeTranslator(env?.locale || props?.locale);
@ -259,7 +260,10 @@ export function embed(
...amisProps,
...props,
scopeRef: (ref: any) => {
if (ref) Object.assign(scoped, ref);
if (ref) {
Object.assign(scoped, ref);
callback?.();
}
}
};

View File

@ -34,7 +34,9 @@
"@types/js-yaml": "^4.0.5",
"@types/marked": "^4.0.7",
"@types/prismjs": "^1.26.0",
"@types/react-dom": "^18.0.8",
"@vitejs/plugin-react": "^2.2.0",
"copy-to-clipboard": "3.3.1",
"echarts": "5.4.0",
"express": "^4.18.2",
"fis-optimizer-terser": "^1.0.1",
@ -58,20 +60,19 @@
"lerna": "^5.5.2",
"magic-string": "^0.26.7",
"marked": "^4.2.1",
"monaco-editor": "0.30.1",
"plugin-react-i18n": "^0.0.20",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-overlays": "5.1.1",
"rollup-pluginutils": "^2.8.2",
"setprototypeof": "^1.2.0",
"ts-jest": "^29.0.2",
"vite": "^3.2.2",
"vite-plugin-monaco-editor": "^1.1.0",
"vite-plugin-svgr": "^2.2.2",
"zrender": "^5.3.2",
"monaco-editor": "0.30.1",
"react-overlays": "5.1.1",
"copy-to-clipboard": "3.3.1"
"zrender": "^5.3.2"
},
"jest": {
"verbose": true,