fixes and cleanups

This commit is contained in:
Philipinho
2024-06-26 19:16:40 +01:00
parent fde6c9a2e3
commit e2646b7afc
6 changed files with 33 additions and 33 deletions

View File

@ -4,7 +4,7 @@ import {
isNodeSelection,
useEditor,
} from "@tiptap/react";
import { FC, memo, useEffect, useRef, useState } from "react";
import { FC, useEffect, useRef, useState } from "react";
import {
IconBold,
IconCode,
@ -24,7 +24,7 @@ import {
} from "@/features/comment/atoms/comment-atom";
import { useAtom } from "jotai";
import { v4 as uuidv4 } from "uuid";
import { isCellSelection } from "@docmost/editor-ext";
import { isCellSelection, isTextSelected } from "@docmost/editor-ext";
import { LinkSelector } from "@/features/editor/components/bubble-menu/link-selector.tsx";
export interface BubbleMenuItem {
@ -110,7 +110,7 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
) {
return false;
}
return true;
return isTextSelected(editor);
},
tippyOptions: {
moveTransition: "transform 0.15s ease-out",

View File

@ -4,11 +4,6 @@ import { ActionIcon, Popover, Tooltip } from "@mantine/core";
import { useEditor } from "@tiptap/react";
import { LinkEditorPanel } from "@/features/editor/components/link/link-editor-panel.tsx";
export interface BubbleColorMenuItem {
name: string;
color: string;
}
interface LinkSelectorProps {
editor: ReturnType<typeof useEditor>;
isOpen: boolean;
@ -22,11 +17,10 @@ export const LinkSelector: FC<LinkSelectorProps> = ({
}) => {
const onLink = useCallback(
(url: string) => {
editor.chain().focus().setLink({ href: url }).run();
setIsOpen(false);
console.log("is p[e ");
editor.chain().focus().setLink({ href: url }).run();
},
[editor],
[editor, setIsOpen],
);
return (