diff --git a/src/commands/index.js b/src/commands/index.js index 1df3a6e29..0c21b751e 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -132,10 +132,11 @@ module.exports = () => { const selAll = [...ed.getSelectedAll()]; const toolbarStyle = ed.Canvas.getToolbarEl().style; const nativeDrag = event && event.type == 'dragstart'; + const defComOptions = { preserveSelected: 1 }; const hideTlb = () => { toolbarStyle.display = 'none'; - em.stopDefault(); + em.stopDefault(defComOptions); }; if (!sel || !sel.get('draggable')) { @@ -155,7 +156,8 @@ module.exports = () => { }; const onEnd = (e, opts) => { - em.runDefault(); + em.runDefault(defComOptions); + selAll.forEach(sel => sel.set('status', 'selected')); ed.select(selAll); sel.emitUpdate(); dragger && dragger.blur(); diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 0734d2ef3..360f4ee3c 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -1,4 +1,4 @@ -import { isUndefined, defaults, isArray } from 'underscore'; +import { isUndefined, defaults, isArray, contains } from 'underscore'; import { getModel } from 'utils/mixins'; const deps = [ @@ -236,7 +236,9 @@ module.exports = Backbone.Model.extend({ const multiple = isArray(el); const els = multiple ? el : [el]; const selected = this.get('selected'); - multiple && selected.remove(selected.models); + + // Don't remove alredy selected components + multiple && selected.remove(selected.filter(sel => !contains(els, sel))); els.forEach(el => { const model = getModel(el, $);