Comments (12)
👍
from contenttools.
I agree these would be useful additions, happy to add. So the new events will be:
drag
drop
(only executed if content is successfully dropped on another element that accepts the drop action)
Does that offer everything needed?
UPDATE: The drag
event would receive the element
dragged as a value. The drop
event would receive the element
dropped as well as the element being dropped onto and the placement
.
from contenttools.
How about when the drop is performed in the same place?
from contenttools.
If it's dropped on the the element above, below, left, right in such a way as to stay in the same position on the page the drop
event would still trigger, but it would be easy to check if it had moved by reviewing the element (if any) before it.
from contenttools.
Just updating the documentation for the additional events now - but feel free to use:
ContentEdit.Root.get().bind('drag', function (element) { ... });
ContentEdit.Root.get().bind('drop', function (element, target, placement) { ... });
from contenttools.
You're really fast! Thank you!
from contenttools.
Thank you!
from contenttools.
Oh, and the docs in the site are already updated too 👍
from contenttools.
Okay so I tried the new events. The drop event isn't getting triggered when the drag is cancelled - e.g. you drag it to the same place. I think it should still get triggered, since if you do something during the drag event, you can't perform an undo method on the drop event since it isn't called.
Maybe you can add a cancelled
boolean property to the object?
I have worked around this, to capture the cancelled drag event by adding a mouseover handler to the dom element after the drag event, then removing it right after.
from contenttools.
Yeah drop only trigger if the element was dropped on another valid element, I could modify the call so that the target
and placement
values for the event are null if there is no valid target?
from contenttools.
@bfintal OK you should now get an event valid or invalid - hope that helps and removes the need for the workaround :)
from contenttools.
Super thanks yet again! 👍
from contenttools.
Related Issues (20)
- Save issue - saves fine, but won't allow a second "save" HOT 5
- Making CT compatible with CSP style-src set to 'self'
- Can't edit files that were included or read by php HOT 17
- Edit multiple paragraphs at once. HOT 2
- Is there a way to change the default tag output for normal html tags HOT 2
- Missing translation in /src/scripts/ui/dialogs/table.coffee
- Problem update image classes HOT 5
- Build files to use dynamic import in pure javascript HOT 1
- How to use assign ? HOT 2
- Hot to keep style attributes on save.
- Support for Sass >= 1.33 HOT 11
- npm install failed HOT 2
- Feature: Support drag & drop of images
- The image uploader HOT 2
- Inspector bar doesn't show embedded HTML elements when wrapped with paragraph HOT 1
- Line breaks not saving
- Add class to a link
- Lazy loading of images
- Source code edit? Insert <script> tag HOT 3
- The part in italics is not the right one HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contenttools.