Browse Source

fix structure export bug

Yana Rose 4 years ago
parent
commit
9481150388
2 changed files with 6 additions and 2 deletions
  1. 4 0
      CHANGELOG.md
  2. 2 2
      src/viewer/helpers/export.ts

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [1.3.4] - 2021-03-25
+### Bug fixes
+- structure export: getting children for a referenced node correctly
+
 ## [1.3.3] - 2021-03-24
 ### Bug fixes
 - build

+ 2 - 2
src/viewer/helpers/export.ts

@@ -62,8 +62,8 @@ function extractStructureDataFromState(plugin: PluginContext): { [k: string]: St
     for (let i = 0; i < cells.length; i++) {
         const c = cells[i];
         const nodeRef = getDecorator(plugin, c.transform.ref);
-        const children = plugin.state.data.select(StateSelection.Generators.byRef(nodeRef))
-            .map(child => child.obj!.data);
+        const children = plugin.state.data.tree.children.get(nodeRef).toArray()
+            .map(x => plugin.state.data.select(StateSelection.Generators.byRef(x!))[0].obj!.data as Structure);
         const sele = StructureSelection.Sequence(c.obj!.data, children);
         const structure = StructureSelection.unionStructure(sele);
         const name = `${i + 1}-${structure.model.entryId}`;