react-text-range 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -82,7 +82,7 @@ const useTextSelectionEditor = (initLeftPos, initRightPos, leftDrag, rightDrag)
|
|
|
82
82
|
const textDiv = React.useRef(null);
|
|
83
83
|
React.useEffect(() => {
|
|
84
84
|
if (textDiv.current) {
|
|
85
|
-
textDiv.current.style.position = '
|
|
85
|
+
textDiv.current.style.position = 'relative';
|
|
86
86
|
}
|
|
87
87
|
}, [textDiv]);
|
|
88
88
|
// mouse move handler
|
|
@@ -277,7 +277,7 @@ const SelectionHandler = ({ pos, grab, setGrab, left }) => {
|
|
|
277
277
|
: React.createElement(SvgQuoteRight, null)));
|
|
278
278
|
};
|
|
279
279
|
|
|
280
|
-
const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChange, }) => {
|
|
280
|
+
const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChange, props, }) => {
|
|
281
281
|
const [mouseOnLeft, setMouseOnLeft] = React.useState(false);
|
|
282
282
|
const [mouseOnRight, setMouseOnRight] = React.useState(false);
|
|
283
283
|
const [textDiv, leftHandler, rightHandler, rects] = useTextSelectionEditor(initLeftPos, initRightPos, mouseOnLeft, mouseOnRight);
|
|
@@ -289,9 +289,7 @@ const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChan
|
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
}, [leftHandler, rightHandler]);
|
|
292
|
-
return (React.createElement("div", { draggable: false, style: {
|
|
293
|
-
position: 'relative',
|
|
294
|
-
} },
|
|
292
|
+
return (React.createElement("div", { draggable: false, style: Object.assign({ position: 'relative' }, props) },
|
|
295
293
|
React.createElement(SelectionRects, { rects: rects }),
|
|
296
294
|
React.createElement(Container, { ref: textDiv }, children),
|
|
297
295
|
React.createElement(SelectionHandler, { grab: mouseOnLeft, left: true, pos: leftHandler, setGrab: (v) => setMouseOnLeft(v) }),
|
package/dist/esm/index.js
CHANGED
|
@@ -62,7 +62,7 @@ const useTextSelectionEditor = (initLeftPos, initRightPos, leftDrag, rightDrag)
|
|
|
62
62
|
const textDiv = useRef(null);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
if (textDiv.current) {
|
|
65
|
-
textDiv.current.style.position = '
|
|
65
|
+
textDiv.current.style.position = 'relative';
|
|
66
66
|
}
|
|
67
67
|
}, [textDiv]);
|
|
68
68
|
// mouse move handler
|
|
@@ -257,7 +257,7 @@ const SelectionHandler = ({ pos, grab, setGrab, left }) => {
|
|
|
257
257
|
: React__default.createElement(SvgQuoteRight, null)));
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
-
const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChange, }) => {
|
|
260
|
+
const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChange, props, }) => {
|
|
261
261
|
const [mouseOnLeft, setMouseOnLeft] = useState(false);
|
|
262
262
|
const [mouseOnRight, setMouseOnRight] = useState(false);
|
|
263
263
|
const [textDiv, leftHandler, rightHandler, rects] = useTextSelectionEditor(initLeftPos, initRightPos, mouseOnLeft, mouseOnRight);
|
|
@@ -269,9 +269,7 @@ const ReactTextRange = ({ initLeftPos, initRightPos, Container, children, onChan
|
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
}, [leftHandler, rightHandler]);
|
|
272
|
-
return (React__default.createElement("div", { draggable: false, style: {
|
|
273
|
-
position: 'relative',
|
|
274
|
-
} },
|
|
272
|
+
return (React__default.createElement("div", { draggable: false, style: Object.assign({ position: 'relative' }, props) },
|
|
275
273
|
React__default.createElement(SelectionRects, { rects: rects }),
|
|
276
274
|
React__default.createElement(Container, { ref: textDiv }, children),
|
|
277
275
|
React__default.createElement(SelectionHandler, { grab: mouseOnLeft, left: true, pos: leftHandler, setGrab: (v) => setMouseOnLeft(v) }),
|
package/dist/index.d.ts
CHANGED