|
| 1 | +diff --git a/dist/index.js b/dist/index.js |
| 2 | +index ad58ef1637a6e5544733f4002cd0cfcc8e43022a..b5b2d3d1a2b24340b688fe1d22e3c435da313d8d 100644 |
| 3 | +--- a/dist/index.js |
| 4 | ++++ b/dist/index.js |
| 5 | +@@ -3,13 +3,7 @@ import { Extension } from "@tiptap/core"; |
| 6 | + |
| 7 | + // src/drag-handle-plugin.ts |
| 8 | + import { computePosition } from "@floating-ui/dom"; |
| 9 | +-import { isChangeOrigin } from "@tiptap/extension-collaboration"; |
| 10 | + import { Plugin, PluginKey } from "@tiptap/pm/state"; |
| 11 | +-import { |
| 12 | +- absolutePositionToRelativePosition, |
| 13 | +- relativePositionToAbsolutePosition, |
| 14 | +- ySyncPluginKey |
| 15 | +-} from "@tiptap/y-tiptap"; |
| 16 | + |
| 17 | + // src/helpers/dragHandler.ts |
| 18 | + import { getSelectionRanges, NodeRangeSelection } from "@tiptap/extension-node-range"; |
| 19 | +@@ -220,18 +214,10 @@ var getOuterNode = (doc, pos) => { |
| 20 | + |
| 21 | + // src/drag-handle-plugin.ts |
| 22 | + var getRelativePos = (state, absolutePos) => { |
| 23 | +- const ystate = ySyncPluginKey.getState(state); |
| 24 | +- if (!ystate) { |
| 25 | +- return null; |
| 26 | +- } |
| 27 | +- return absolutePositionToRelativePosition(absolutePos, ystate.type, ystate.binding.mapping); |
| 28 | ++ return null; |
| 29 | + }; |
| 30 | + var getAbsolutePos = (state, relativePos) => { |
| 31 | +- const ystate = ySyncPluginKey.getState(state); |
| 32 | +- if (!ystate) { |
| 33 | +- return -1; |
| 34 | +- } |
| 35 | +- return relativePositionToAbsolutePosition(ystate.doc, ystate.type, relativePos, ystate.binding.mapping) || 0; |
| 36 | ++ return -1; |
| 37 | + }; |
| 38 | + var getOuterDomNode = (view, domNode) => { |
| 39 | + let tmpDomNode = domNode; |
| 40 | +@@ -341,17 +327,10 @@ var DragHandlePlugin = ({ |
| 41 | + return value; |
| 42 | + } |
| 43 | + if (tr.docChanged && currentNodePos !== -1 && element) { |
| 44 | +- if (isChangeOrigin(tr)) { |
| 45 | +- const newPos = getAbsolutePos(state, currentNodeRelPos); |
| 46 | +- if (newPos !== currentNodePos) { |
| 47 | +- currentNodePos = newPos; |
| 48 | +- } |
| 49 | +- } else { |
| 50 | +- const newPos = tr.mapping.map(currentNodePos); |
| 51 | +- if (newPos !== currentNodePos) { |
| 52 | +- currentNodePos = newPos; |
| 53 | +- currentNodeRelPos = getRelativePos(state, currentNodePos); |
| 54 | +- } |
| 55 | ++ const newPos = tr.mapping.map(currentNodePos); |
| 56 | ++ if (newPos !== currentNodePos) { |
| 57 | ++ currentNodePos = newPos; |
| 58 | ++ currentNodeRelPos = getRelativePos(state, currentNodePos); |
| 59 | + } |
| 60 | + } |
| 61 | + return value; |
0 commit comments