Skip to content

Commit 1064425

Browse files
authored
fix(editor): 修复部分场景下获取不到region的情况 (#10354)
Co-authored-by: qinhaoyan <[email protected]>
1 parent f6f274b commit 1064425

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/amis-editor-core/src/component/Breadcrumb.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ export default class Breadcrumb extends React.Component<
218218
const nearby: Array<EditorNodeType> = (
219219
item.parent as EditorNodeType
220220
)?.uniqueChildren;
221-
221+
const region =
222+
item.region ||
223+
item.childRegions.find((i: any) => i.region)?.region;
222224
return (
223225
<li key={index}>
224226
<span
225227
data-node-id={item.id}
226-
data-node-region={item.region}
228+
data-node-region={region}
227229
onClick={this.handleClick}
228230
onMouseEnter={this.handleMouseEnter}
229231
>

packages/amis-editor-core/src/plugin/BasicToolbar.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ export class BasicToolbarPlugin extends BasePlugin {
260260
const node = store.getNodeById(id)!;
261261
const paths = store.getNodePathById(id);
262262
const first = paths.pop()!;
263+
region = region || node.childRegions.find(i => i.region)?.region;
263264
const host = node.host as EditorNodeType;
264265
const regionNode = node.parent as EditorNodeType;
265266

@@ -279,7 +280,7 @@ export class BasicToolbarPlugin extends BasePlugin {
279280
id: 'unselect',
280281
label: '取消多选',
281282
icon: 'cancel-icon',
282-
onSelect: () => store.setActiveId(id)
283+
onSelect: () => store.setActiveId(id, region)
283284
});
284285

285286
menus.push({

0 commit comments

Comments
 (0)