* Cancels the drag * @param {MouseEvent} e
(e)
| 192 | * @param {MouseEvent} e |
| 193 | */ |
| 194 | function releaseDrag(e) { |
| 195 | const { clientX, clientY } = getClientPos(e); |
| 196 | |
| 197 | /**@type {HTMLDivElement} target tab */ |
| 198 | const $target = document.elementFromPoint(clientX, clientY); |
| 199 | const shouldCommitReorder = $parent.contains($target); |
| 200 | |
| 201 | if (shouldCommitReorder) { |
| 202 | updateDragPreview(clientX, clientY); |
| 203 | if (didReorder) { |
| 204 | updateFileList($parent); |
| 205 | } |
| 206 | } else if ( |
| 207 | $target && |
| 208 | ($target.tagName === "INPUT" || |
| 209 | $target.tagName === "TEXTAREA" || |
| 210 | $target.isContentEditable || |
| 211 | $target.closest(".cm-editor")) |
| 212 | ) { |
| 213 | // If released on an input area or CodeMirror editor |
| 214 | const filePath = editorManager.activeFile.uri; |
| 215 | if (filePath) { |
| 216 | if ($target.closest(".cm-editor")) { |
| 217 | const view = editorManager.editor; |
| 218 | view.dispatch(view.state.replaceSelection(filePath)); |
| 219 | } else { |
| 220 | $target.value += filePath; |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | const shouldSettleClone = shouldCommitReorder || didReorder; |
| 226 | |
| 227 | if (!shouldCommitReorder && didReorder) { |
| 228 | restoreInitialTabPosition(); |
| 229 | } |
| 230 | |
| 231 | finishDrag(shouldSettleClone); |
| 232 | } |
| 233 | |
| 234 | function finishDrag(shouldSettleClone) { |
| 235 | cancelAnimationFrame(animationFrame); |
nothing calls this directly
no test coverage detected