Skip to content

Commit

Permalink
fix: resolve some schema update issue
Browse files Browse the repository at this point in the history
1. 调整画布宽度时,画布选中框不及时更新的 bug
2. 空页面的时候,拖拽组件到画布提示两次新建页面的 bug
3. importSchema 的时候,清空选择
4. 页面 schema 保存的时候,设置保存状态为 false
5. 增强 AdvanceConfig 配置对 props 的容错
  • Loading branch information
chilingling committed Dec 24, 2024
1 parent 526cfd4 commit cfe0555
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/canvas/DesignCanvas/src/DesignCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
const showConfirm = !isSaved || pageSchema !== oldPageSchema
if (!showConfirm || showModal) {
if (!showConfirm || showModal || useHistory().historyState?.index === 0) {
return
}
Expand Down
2 changes: 2 additions & 0 deletions packages/canvas/DesignCanvas/src/api/useCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ const importSchema = (data) => {
resetCanvasState({
pageSchema: importData
})

canvasApi.value?.clearSelect?.()
}

const exportSchema = () => {
Expand Down
11 changes: 10 additions & 1 deletion packages/canvas/container/src/components/CanvasResize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</template>
<script>
import { ref, computed, watch, nextTick } from 'vue'
import { useLayout } from '@opentiny/tiny-engine-meta-register'
import { useLayout, useCanvas } from '@opentiny/tiny-engine-meta-register'
import { canvasState } from '../container'
export default {
Expand Down Expand Up @@ -106,6 +106,15 @@ export default {
{ flush: 'post' }
)
watch(
() => sizeStyle.value,
async () => {
await nextTick()
useCanvas().canvasApi.value?.updateRect?.()
}
)
return {
onMouseDown,
onMouseMove,
Expand Down
6 changes: 5 additions & 1 deletion packages/plugins/schema/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ export default {
componentName: pageState.pageSchema.componentName
}
useCanvas().importSchema(value)
const { importSchema, setSaved } = useCanvas()
importSchema(value)
setSaved(false)
// TODO: 历史堆栈
// useHistory().addHistory()
state.pageData = ''
Expand Down
2 changes: 1 addition & 1 deletion packages/settings/events/src/components/AdvanceConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default {
}
const isNumber = Number(value).toString() !== 'NaN'
let newPropsKey = schema.props.key
let newPropsKey = schema.props?.key
if (value && !isNumber) {
newPropsKey = {
Expand Down

0 comments on commit cfe0555

Please sign in to comment.