Refactor Editor components to be injected by associated extension (#6093)

This commit is contained in:
Tom Moor
2023-10-31 21:55:55 -04:00
committed by GitHub
parent 44198732d3
commit df6d8c12cc
25 changed files with 371 additions and 354 deletions

View File

@@ -24,7 +24,7 @@ const POINTER_WIDTH = 22;
type Props = {
/** The HTML element that is being hovered over, or null if none. */
element: HTMLAnchorElement | null;
element: HTMLElement | null;
/** A callback on close of the hover preview. */
onClose: () => void;
};
@@ -35,7 +35,7 @@ enum Direction {
}
function HoverPreviewDesktop({ element, onClose }: Props) {
const url = element?.href || element?.dataset.url;
const url = element?.getAttribute("href") || element?.dataset.url;
const previousUrl = usePrevious(url, true);
const [isVisible, setVisible] = React.useState(false);
const timerClose = React.useRef<ReturnType<typeof setTimeout>>();
@@ -200,7 +200,7 @@ function useHoverPosition({
isVisible,
}: {
cardRef: React.RefObject<HTMLDivElement>;
element: HTMLAnchorElement | null;
element: HTMLElement | null;
isVisible: boolean;
}) {
const [cardLeft, setCardLeft] = React.useState(0);