diff --git a/src/commands/index.js b/src/commands/index.js index 219d7cb86..445a3f925 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -147,17 +147,21 @@ module.exports = () => { const event = opts && opts.event; const sel = ed.getSelected(); const toolbarStyle = ed.Canvas.getToolbarEl().style; + const nativeDrag = event.type == 'dragstart'; - setTimeout(() => { + const hideTlb = () => { toolbarStyle.display = 'none'; em.stopDefault(); - }, 0); + }; if (!sel || !sel.get('draggable')) { console.warn('The element is not draggable'); return; } + // Without setTimeout the ghost image disappears + nativeDrag ? setTimeout(() => hideTlb, 0) : hideTlb(); + const onStart = (e, opts) => { console.log('start mouse pos ', opts.start); console.log('el rect ', opts.elRect); @@ -190,7 +194,7 @@ module.exports = () => { } }); } else { - if (event.type == 'dragstart') { + if (nativeDrag) { event.dataTransfer.setDragImage(sel.view.el, 0, 0); //sel.set('status', 'freezed'); }