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: resolve some schema update issue #956

Merged
merged 3 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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()
chilingling marked this conversation as resolved.
Show resolved Hide resolved

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
Loading