import { useContext } from "react";
import { EditorContext } from "./../../../ricos-context/index.js";
import { isTextSelection } from "./../../../editor-common/index.js";
const useIsVisible = () => {
  const editor = useContext(EditorContext);
  const { selection, doc } = editor.adapter.tiptapEditor.state;
  if (selection.empty) {
    return false;
  }
  let hasNonEmptyParagraph = false;
  doc.nodesBetween(selection.from, selection.to, (node) => {
    if (node.type.name === "text" && node.text !== "") {
      hasNonEmptyParagraph = true;
      return false;
    }
  });
  return hasNonEmptyParagraph && isTextSelection(selection);
};
export {
  useIsVisible
};
//# sourceMappingURL=use-is-visible.js.map
