mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-02 21:50:47 +00:00
fix: 修复切换 document 时报错
This commit is contained in:
parent
06491f90fa
commit
1ad2749c97
@ -140,7 +140,7 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
|
|||||||
const { nodes } = dragObject;
|
const { nodes } = dragObject;
|
||||||
|
|
||||||
const tree = this._master?.currentTree;
|
const tree = this._master?.currentTree;
|
||||||
if (!tree || !this._shell) {
|
if (!tree || !tree.root || !this._shell) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,11 @@ export class Tree {
|
|||||||
|
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
||||||
@computed get root(): TreeNode {
|
@computed get root(): TreeNode | null {
|
||||||
return this.getTreeNode(this.document.focusNode!);
|
if (this.document.focusNode) {
|
||||||
|
return this.getTreeNode(this.document.focusNode!);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(readonly document: DocumentModel) {
|
constructor(readonly document: DocumentModel) {
|
||||||
|
|||||||
@ -150,6 +150,9 @@ export default class TreeView extends Component<{ tree: Tree }> {
|
|||||||
render() {
|
render() {
|
||||||
const { tree } = this.props;
|
const { tree } = this.props;
|
||||||
const { root } = tree;
|
const { root } = tree;
|
||||||
|
if (!root) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="lc-outline-tree"
|
className="lc-outline-tree"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user