| | 2 | |
| | 3 | This [https://github.com/cksource/ckeditor-dev/blob/d13c4a7c065fd6cb5269cab86342d45084c96fbf/plugins/clipboard/plugin.js#L1397 comment] is very incisive. The problem here is following: |
| | 4 | |
| | 5 | '''Step 0:''' Beginning: |
| | 6 | {{{ |
| | 7 | <div> |
| | 8 | <widget></widget> |
| | 9 | </div> |
| | 10 | }}} |
| | 11 | |
| | 12 | '''Step 1:''' Creating drag boomark (this code made mess with range offsets - see next bookmark creation) |
| | 13 | {{{ |
| | 14 | <div> |
| | 15 | <bookmark drag start> |
| | 16 | <widget></widget> |
| | 17 | <bookmark drag end> |
| | 18 | </div> |
| | 19 | }}} |
| | 20 | |
| | 21 | '''Step 2:''' Creating drop boomark |
| | 22 | {{{ |
| | 23 | <div> |
| | 24 | <bookmark drag start> |
| | 25 | <widget></widget> |
| | 26 | <bookmark drop /> |
| | 27 | <bookmark drag end> |
| | 28 | </div> |
| | 29 | }}} |
| | 30 | Drop bookmark should be after drag end bookmark but it's in wrong position because adding <bookmark drag start> reorganised offset (++) |
| | 31 | |
| | 32 | ---- |
| | 33 | |
| | 34 | If we switch order of step first and the second we will fix this issue, but creates a new one the other way around (drag not right after but right before). |
| | 35 | {{{ |
| | 36 | <div> |
| | 37 | <bookmark drag start> |
| | 38 | <bookmark drop /> |
| | 39 | <widget></widget> |
| | 40 | <bookmark drag end> |
| | 41 | </div> |
| | 42 | }}} |
| | 43 | |
| | 44 | We could introduce some mechanism for updating selection on bookmark creation but it might be painfull and time consuming. What I suggest instead is to right before starting internal drag, check whether there is something to do with it i.e. whether it will change something. |
| | 45 | |
| | 46 | We can simply do it by comparing (drag end with drop end) or (drap start with drop start). If they are the same we don't have to do nothing. |