力皓 5e6e91b265 fix: 修复 project.unload 无法正常删除 document 的 bug
chore(test): 部分完成 pages / api 等兼容测试

chore(test): 完成部分 prototype 单测
2020-11-09 09:59:42 +08:00

26 lines
661 B
TypeScript

import { globalContext, Editor } from '@ali/lowcode-editor-core';
interface Variable {
type: 'variable';
variable: string;
value: any;
}
export function isVariable(obj: any): obj is Variable {
return obj && obj.type === 'variable';
}
export function getCurrentFieldIds() {
const editor = globalContext.get(Editor);
const designer = editor.get('designer');
const fieldIds: any = [];
const nodesMap = designer?.currentDocument?.nodesMap || new Map();
nodesMap.forEach((curNode: any) => {
const fieldId = nodesMap?.get(curNode.id)?.getPropValue('fieldId');
if (fieldId) {
fieldIds.push(fieldId);
}
});
return fieldIds;
}