Skip to content

Commit

Permalink
Don't trigger component:add when components are just moved. Fixes G…
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Feb 18, 2018
1 parent 50cc585 commit 1fe03dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
20 changes: 0 additions & 20 deletions src/asset_manager/view/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,26 +289,6 @@ module.exports = Backbone.View.extend(
videoNode.src = fileURL
*/

/*
// Show local video files, http://jsfiddle.net/dsbonev/cCCZ2/embedded/result,js,html,css/
var URL = window.URL || window.webkitURL
var file = this.files[0]
var type = file.type
var videoNode = document.createElement('video');
var canPlay = videoNode.canPlayType(type) // can use also for 'audio' types
if (canPlay === '') canPlay = 'no'
var message = 'Can play type "' + type + '": ' + canPlay
var isError = canPlay === 'no'
displayMessage(message, isError)
if (isError) {
return
}
var fileURL = URL.createObjectURL(file)
videoNode.src = fileURL
*/

// If it's an image, try to find its size
if (type === 'image') {
const data = {
Expand Down
11 changes: 5 additions & 6 deletions src/dom_components/view/ComponentsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ module.exports = Backbone.View.extend({

/**
* Add to collection
* @param {Object} Model
*
* @return void
* @param {Model} model
* @param {Collection} coll
* @param {Object} opts
* @private
* */
addTo(model) {
addTo(model, coll = {}, opts = {}) {
const em = this.config.em;
const i = this.collection.indexOf(model);
this.addToCollection(model, null, i);

if (em && !model.opt.temporary) {
em.trigger('add:component', model); // @deprecated
if (em && !opts.temporary) {
em.trigger('component:add', model);
}
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/Sorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ module.exports = Backbone.View.extend({

if (!dropContent) {
// Putting `avoidStore` here will make the UndoManager behave wrong
opts.temporary = 1;
modelTemp = targetCollection.add({}, { ...opts });

if (model) {
Expand Down

0 comments on commit 1fe03dd

Please sign in to comment.