From f66e44e3b34b9b337b0fa6dfd2c0873433379f00 Mon Sep 17 00:00:00 2001 From: Oliver Buchtala Date: Fri, 20 Dec 2019 23:04:17 +0100 Subject: [PATCH] Append multiple panels in correct order. --- src/model/SmartFigureApi.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/model/SmartFigureApi.js b/src/model/SmartFigureApi.js index f6b40f1..2a75090 100644 --- a/src/model/SmartFigureApi.js +++ b/src/model/SmartFigureApi.js @@ -36,11 +36,12 @@ export default class SmartFigureApi extends BasicEditorApi { } this.editorSession.transaction(tx => { let newPanel - for (const assetId of assetIds) { + for (let idx = 0; idx < assetIds.length; idx++) { + const assetId = assetIds[idx] const template = cloneDeep(masterTemplate) template.image.src = assetId newPanel = documentHelpers.createNodeFromJson(tx, template) - documentHelpers.insertAt(tx, [root.id, 'panels'], insertPos, newPanel.id) + documentHelpers.insertAt(tx, [root.id, 'panels'], insertPos + idx, newPanel.id) } this._selectItem(tx, newPanel) })