Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chore bug fix for v2.1 #953

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/canvas/DesignCanvas/src/api/useCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,18 @@ const operationTypeMap = {
}
}

if (position === 'after') {
if (position === 'before') {
parentNode.children.unshift(newNodeData)
} else {
parentNode.children.push(newNodeData)
setNode(newNodeData, parentNode)
}

// 递归构建 nodeMap
if (Array.isArray(newNodeData?.children) && newNodeData.children.length) {
const newNode = getNode(newNodeData.id)
generateNodesMap(newNodeData.children, newNode)
}
setNode(newNodeData, parentNode)

// 递归构建 nodeMap
if (Array.isArray(newNodeData?.children) && newNodeData.children.length) {
const newNode = getNode(newNodeData.id)
generateNodesMap(newNodeData.children, newNode)
}

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/canvas/render/src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const generateFn = (innerFn, context) => {
}

// 这里注意如果innerFn返回的是一个promise则需要捕获异常,重新返回默认一条空数据
if (result.then) {
if (result?.then) {
result = new Promise((resolve) => {
result.then(resolve).catch((error) => {
globalNotify({
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/materials/src/composable/block-compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getBlockCompileRes = async (schema) => {

const generateCodeService = getMetaApi('engine.service.generateCode')
const blocks = await generateCodeService.getAllNestedBlocksSchema(schema, fetchBlockSchema)
const componentsMap = useResource().resState.componentsMap
const componentsMap = useResource().appSchemaState.componentsMap

// 调用 api 得到页面出码结果
let blocksSourceCode = null
Expand Down
5 changes: 2 additions & 3 deletions packages/toolbars/clean/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export default {
}
</div>
]
}
}).then((res) => {
if (res === 'confirm') {
},
exec: () => {
clearCanvas()
}
})
Expand Down
Loading