From cf549a13e7000d85dfdcea29809326f158a0574c Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 13 Mar 2022 17:04:44 -0300 Subject: [PATCH] Fix order --- packages/editor/test/playground/map-render/js/editor.tsx | 2 +- packages/editor/test/playground/map-render/samples/order.wxml | 1 + .../mindplot/src/components/persistence/XMLSerializerTango.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 packages/editor/test/playground/map-render/samples/order.wxml diff --git a/packages/editor/test/playground/map-render/js/editor.tsx b/packages/editor/test/playground/map-render/js/editor.tsx index bc09334b..5a318e0c 100644 --- a/packages/editor/test/playground/map-render/js/editor.tsx +++ b/packages/editor/test/playground/map-render/js/editor.tsx @@ -30,7 +30,7 @@ const initialization = (designer: Designer) => { }); }; -const persistence = new LocalStorageManager('samples/{id}.wxml', false); +const persistence = new LocalStorageManager('samples/{id}.wxml', false, false); const mapId = 'welcome'; const options: EditorOptions = { zoom: 0.8, diff --git a/packages/editor/test/playground/map-render/samples/order.wxml b/packages/editor/test/playground/map-render/samples/order.wxml new file mode 100644 index 00000000..b0599b02 --- /dev/null +++ b/packages/editor/test/playground/map-render/samples/order.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/mindplot/src/components/persistence/XMLSerializerTango.ts b/packages/mindplot/src/components/persistence/XMLSerializerTango.ts index fbd98485..a0a47be0 100644 --- a/packages/mindplot/src/components/persistence/XMLSerializerTango.ts +++ b/packages/mindplot/src/components/persistence/XMLSerializerTango.ts @@ -411,6 +411,7 @@ class XMLSerializerTango implements XMLMindmapSerializer { if (topic.getType() !== 'CentralTopic') { topic .getChildren() + .sort((a, b) => a.getOrder() - b.getOrder()) .forEach((child, index) => { if (child.getOrder() !== index) { child.setOrder(index);