react-text-range 1.0.13 → 1.0.14

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
@@ -147,7 +147,7 @@ const useTextSelectionEditor = (initLeftPos, initRightPos, leftDrag, rightDrag,
147
147
  tailSpan.classList.value = tailClass;
148
148
  tail.surroundContents(tailSpan);
149
149
  return () => {
150
- if (textDiv.current) {
150
+ if (textDiv.current && textDiv.current.childNodes[0]) {
151
151
  textDiv.current.childNodes[0].nodeValue = textDiv.current.textContent;
152
152
  while (textDiv.current.childNodes.length > 1 && textDiv.current.lastChild) {
153
153
  textDiv.current.removeChild(textDiv.current.lastChild);
package/dist/esm/index.js CHANGED
@@ -127,7 +127,7 @@ const useTextSelectionEditor = (initLeftPos, initRightPos, leftDrag, rightDrag,
127
127
  tailSpan.classList.value = tailClass;
128
128
  tail.surroundContents(tailSpan);
129
129
  return () => {
130
- if (textDiv.current) {
130
+ if (textDiv.current && textDiv.current.childNodes[0]) {
131
131
  textDiv.current.childNodes[0].nodeValue = textDiv.current.textContent;
132
132
  while (textDiv.current.childNodes.length > 1 && textDiv.current.lastChild) {
133
133
  textDiv.current.removeChild(textDiv.current.lastChild);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-text-range",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "text selection editor for React",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",