diff --git a/packages/editor/core/src/ui/components/editor-container.tsx b/packages/editor/core/src/ui/components/editor-container.tsx index 8de6298b5..050755f5a 100644 --- a/packages/editor/core/src/ui/components/editor-container.tsx +++ b/packages/editor/core/src/ui/components/editor-container.tsx @@ -7,7 +7,11 @@ interface EditorContainerProps { children: ReactNode; } -export const EditorContainer = ({ editor, editorClassNames, children }: EditorContainerProps) => ( +export const EditorContainer = ({ + editor, + editorClassNames, + children, +}: EditorContainerProps) => (
{ diff --git a/packages/editor/core/src/ui/index.tsx b/packages/editor/core/src/ui/index.tsx index 513bb106e..a314a2650 100644 --- a/packages/editor/core/src/ui/index.tsx +++ b/packages/editor/core/src/ui/index.tsx @@ -1,14 +1,14 @@ -"use client" -import * as React from 'react'; +"use client"; +import * as React from "react"; import { Extension } from "@tiptap/react"; -import { UploadImage } from '../types/upload-image'; -import { DeleteImage } from '../types/delete-image'; -import { getEditorClassNames } from '../lib/utils'; -import { EditorProps } from '@tiptap/pm/view'; -import { useEditor } from './hooks/useEditor'; -import { EditorContainer } from '../ui/components/editor-container'; -import { EditorContentWrapper } from '../ui/components/editor-content'; -import { IMentionSuggestion } from '../types/mention-suggestion'; +import { UploadImage } from "../types/upload-image"; +import { DeleteImage } from "../types/delete-image"; +import { getEditorClassNames } from "../lib/utils"; +import { EditorProps } from "@tiptap/pm/view"; +import { useEditor } from "./hooks/useEditor"; +import { EditorContainer } from "../ui/components/editor-container"; +import { EditorContentWrapper } from "../ui/components/editor-content"; +import { IMentionSuggestion } from "../types/mention-suggestion"; interface ICoreEditor { value: string; @@ -19,7 +19,9 @@ interface ICoreEditor { customClassName?: string; editorContentCustomClassNames?: string; onChange?: (json: any, html: string) => void; - setIsSubmitting?: (isSubmitting: "submitting" | "submitted" | "saved") => void; + setIsSubmitting?: ( + isSubmitting: "submitting" | "submitted" | "saved", + ) => void; setShouldShowAlert?: (showAlert: boolean) => void; editable?: boolean; forwardedRef?: any; @@ -72,22 +74,29 @@ const CoreEditor = ({ forwardedRef, }); - const editorClassNames = getEditorClassNames({ noBorder, borderOnFocus, customClassName }); + const editorClassNames = getEditorClassNames({ + noBorder, + borderOnFocus, + customClassName, + }); if (!editor) return null; return (
- +
-
+ ); }; -const CoreEditorWithRef = React.forwardRef((props, ref) => ( - -)); +const CoreEditorWithRef = React.forwardRef( + (props, ref) => , +); CoreEditorWithRef.displayName = "CoreEditorWithRef"; diff --git a/packages/editor/lite-text-editor/src/ui/index.tsx b/packages/editor/lite-text-editor/src/ui/index.tsx index 041d7c6d7..6cd03bcfa 100644 --- a/packages/editor/lite-text-editor/src/ui/index.tsx +++ b/packages/editor/lite-text-editor/src/ui/index.tsx @@ -18,9 +18,9 @@ export type IMentionSuggestion = { title: string; subtitle: string; redirect_uri: string; -} +}; -export type IMentionHighlight = string +export type IMentionHighlight = string; interface ILiteTextEditor { value: string; @@ -32,7 +32,7 @@ interface ILiteTextEditor { editorContentCustomClassNames?: string; onChange?: (json: any, html: string) => void; setIsSubmitting?: ( - isSubmitting: "submitting" | "submitted" | "saved" + isSubmitting: "submitting" | "submitted" | "saved", ) => void; setShouldShowAlert?: (showAlert: boolean) => void; forwardedRef?: any; @@ -50,6 +50,7 @@ interface ILiteTextEditor { onEnterKeyPress?: (e?: any) => void; mentionHighlights?: string[]; mentionSuggestions?: IMentionSuggestion[]; + submitButton?: React.ReactNode; } interface LiteTextEditorProps extends ILiteTextEditor { @@ -61,24 +62,27 @@ interface EditorHandle { setEditorValue: (content: string) => void; } -const LiteTextEditor = ({ - onChange, - debouncedUpdatesEnabled, - setIsSubmitting, - setShouldShowAlert, - editorContentCustomClassNames, - value, - uploadFile, - deleteFile, - noBorder, - borderOnFocus, - customClassName, - forwardedRef, - commentAccessSpecifier, - onEnterKeyPress, - mentionHighlights, - mentionSuggestions -}: LiteTextEditorProps) => { +const LiteTextEditor = (props: LiteTextEditorProps) => { + const { + onChange, + debouncedUpdatesEnabled, + setIsSubmitting, + setShouldShowAlert, + editorContentCustomClassNames, + value, + uploadFile, + deleteFile, + noBorder, + borderOnFocus, + customClassName, + forwardedRef, + commentAccessSpecifier, + onEnterKeyPress, + mentionHighlights, + mentionSuggestions, + submitButton, + } = props; + const editor = useEditor({ onChange, debouncedUpdatesEnabled, @@ -90,7 +94,7 @@ const LiteTextEditor = ({ forwardedRef, extensions: LiteTextEditorExtensions(onEnterKeyPress), mentionHighlights, - mentionSuggestions + mentionSuggestions, }); const editorClassNames = getEditorClassNames({ @@ -114,6 +118,7 @@ const LiteTextEditor = ({ uploadFile={uploadFile} setIsSubmitting={setIsSubmitting} commentAccessSpecifier={commentAccessSpecifier} + submitButton={submitButton} />
@@ -122,7 +127,7 @@ const LiteTextEditor = ({ }; const LiteTextEditorWithRef = React.forwardRef( - (props, ref) => + (props, ref) => , ); LiteTextEditorWithRef.displayName = "LiteTextEditorWithRef"; diff --git a/packages/editor/lite-text-editor/src/ui/menus/fixed-menu/index.tsx b/packages/editor/lite-text-editor/src/ui/menus/fixed-menu/index.tsx index a42421b04..62957a769 100644 --- a/packages/editor/lite-text-editor/src/ui/menus/fixed-menu/index.tsx +++ b/packages/editor/lite-text-editor/src/ui/menus/fixed-menu/index.tsx @@ -1,5 +1,5 @@ import { Editor } from "@tiptap/react"; -import { BoldIcon, LucideIcon } from "lucide-react"; +import { BoldIcon } from "lucide-react"; import { BoldItem, @@ -14,7 +14,6 @@ import { TableItem, UnderLineItem, } from "@plane/editor-core"; -import { Icon } from "./icon"; import { Tooltip } from "../../tooltip"; import { UploadImage } from "../.."; @@ -41,8 +40,9 @@ type EditorBubbleMenuProps = { }; uploadFile: UploadImage; setIsSubmitting?: ( - isSubmitting: "submitting" | "submitted" | "saved" + isSubmitting: "submitting" | "submitted" | "saved", ) => void; + submitButton: React.ReactNode; }; export const FixedMenu = (props: EditorBubbleMenuProps) => { @@ -72,116 +72,132 @@ export const FixedMenu = (props: EditorBubbleMenuProps) => { props.commentAccessSpecifier?.onAccessChange(accessKey); }; + console.log(complexItems); + return ( -
+
{props.commentAccessSpecifier && ( -
+
{props?.commentAccessSpecifier.commentAccess?.map((access) => ( ))}
)} -
- {basicMarkItems.map((item, index) => ( - - ))} -
-
- {listItems.map((item, index) => ( - - ))} -
-
- {userActionItems.map((item, index) => ( - - ))} -
-
- {complexItems.map((item, index) => ( - - ))} +
+
+
+ {basicMarkItems.map((item, index) => ( + + ))} +
+
+ {listItems.map((item, index) => ( + + ))} +
+
+ {userActionItems.map((item, index) => ( + + ))} +
+
+ {complexItems.map((item, index) => ( + + ))} +
+
+ {props.submitButton}
); diff --git a/web/components/issues/issue-peek-overview/activity/comment-card.tsx b/web/components/issues/issue-peek-overview/activity/comment-card.tsx index c47c0ed9a..39b4e11f7 100644 --- a/web/components/issues/issue-peek-overview/activity/comment-card.tsx +++ b/web/components/issues/issue-peek-overview/activity/comment-card.tsx @@ -49,7 +49,7 @@ export const IssueCommentCard: React.FC = (props) => { const [isEditing, setIsEditing] = useState(false); - const editorSuggestions = useEditorSuggestions(workspaceSlug, projectId) + const editorSuggestions = useEditorSuggestions(workspaceSlug, projectId); const { formState: { isSubmitting }, diff --git a/web/components/issues/issue-peek-overview/activity/comment-editor.tsx b/web/components/issues/issue-peek-overview/activity/comment-editor.tsx index 385512762..96355a252 100644 --- a/web/components/issues/issue-peek-overview/activity/comment-editor.tsx +++ b/web/components/issues/issue-peek-overview/activity/comment-editor.tsx @@ -54,7 +54,7 @@ export const IssueCommentEditor: React.FC = (props) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; - const editorSuggestions = useEditorSuggestions(workspaceSlug as string | undefined, projectId as string | undefined) + const editorSuggestions = useEditorSuggestions(workspaceSlug as string | undefined, projectId as string | undefined); const { control, @@ -75,7 +75,7 @@ export const IssueCommentEditor: React.FC = (props) => { return (
-
+
{showAccessSpecifier && (
= (props) => { deleteFile={fileService.deleteImage} ref={editorRef} value={!commentValue || commentValue === "" ? "

" : commentValue} - customClassName="p-3 min-h-[100px] shadow-sm" + customClassName="p-2 h-full" debouncedUpdatesEnabled={false} mentionSuggestions={editorSuggestions.mentionSuggestions} mentionHighlights={editorSuggestions.mentionHighlights} onChange={(comment_json: Object, comment_html: string) => onCommentChange(comment_html)} commentAccessSpecifier={{ accessValue, onAccessChange, showAccessSpecifier, commentAccess }} + submitButton={ + + } /> )} /> )} />
- -
);