'use client' import type { Editor } from '@tiptap/react' import { LinkMain } from '@admin/components/custom/content-editor/tiptap-ui/link-popover/link-main' import { useLinkPopover } from '@admin/hooks/content-editor/use-link-popover' import { ContentEditorFocusSheet } from './content-editor-focus-sheet' // The phone focus view's link form, in a sheet right above the keyboard: paste or edit the URL of // the selection, then Insert (or remove an existing link). export function ContentEditorLinkSheet({ editor, onClose }: { editor: Editor onClose: () => void }) { const { url, setUrl, setLink, removeLink } = useLinkPopover({ editor }) // The URL field held focus, so closing hands it back to the editor (inside the tap), which keeps // the keyboard up for writing. const close = () => { onClose() editor.view.focus() } return ( { setLink() close() }} removeLink={() => { removeLink() close() }} className="min-w-0 [&_[data-slot=input-group]]:h-11 [&_[data-slot=input-group]]:w-full [&_button]:h-11" /> ) }