Skip to content

Commit b96676c

Browse files
committed
feat(mbm-bugs): fix plugin tree visible bug & modify review
1 parent 9e373d5 commit b96676c

4 files changed

Lines changed: 14 additions & 17 deletions

File tree

packages/canvas/container/src/components/CanvasAction.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ export default {
252252
253253
const hide = () => {
254254
if (getCurrent().schema?.id) {
255-
const { clearSelect } = useCanvas().canvasApi.value
255+
const { selectNode } = useCanvas().canvasApi.value
256256
getRenderer().setCondition(getCurrent().schema.id, false)
257257
useCanvas().pageState.nodesStatus[getCurrent().schema.id] = false
258-
clearSelect()
258+
selectNode('body')
259259
}
260260
updateRect()
261261
}

packages/canvas/container/src/container.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ export const updateRect = (id?: string) => {
486486
const duration = window.getComputedStyle(element).getPropertyValue('transition-duration')
487487
let waitTime = 0
488488
if (duration) {
489-
const unit = duration.slice(-2)
490-
if (unit === 'ms') {
489+
if (duration.endsWith('ms')) {
491490
waitTime = parseFloat(duration)
492491
} else {
493492
waitTime = parseFloat(duration) * 1000
@@ -828,7 +827,6 @@ export const dragMove = (event: DragEvent, isHover: boolean) => {
828827
// type == clickTree, 为点击大纲; type == loop-id=xxx ,为点击循环数据
829828
export const selectNode = async (id: string, type?: string, isMultiple = false) => {
830829
const { node } = useCanvas().getNodeWithParentById(id) || {}
831-
832830
let element = querySelectById(id)
833831

834832
if (element && node) {
@@ -837,7 +835,6 @@ export const selectNode = async (id: string, type?: string, isMultiple = false)
837835
}
838836

839837
const nodeIsSelected = setSelectRect(id, element, { isMultiple, type, schema: node })
840-
841838
// 执行setSelectRect之后再去判断multiSelectedStates的长度
842839
if (multiSelectedStates.value.length === 1) {
843840
const { schema: node, parent, type } = multiSelectedStates.value[0]
@@ -863,6 +860,7 @@ export const selectNode = async (id: string, type?: string, isMultiple = false)
863860
if (multiSelectedStates.value.length === 1) {
864861
const { schema: node, parent, type, id } = multiSelectedStates.value[0]
865862
canvasState.emit('selected', node, parent, type, id)
863+
866864
return node
867865
} else {
868866
canvasState.emit('selected')

packages/plugins/materials/src/composable/useResource.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ const initPageOrBlock = async () => {
133133
return
134134
}
135135

136-
// url 没有 pageid 或 blockid,到当前用户有权限查看的第一页或页面首页
136+
// url 没有 pageid 或 blockid,到当前用户有权限查看的第一页(如果没有则停留在第一页)或页面首页
137137
const pageInfo = appSchemaState.pageTree.find((page) => page?.meta?.isHome) ||
138-
appSchemaState.pageTree.find(
139-
(page) =>
140-
page.componentName === COMPONENT_NAME.Page &&
141-
page?.meta?.group !== 'publicPages' &&
142-
globalState.userInfo.id === page.meta.occupier.id
143-
) || {
138+
appSchemaState.pageTree.find((page) => {
139+
if (page.componentName === COMPONENT_NAME.Page && globalState.userInfo.id === page.meta.occupier.id) {
140+
return true
141+
}
142+
return page.componentName === COMPONENT_NAME.Page && page?.meta?.group !== 'publicPages'
143+
}) || {
144144
page_content: {
145145
componentName: COMPONENT_NAME.Page
146146
}

packages/plugins/tree/src/Main.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
:name="eyeOpen(row.id) ? 'eye' : 'eye-invisible'"
3232
@click="showNode($event, row.rawData)"
3333
></svg-icon>
34-
<svg-icon name="delete" @click="delNode(row.rawData)"></svg-icon>
34+
<svg-icon name="delete" @mouseup="delNode(row.rawData)"></svg-icon>
3535
</template>
3636
</div>
3737
</template>
@@ -155,14 +155,13 @@ export default {
155155
const showNode = (event, data) => {
156156
pageState.nodesStatus[data.id] = !(pageState.nodesStatus[data.id] !== false)
157157
data.show = pageState.nodesStatus[data.id]
158-
159-
const { getRenderer, clearSelect } = useCanvas().canvasApi.value
158+
const { getRenderer, selectNode } = useCanvas().canvasApi.value
160159
161160
getRenderer().setCondition(data.id, data.show)
162161
163162
if (!data.show) {
164163
event.stopPropagation()
165-
clearSelect()
164+
selectNode('body', 'clickTree')
166165
}
167166
}
168167

0 commit comments

Comments
 (0)