These are chat archives for GetmeUK/ContentTools
@Yopi - so I copied your code in to my sandbox demo in the repo and the element you create is draggable for me. The only thing I had to do was insert the element into the html with the following format:
<div data-ce-tag="yogobe-readmore" width="200" height="200" style="display: block; background: red; width: 200px; height: 200px;"></div>
But this is because I'm missing any CSS for the element. Other than that using your code and the HTML above I get a red box I can drag vertically above and below elements.
ContentEdit.Element._dropBothbut restricted the replacements to just
@placements: ['above', 'below']when you probably want @placements: ['above', 'below', 'left', 'right'] - you will however need CSS in place to handle the element being left/right aligned
_onMouseDown: (ev) -> # Give the element focus super(ev) # We add a small delay to prevent drag engaging instantly clearTimeout(@_dragTimeout) @_dragTimeout = setTimeout( () => @drag(ev.pageX, ev.pageY) 150 ) _onMouseOver: (ev) -> super(ev) # Don't highlight that we're over the element @_removeCSSClass('ce-element--over') _onMouseUp: (ev) -> super(ev) # If we're waiting to see if the user wants to drag the element, stop # waiting they don't. if @_dragTimeout clearTimeout(@_dragTimeout)