fix: 🐛 save and generator last page

This commit is contained in:
春希 2020-07-28 13:30:13 +08:00
parent 6c3ae36bca
commit 3e4254c9d3
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,6 @@ const Codeout = ({ editor }: PluginProps) => {
})); }));
const fullSchema = { const fullSchema = {
...designer.schema,
config: { config: {
historyMode: 'hash', historyMode: 'hash',
targetRootID: 'J_Container', targetRootID: 'J_Container',
@ -47,6 +46,7 @@ const Codeout = ({ editor }: PluginProps) => {
name: 'demoproject', name: 'demoproject',
}, },
componentsMap, componentsMap,
componentsTree: [designer.schema.componentsTree[designer.schema.componentsTree.length - 1]],
}; };
console.info('codeout schema:', fullSchema); console.info('codeout schema:', fullSchema);

View File

@ -24,7 +24,7 @@ const Codeout = ({ editor }: PluginProps) => {
const handleSaveClick = () => { const handleSaveClick = () => {
const designer = editor.get(Designer); const designer = editor.get(Designer);
if (designer) { if (designer) {
const schema = designer.schema.componentsTree[0]; // editor.get('schema'); const schema = designer.schema.componentsTree[designer.schema.componentsTree.length - 1]; // editor.get('schema');
const schemaStr = JSON.stringify(schema); const schemaStr = JSON.stringify(schema);
window.localStorage.setItem('schema_data', schemaStr); window.localStorage.setItem('schema_data', schemaStr);
console.info('save schema:', schemaStr); console.info('save schema:', schemaStr);