From ece0083047421d849fe1c7d84541946996fb9b09 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 13 Jan 2018 00:11:07 +0100 Subject: [PATCH] Enable native D&D by default but skip it for components --- src/block_manager/view/BlockView.js | 2 ++ src/dom_components/model/Component.js | 2 +- src/editor/config/config.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/block_manager/view/BlockView.js b/src/block_manager/view/BlockView.js index ad3984e96..99fd15bb4 100644 --- a/src/block_manager/view/BlockView.js +++ b/src/block_manager/view/BlockView.js @@ -32,6 +32,8 @@ module.exports = Backbone.View.extend({ handleDragStart(ev) { const content = this.model.get('content'); + // Firefox requires setData + ev.dataTransfer.setData('text', null); // Can't put the content in dataTransfer as it will not be available // on `dragenter` event for security reason this.config.em.set('dragContent', content); diff --git a/src/dom_components/model/Component.js b/src/dom_components/model/Component.js index 2e5fb596a..e21b6b315 100644 --- a/src/dom_components/model/Component.js +++ b/src/dom_components/model/Component.js @@ -498,7 +498,7 @@ const Component = Backbone.Model.extend(Styleable).extend( if (model.get('draggable')) { tb.push({ attributes: { class: 'fa fa-arrows', draggable: true }, - events: hasDnd(this.em) ? { dragstart: 'execCommand' } : '', + //events: hasDnd(this.em) ? { dragstart: 'execCommand' } : '', command: 'tlb-move' }); } diff --git a/src/editor/config/config.js b/src/editor/config/config.js index 5741697ef..50392fbbe 100644 --- a/src/editor/config/config.js +++ b/src/editor/config/config.js @@ -60,7 +60,7 @@ module.exports = { jsInHtml: true, // Enable native HTML5 drag and drop - nativeDnD: 0, + nativeDnD: 1, // Show the wrapper component in the final code, eg. in editor.getHtml() exportWrapper: 0,