git commit -m 更新lowcode-editor-skeleton

This commit is contained in:
荣彬 2020-07-31 21:31:59 +08:00
parent 521a0a1b41
commit eff31183c1
2 changed files with 17 additions and 13 deletions

View File

@ -17,7 +17,7 @@
"dependencies": { "dependencies": {
"@ali/lowcode-designer": "^0.9.31", "@ali/lowcode-designer": "^0.9.31",
"@ali/lowcode-editor-core": "^0.8.24", "@ali/lowcode-editor-core": "^0.8.24",
"@ali/lowcode-editor-skeleton": "^0.8.37", "@ali/lowcode-editor-skeleton": "^0.8.38-beta1",
"@ali/lowcode-plugin-designer": "^0.9.31", "@ali/lowcode-plugin-designer": "^0.9.31",
"@ali/lowcode-plugin-outline-pane": "^0.8.37", "@ali/lowcode-plugin-outline-pane": "^0.8.37",
"@ali/ve-i18n-util": "^2.0.0", "@ali/ve-i18n-util": "^2.0.0",

View File

@ -41,19 +41,21 @@ const pages = Object.assign(project, {
if (componentsTree[0]) { if (componentsTree[0]) {
componentsTree[0].componentName = componentsTree[0].componentName || 'Page'; componentsTree[0].componentName = componentsTree[0].componentName || 'Page';
// FIXME // FIXME
if (componentsTree[0].componentName === 'Page' || if (componentsTree[0].componentName === 'Page' || componentsTree[0].componentName === 'Component') {
componentsTree[0].componentName === 'Component') {
componentsTree[0].lifeCycles = {}; componentsTree[0].lifeCycles = {};
componentsTree[0].methods = {}; componentsTree[0].methods = {};
} }
} }
} }
project.load({ project.load(
version: '1.0.0', {
componentsMap: [], version: '1.0.0',
componentsTree, componentsMap: [],
}, true); componentsTree,
},
true,
);
}, },
addPage(data: OldPageData | RootSchema) { addPage(data: OldPageData | RootSchema) {
if (isPageDataV1(data)) { if (isPageDataV1(data)) {
@ -90,18 +92,20 @@ const pages = Object.assign(project, {
return project.onCurrentDocumentChange(fn); return project.onCurrentDocumentChange(fn);
}, },
toData() { toData() {
return project.documents.map(doc => doc.toData()); return project.documents.map((doc) => doc.toData());
} },
}); });
Object.defineProperty(pages, 'currentPage', { Object.defineProperty(pages, 'currentPage', {
get() { get() {
return project.currentDocument; return project.currentDocument;
} },
}) });
pages.onCurrentPageChange((page: DocumentModel) => { pages.onCurrentPageChange((page: DocumentModel) => {
if (!page) { return; } if (!page) {
return;
}
page.acceptRootNodeVisitor('NodeCache', (rootNode) => { page.acceptRootNodeVisitor('NodeCache', (rootNode) => {
const visitor: NodeCacheVisitor = page.getRootNodeVisitor('NodeCache'); const visitor: NodeCacheVisitor = page.getRootNodeVisitor('NodeCache');
if (visitor) { if (visitor) {