react-native-web-internals
Version:
React Native for Web
12 lines (11 loc) • 485 B
JavaScript
function isSelectionValid() {
const selection = window.getSelection();
if (!selection) return !1;
const string = selection.toString(), anchorNode = selection.anchorNode, focusNode = selection.focusNode, isTextNode = anchorNode && anchorNode.nodeType === window.Node.TEXT_NODE || focusNode && focusNode.nodeType === window.Node.TEXT_NODE;
return string.length >= 1 && string !== `
` && !!isTextNode;
}
export {
isSelectionValid as default
};
//# sourceMappingURL=index.js.map