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.
@@ -13,5 +13,6 @@ export declare const ReactTextRange: FC<{
13
13
  Container: TextContainer;
14
14
  children: string;
15
15
  onChange: (state: RangeState) => void;
16
+ props?: React.CSSProperties;
16
17
  }>;
17
18
  export default ReactTextRange;
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 = 'absolute';
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) }),
@@ -13,5 +13,6 @@ export declare const ReactTextRange: FC<{
13
13
  Container: TextContainer;
14
14
  children: string;
15
15
  onChange: (state: RangeState) => void;
16
+ props?: React.CSSProperties;
16
17
  }>;
17
18
  export default ReactTextRange;
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 = 'absolute';
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
@@ -13,6 +13,7 @@ declare const ReactTextRange: FC<{
13
13
  Container: TextContainer;
14
14
  children: string;
15
15
  onChange: (state: RangeState) => void;
16
+ props?: React.CSSProperties;
16
17
  }>;
17
18
 
18
19
  export { type RangeState, ReactTextRange, type TextContainer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-text-range",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "text selection editor for React",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",