Skip to content

Commit

Permalink
Append multiple panels in correct order.
Browse files Browse the repository at this point in the history
  • Loading branch information
obuchtala committed Dec 20, 2019
1 parent 22f45fc commit f66e44e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/SmartFigureApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit f66e44e

Please sign in to comment.