Open curran opened 10 months ago
I realized that this is almost the exact same issue as #426 at its core. I bet we could solve both at once.
This feature requires that we transform the insertion cursor positions (start and end) by all ShareDB ops.
Here's what I tried, from https://github.com/replit/codemirror-interact/issues/16
// This DOES NOT works fine with the 999 to 1000 transition
// TODO figure out why
onClick(text, setText, e) {
let newVal = Number(text);
const handleDrag = (e: MouseEvent) => {
if (onInteract) onInteract();
newVal += e.movementX;
if (isNaN(newVal)) return;
setText(newVal.toString());
};
// add an event listener to the document for mouse move
document.addEventListener(
'mousemove',
handleDrag,
);
// when the mouse is released, remove the event listener
document.addEventListener('mouseup', () => {
document.removeEventListener(
'mousemove',
handleDrag,
);
});
},
As a user editing a number with the interactive number dragger widget, I want to be able to continue dragging outside the code editor, so that I can get a greater range.