diff --git a/packages/editor/document-editor/src/ui/components/page-renderer.tsx b/packages/editor/document-editor/src/ui/components/page-renderer.tsx index 72c4c8b46..c60ac0e7a 100644 --- a/packages/editor/document-editor/src/ui/components/page-renderer.tsx +++ b/packages/editor/document-editor/src/ui/components/page-renderer.tsx @@ -27,11 +27,20 @@ type IPageRenderer = { }) => void; editorClassNames: string; editorContentCustomClassNames?: string; + hideDragHandle?: () => void; readonly: boolean; }; export const PageRenderer = (props: IPageRenderer) => { - const { documentDetails, editor, editorClassNames, editorContentCustomClassNames, updatePageTitle, readonly } = props; + const { + documentDetails, + editor, + editorClassNames, + editorContentCustomClassNames, + updatePageTitle, + readonly, + hideDragHandle, + } = props; const [pageTitle, setPagetitle] = useState(documentDetails.title); @@ -65,14 +74,6 @@ export const PageRenderer = (props: IPageRenderer) => { setIsOpen(false); }; - const switchLinkView = (view: "LinkPreview" | "LinkEditView" | "LinkInputView") => { - if (!linkViewProps) return; - setLinkViewProps({ - ...linkViewProps, - view: view, - }); - }; - const handleLinkHover = useCallback( (event: React.MouseEvent) => { if (!editor) return; @@ -167,7 +168,7 @@ export const PageRenderer = (props: IPageRenderer) => { /> )}
- +
diff --git a/packages/editor/document-editor/src/ui/extensions/index.tsx b/packages/editor/document-editor/src/ui/extensions/index.tsx index ca023f4a7..7de1e2922 100644 --- a/packages/editor/document-editor/src/ui/extensions/index.tsx +++ b/packages/editor/document-editor/src/ui/extensions/index.tsx @@ -11,7 +11,8 @@ import { LayersIcon } from "@plane/ui"; export const DocumentEditorExtensions = ( uploadFile: UploadImage, issueEmbedConfig?: IIssueEmbedConfig, - setIsSubmitting?: (isSubmitting: "submitting" | "submitted" | "saved") => void + setIsSubmitting?: (isSubmitting: "submitting" | "submitted" | "saved") => void, + setHideDragHandle?: (hideDragHandlerFromDragDrop: () => void) => void ) => { const additionalOptions: ISlashCommandItem[] = [ { @@ -35,7 +36,7 @@ export const DocumentEditorExtensions = ( return [ SlashCommand(uploadFile, setIsSubmitting, additionalOptions), - DragAndDrop, + DragAndDrop(setHideDragHandle), Placeholder.configure({ placeholder: ({ node }) => { if (node.type.name === "heading") { diff --git a/packages/editor/document-editor/src/ui/index.tsx b/packages/editor/document-editor/src/ui/index.tsx index 8d12f253b..e88632c3b 100644 --- a/packages/editor/document-editor/src/ui/index.tsx +++ b/packages/editor/document-editor/src/ui/index.tsx @@ -86,6 +86,14 @@ const DocumentEditor = ({ const [sidePeekVisible, setSidePeekVisible] = useState(true); const router = useRouter(); + const [hideDragHandleOnMouseLeave, setHideDragHandleOnMouseLeave] = React.useState<() => void>(() => {}); + + // this essentially sets the hideDragHandle function from the DragAndDrop extension as the Plugin + // loads such that we can invoke it from react when the cursor leaves the container + const setHideDragHandleFunction = (hideDragHandlerFromDragDrop: () => void) => { + setHideDragHandleOnMouseLeave(() => hideDragHandlerFromDragDrop); + }; + const editor = useEditor({ onChange(json, html) { updateMarkings(json); @@ -104,7 +112,12 @@ const DocumentEditor = ({ cancelUploadImage, rerenderOnPropsChange, forwardedRef, - extensions: DocumentEditorExtensions(uploadFile, embedConfig?.issueEmbedConfig, setIsSubmitting), + extensions: DocumentEditorExtensions( + uploadFile, + embedConfig?.issueEmbedConfig, + setIsSubmitting, + setHideDragHandleFunction + ), }); if (!editor) { @@ -152,6 +165,7 @@ const DocumentEditor = ({
{ setIsSubmitting={setIsSubmitting} updatePageTitle={updatePageTitle} onActionCompleteHandler={actionCompleteAlert} - customClassName="tracking-tight self-center px-0 h-full w-full" + customClassName="tracking-tight self-center h-full w-full right-[0.675rem]" onChange={(_description_json: Object, description_html: string) => { setShowAlert(true); onChange(description_html);