fix: 修复兼容报错

This commit is contained in:
liujuping 2022-12-13 15:34:23 +08:00
parent 77fc3f2db2
commit 080102db5b
2 changed files with 13 additions and 12 deletions

View File

@ -1,3 +1,4 @@
import { IPublicModelNode } from './../../../types/src/shell/model/node';
import { Editor, globalContext } from '@alilc/lowcode-editor-core';
import { isFormEvent } from '@alilc/lowcode-utils';
import {
@ -24,16 +25,16 @@ export function isInLiveEditing() {
}
/* istanbul ignore next */
function getNextForSelect(next: any, head?: any, parent?: any): any {
function getNextForSelect(next: IPublicModelNode | null, head?: any, parent?: IPublicModelNode | null): any {
if (next) {
if (!head) {
return next;
}
let ret;
if (next.isContainer()) {
const children = next.getChildren() || [];
if (children && !children.isEmpty()) {
if (next.isContainer) {
const children = next.children;
if (children && !children.isEmpty) {
ret = getNextForSelect(children.get(0));
if (ret) {
return ret;
@ -48,19 +49,19 @@ function getNextForSelect(next: any, head?: any, parent?: any): any {
}
if (parent) {
return getNextForSelect(parent.nextSibling, false, parent.getParent());
return getNextForSelect(parent.nextSibling, false, parent?.parent);
}
return null;
}
/* istanbul ignore next */
function getPrevForSelect(prev: any, head?: any, parent?: any): any {
function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IPublicModelNode | null): any {
if (prev) {
let ret;
if (!head && prev.isContainer()) {
const children = prev.getChildren() || [];
const lastChild = children && !children.isEmpty() ? children.get(children.size - 1) : null;
if (!head && prev.isContainer) {
const children = prev.children;
const lastChild = children && !children.isEmpty ? children.get(children.size - 1) : null;
ret = getPrevForSelect(lastChild);
if (ret) {

View File

@ -10,11 +10,11 @@ export default class NodeChildren implements IPublicModelNodeChildren {
this[nodeChildrenSymbol] = nodeChildren;
}
static create(nodeChldren: InnerNodeChildren | null): IPublicModelNodeChildren | null {
if (!nodeChldren) {
static create(nodeChildren: InnerNodeChildren | null): IPublicModelNodeChildren | null {
if (!nodeChildren) {
return null;
}
return new NodeChildren(nodeChldren);
return new NodeChildren(nodeChildren);
}
/**