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

View File

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