fix(editor): 修复部分场景下获取不到region的情况 (#10354)

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
This commit is contained in:
qkiroc 2024-05-31 12:34:03 +08:00 committed by GitHub
parent f6f274b6d7
commit 1064425e3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -218,12 +218,14 @@ export default class Breadcrumb extends React.Component<
const nearby: Array<EditorNodeType> = (
item.parent as EditorNodeType
)?.uniqueChildren;
const region =
item.region ||
item.childRegions.find((i: any) => i.region)?.region;
return (
<li key={index}>
<span
data-node-id={item.id}
data-node-region={item.region}
data-node-region={region}
onClick={this.handleClick}
onMouseEnter={this.handleMouseEnter}
>

View File

@ -260,6 +260,7 @@ export class BasicToolbarPlugin extends BasePlugin {
const node = store.getNodeById(id)!;
const paths = store.getNodePathById(id);
const first = paths.pop()!;
region = region || node.childRegions.find(i => i.region)?.region;
const host = node.host as EditorNodeType;
const regionNode = node.parent as EditorNodeType;
@ -279,7 +280,7 @@ export class BasicToolbarPlugin extends BasePlugin {
id: 'unselect',
label: '取消多选',
icon: 'cancel-icon',
onSelect: () => store.setActiveId(id)
onSelect: () => store.setActiveId(id, region)
});
menus.push({