Skip to content

Commit

Permalink
fix(canvas/render): fix edited page not refresh on children page, fix…
Browse files Browse the repository at this point in the history
… pageSection should not be able to drag,remove post css warning (opentiny#1060)
  • Loading branch information
rhlin authored Jan 23, 2025
1 parent 5162ab4 commit fe04e1b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function defaultRenderer(schema, refreshKey, entry, active, isPage = true) {
const rootChildrenSchema = {
id: 0,
componentName: 'div',
componentType: 'PageSection',
// 手动添加一个唯一的属性,后续在画布选中此节点时方便处理额外的逻辑。由于没有修改schema,不会影响出码
props: { ...schema.props, 'data-id': 'root-container', 'data-page-active': active },
children: schema.children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import postcss from 'postcss'
import scopedPlugin from './scope-css-plugin'

export function handleScopedCss(id: string, content: string) {
return postcss([scopedPlugin(id)]).process(content)
return postcss([scopedPlugin(id)]).process(content, { from: undefined })
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const wrapPageComponent = (pageId: string) => {
() => active.value,
(activeValue) => {
if (!activeValue) {
asyncData.value = null
updateSchema()
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/canvas/render/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const checkGroup = (componentName) => configure[componentName]?.nestingRule?.chi
const clickCapture = (componentName) => configure[componentName]?.clickCapture !== false

const getBindProps = (schema, scope, context, pageContext) => {
const { id, componentName } = schema
const { id, componentName, componentType } = schema
const invalidity = configure[componentName]?.invalidity || []

if (componentName === 'CanvasPlaceholder') {
Expand Down Expand Up @@ -120,7 +120,7 @@ const getBindProps = (schema, scope, context, pageContext) => {
delete bindProps.className

// 使画布中元素可拖拽
if (active) {
if (active && !['PageStart', 'PageSection'].includes(componentType)) {
bindProps.draggable = true
}

Expand Down

0 comments on commit fe04e1b

Please sign in to comment.