@ynput/ayon-frontend-shared 0.3.52 → 0.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs11.js +1 -1
- package/dist/_virtual/index.cjs12.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.es10.js +3 -3
- package/dist/_virtual/index.es11.js +5 -5
- package/dist/_virtual/index.es12.js +5 -5
- package/dist/_virtual/index.es3.js +5 -2
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +2 -5
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.cjs.js +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.es.js +1 -1
- package/dist/node_modules/react-use-websocket/dist/index.cjs.js +1 -1
- package/dist/node_modules/react-use-websocket/dist/index.es.js +1 -1
- package/dist/node_modules/rehype/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype/node_modules/unified/lib/index.es.js +2 -2
- package/dist/node_modules/rehype/node_modules/vfile/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype/node_modules/vfile/lib/index.es.js +1 -1
- package/dist/node_modules/rehype-parse/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype-parse/lib/index.es.js +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js +2 -2
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js +27 -27
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js +92 -79
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js +2 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js +2 -1
- package/dist/shared/src/containers/Feed/components/FileUploadCard/FileUploadCard.styled.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentInput.cjs.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/CommentInput.tsx"],"sourcesContent":["// React and related hooks\nimport React, { FC, useEffect, useMemo, useRef, useState } from 'react'\n\n// Third-party libraries\nimport clsx from 'clsx'\nimport { toast } from 'react-toastify'\nimport ReactQuill, { Quill } from 'react-quill-ayon'\n\n// Components\nimport { Button, Icon, SaveButton } from '@ynput/ayon-react-components'\nimport CommentMentionSelect from '../CommentMentionSelect/CommentMentionSelect'\nimport InputMarkdownConvert from './InputMarkdownConvert'\nimport FilesGrid from '../FilesGrid'\n\n// Styled components\nimport * as Styled from './CommentInput.styled'\nimport { QuillListStyles } from '../../../../components/QuillListStyles'\n\n// Helpers and utilities\nimport getMentionOptions from '../../mentionHelpers/getMentionOptions'\nimport getMentionUsers from '../../mentionHelpers/getMentionUsers'\nimport getMentionTasks from '../../mentionHelpers/getMentionTasks'\nimport getMentionVersions from '../../mentionHelpers/getMentionVersions'\nimport { convertToMarkdown } from './quillToMarkdown'\nimport { handleFileDrop, parseImages, typeWithDelay } from './helpers'\nimport { getModules, quillFormats } from './modules'\n\n// Hooks\nimport useInitialValue from './hooks/useInitialValue'\nimport useSetCursorEnd from './hooks/useSetCursorEnd'\nimport useMentionLink from './hooks/useMentionLink'\nimport useAnnotationsSync from './hooks/useAnnotationsSync'\nimport { useBlendedCategoryColor } from './hooks/useBlendedCategoryColor'\n\n// State management\nimport useAnnotationsUpload from './hooks/useAnnotationsUpload'\nimport { useFeedContext } from '../../context/FeedContext'\nimport { ActivityCategorySelect, isCategoryHidden, SavedAnnotationMetadata } from '../../index'\nimport { useDetailsPanelContext } from '@shared/context'\nimport { useProjectContext } from '@shared/context'\nimport { parseFilename } from '@shared/components'\nimport { FeedActivity } from '@shared/api'\nimport { VersionReviewPill } from './VersionReviewPill'\nimport { VersionReviewFeedback, mentionTypeOptions } from './types'\n\nvar Delta = Quill.import('delta')\n\nconst EMPTY_EDITOR_VALUE = '<p><br></p>'\n\nconst mentionTypes = ['@', '@@', '@@@']\n\ninterface CommentInputProps {\n initValue: string | null\n initFiles?: any[]\n initCategory?: string | null\n data?: any\n versionReview: boolean\n lastOwnVersionReview?: FeedActivity\n onSubmit: (markdown: string, files: any[], data?: any) => Promise<void>\n onReview?: (feedback: VersionReviewFeedback) => void\n isEditing?: boolean\n disabled?: boolean\n isLoading?: boolean\n isOpen: boolean\n onOpen?: () => void\n onClose?: () => void\n}\n\nconst CommentInput: FC<CommentInputProps> = ({\n initValue,\n initFiles = [],\n initCategory = null,\n data = {},\n versionReview,\n lastOwnVersionReview,\n onSubmit,\n onReview,\n isEditing,\n disabled,\n isLoading,\n isOpen,\n onOpen,\n onClose,\n}) => {\n const {\n projectName,\n entities,\n projectInfo,\n scope,\n feedFilter,\n mentionSuggestionsData,\n categories,\n isGuest,\n } = useFeedContext()\n\n const { hasLicense, onPowerFeature, user } = useDetailsPanelContext()\n const isAdmin = user?.data?.isAdmin\n\n const project = useProjectContext()\n\n const {\n users: mentionUsers,\n teams: mentionTeams,\n versions: mentionVersions,\n tasks: mentionTasks,\n } = mentionSuggestionsData || {}\n\n const [initHeight, setInitHeight] = useState(88)\n const [editorValue, setEditorValue] = useState('')\n // file uploads\n const [files, setFiles] = useState(initFiles)\n const [filesUploading, setFilesUploading] = useState([])\n const [isDropping, setIsDropping] = useState(false)\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n const { annotations, removeAnnotation, goToAnnotation } = useAnnotationsSync({\n entityId: entities[0]?.id,\n filesUploading,\n })\n\n // MENTION STATES\n const [mention, setMention] = useState<null | any>(null)\n const [mentionSelectedIndex, setMentionSelectedIndex] = useState(0)\n // Prefix filter for mentions (e.g. 'team:' or 'user:')\n const [mentionPrefix, setMentionPrefix] = useState('')\n\n const clearMention = () => {\n setMention(null)\n setMentionSelectedIndex(0)\n setMentionPrefix('')\n }\n // CATEGORY STATE\n const [category, setCategory] = useState<null | string>(initCategory)\n const categoryOptions = categories.filter((cat) => cat.accessLevel >= 20)\n const categoryData = categories.find((cat) => cat.name === category)\n // Compute blended background color for category\n const blendedCategoryColor = useBlendedCategoryColor(categoryData?.color)\n // REFS\n const editorRef = useRef<any>(null)\n const editorContainerRef = useRef<HTMLDivElement>(null)\n\n const markdownRef = useRef<HTMLDivElement>(null)\n\n // if there is an initial value, set it so the editor is prefilled\n useInitialValue({\n markdownRef,\n initValue,\n setEditorValue,\n setInitHeight,\n isOpen: isOpen,\n // @ts-expect-error - QueryFilter type is the same\n filter: feedFilter,\n })\n\n // When editing, set selection to the end of the editor\n useSetCursorEnd({ initHeight, editorRef, isEditing })\n // create a new quill format for mentions and registers it\n useMentionLink({ projectName })\n\n // focus on editor when opened\n useEffect(() => {\n if (isOpen) {\n editorRef.current?.getEditor()?.enable()\n // block autofocus if opened from an annotation\n if (annotations.length > 0 && files.length === 0) {\n return\n }\n\n editorRef.current?.focus()\n }\n // We don't set annotations or files as useEffect dependencies, because we don't want to focus\n // the input if it's already open but annotations change (e.g. are removed).\n }, [isOpen, editorRef])\n\n mentionTypes.sort((a, b) => b.length - a.length)\n\n // Combine prefix filter with typed search for options filtering\n const mentionSearchWithPrefix = mentionPrefix + (mention?.search || '')\n\n const mentionOptions = useMemo(\n () =>\n getMentionOptions(\n mention?.type,\n {\n '@': () => getMentionUsers(mentionUsers, mentionTeams),\n '@@': () => getMentionVersions(mentionVersions, project),\n '@@@': () => getMentionTasks(mentionTasks, projectInfo.taskTypes),\n },\n mentionSearchWithPrefix || undefined,\n ),\n [\n mentionTasks,\n mentionVersions,\n mentionUsers,\n mentionTeams,\n mention?.type,\n mentionSearchWithPrefix,\n ],\n )\n\n // show first 5 and filter itself out\n const shownMentionOptions = mentionOptions.slice(0, 5)\n\n // triggered when a mention is selected\n const [newSelection, setNewSelection] = useState<null | number>()\n\n useEffect(() => {\n if (newSelection) {\n setNewSelection(null)\n // now we set selection to the end of the mention\n const quill = editorRef.current.getEditor()\n quill.setSelection(newSelection)\n }\n }, [newSelection])\n\n const handleSelectMention = (selectedOption: any) => {\n // get option text\n const quill = editorRef.current.getEditor()\n\n const typePrefix = mention.type // the type of mention: @, @@, @@@\n const search = typePrefix + (mention.search || '') // the full search string: @Tim\n const mentionLabel = typePrefix + selectedOption.label // the label of the mention: @Tim Bailey\n // @ts-expect-error\n const type = mentionTypeOptions[typePrefix] // the type of mention: user, version, task\n // Use the option's own type (e.g. 'team') if available, otherwise fall back to the mention type config\n const refType = selectedOption.type || type?.id\n const href = `${refType}:${selectedOption.id}` // the href of the mention: user:user.123 or team:Thunder boys\n\n // get selection delta\n const selection = quill.getSelection(true)\n const selectionIndex = selection?.index || 0\n const startIndex = selectionIndex - search.length // the start index of the search\n\n // first delete the search string\n quill.deleteText(startIndex, search.length)\n\n // insert embed link\n quill.insertText(startIndex, mentionLabel, 'mention', href)\n\n const endIndex = startIndex + mentionLabel.length\n\n // insert a space after the mention\n quill.updateContents(new Delta().retain(endIndex).insert(' '))\n\n // remove single \\n after mention\n quill.updateContents(new Delta().retain(endIndex + 1).delete(1))\n\n // set selection to the end of the mention + 1\n setNewSelection(endIndex + 1)\n\n // reset mention state\n clearMention()\n }\n\n const handleSelectChange = (option: any) => {\n handleSelectMention(option)\n }\n\n const handleChange = (content: string, delta: any, _: any, editor: any) => {\n let currentCharacter =\n (delta.ops[0] && delta.ops[0].insert) || (delta.ops[1] && delta.ops[1].insert)\n\n const tabOrEnter = currentCharacter === '\\n' || currentCharacter === '\\t'\n // find the first option\n const selectedOption = mentionOptions[mentionSelectedIndex]\n\n if (mention && tabOrEnter && selectedOption && !isGuest) {\n // get option text\n const retain = (delta.ops[0] && delta.ops[0].retain) || 0\n // prevent default\n\n // @ts-ignore\n handleSelectMention(selectedOption, retain)\n\n return\n }\n\n setEditorValue(content)\n\n const isDelete = delta.ops.length === 2 && !!delta.ops[1].delete\n\n if (!currentCharacter && isDelete) {\n currentCharacter = editor.getText(delta.ops[0].retain - 1, 1)\n }\n\n const isMention = mentionTypes.includes(currentCharacter)\n\n if (isMention) {\n const mentionIndex = delta.ops.findIndex((op: any) => 'insert' in op || 'delete' in op)\n const mention = currentCharacter\n let retain = mentionIndex === 0 ? 0 : delta.ops[mentionIndex - 1].retain\n if (isDelete) retain = retain - 1\n\n // for each mention denotation char, check if it is a mention\n // sort by length of mention denotation char\n let mentionMatch = null\n\n // loop through each mention denotation char, with longest first. First one to match is the one we want\n for (const chars of mentionTypes) {\n let isMatch = true\n // start with the last character\n if (chars.endsWith(mention)) {\n // loop through the chars backwards\n for (let i = chars.length - 1; i >= 0; i--) {\n // skip first character as that's already been checked\n if (i === 0) continue\n const char = chars[i - 1]\n const indexInDelta = retain - (chars.length - i)\n const valueCharAtIndex = editor.getText(indexInDelta, 1)\n if (valueCharAtIndex !== char) {\n isMatch = false\n break\n }\n }\n } else {\n isMatch = false\n }\n\n if (isMatch) {\n // console.log('match!!!', chars)\n mentionMatch = chars\n break\n }\n }\n\n if (mentionMatch) {\n setMention({\n type: mentionMatch,\n retain: retain,\n })\n } else {\n clearMention()\n }\n } else {\n // get full string between mention and new delta\n // This is where SEARCH is handled\n if (mention) {\n const retain = delta.ops[0].retain\n // if space is pressed, remove mention\n if (currentCharacter === ' ' || !retain) {\n clearMention()\n return\n }\n\n let distanceMentionToRetain = retain - mention.retain\n if (!isDelete) distanceMentionToRetain++\n const mentionFull = editor.getText(mention.retain, distanceMentionToRetain)\n const mentionSearch = mentionFull.replace(mention.type.slice(-1), '')\n // check for space in mentionFull\n if (mentionFull.includes(' ')) {\n clearMention()\n } else {\n setMention({\n ...mention,\n search: mentionSearch?.toLowerCase(),\n })\n }\n } else if (isDelete) {\n // backspace inside a mention deletes the whole mention\n const quill = editorRef.current.getEditor()\n const currentSelection = quill.getSelection(false)\n const currentFormat = quill.getFormat(currentSelection?.index, currentSelection?.length)\n if (currentFormat.mention) {\n const [lineBlock] = quill.getLine(currentSelection.index - 1) || []\n const ops = lineBlock?.cache?.delta?.ops || []\n const lastMentionOp = ops.reverse().find((op: any) => op.attributes?.mention)\n if (lastMentionOp) {\n const mentionLength = lastMentionOp.insert.length\n quill.deleteText(currentSelection.index - mentionLength, mentionLength)\n }\n }\n }\n }\n }\n\n const addTextToEditor = (type: string) => {\n // get editor retain\n const quill = editorRef.current.getEditor()\n\n let retain = quill.getSelection(true)?.index || 0\n\n // get character at retain\n const currentCharacter = quill.getText(retain - 1, 1)\n\n // if the current character is a character, increment retain\n const addSpace = currentCharacter !== ' ' && currentCharacter\n if (addSpace) {\n quill.insertText(retain, ' ')\n retain++\n }\n\n // This is hack AF, but it works\n typeWithDelay(quill, retain, type)\n }\n\n const handleMentionButton = (type: string) => {\n // first check if mention is already open\n if (mention) {\n const { type, retain, search = '' } = mention\n\n const quill = editorRef.current.getEditor()\n const length = type.length + search.length\n const start = retain - type.length + 1\n // delete the mention\n quill.deleteText(start, length)\n }\n\n addTextToEditor(type)\n }\n\n const handleOpenClick = () => {\n if (isOpen || disabled) return\n\n onOpen && onOpen()\n }\n\n const handleClose = () => {\n // get editor value\n const editor = editorRef.current.getEditor()\n const text = editor.getText()\n if (text.length < 2 || isEditing) {\n setEditorValue('')\n }\n\n // always close editor\n onClose && onClose()\n }\n\n const handleFileUploaded = ({ file, data }: any) => {\n const fileName = parseFilename(file.name)\n const newFile = {\n id: data.id,\n name: fileName,\n mime: file.type,\n size: file.size,\n order: files.length,\n }\n\n setFiles((prev) => [...prev, newFile])\n // remove from uploading\n setFilesUploading((prev) =>\n prev.filter((uploading: any) => parseFilename(uploading.name) !== fileName),\n )\n\n return newFile\n }\n\n const handleFileRemove = (id: string, name: string, isUnsavedAnnotation: boolean) => {\n if (isUnsavedAnnotation) {\n // remove from annotations (if it's an unsaved annotation)\n removeAnnotation?.(id)\n } else {\n // remove file from files\n setFiles((prev) => prev.filter((file) => file.id !== id))\n // remove from uploading\n setFilesUploading((prev) => {\n return prev.filter((file: any) => parseFilename(file.name) !== parseFilename(name))\n })\n }\n }\n\n const handleFileProgress = (e: any, file: any) => {\n const progress = Math.round((e.loaded * 100) / e.total)\n if (progress !== 100) {\n const fileName = parseFilename(file.name)\n const uploadProgress = {\n name: fileName,\n progress,\n type: file.type,\n order: files.length + filesUploading.length,\n }\n\n // @ts-ignore\n setFilesUploading((prev) => {\n // replace or add new progress\n const newProgress = prev.filter((name: any) => parseFilename(name.name) !== fileName)\n return [...newProgress, uploadProgress]\n })\n }\n }\n\n // when a file is not dropped onto the comment input\n const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n setIsDropping(false)\n // upload file\n handleFileDrop(e, projectName, handleFileProgress, handleFileUploaded)\n }\n\n const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDropping(true)\n }\n\n const uploadAnnotations = useAnnotationsUpload({\n projectName,\n onSuccess: handleFileUploaded,\n })\n\n const handleSubmit = async () => {\n try {\n setIsSubmitting(true)\n\n // upload any annotations first\n let annotationFiles = []\n let annotationMetadata: SavedAnnotationMetadata[] | undefined = undefined\n if (annotations.length) {\n const { files, metadata } = await uploadAnnotations(annotations)\n annotationFiles = files\n // get current files data\n const { annotations: annotationsData = [] } = data || {}\n // merge existing annotations data with new metadata\n annotationMetadata = [...annotationsData, ...metadata]\n }\n\n // convert to markdown\n const [markdown] = convertToMarkdown(editorValue)\n\n // remove img query params\n const markdownParsed = parseImages(markdown)\n\n const uploadedFiles = [...files, ...annotationFiles]\n\n const newData = {\n ...data,\n annotations: annotationMetadata, // could be undefined\n category: isGuest ? null : category, // guests cannot set category (it is done by default on backend)\n }\n\n if ((markdownParsed || uploadedFiles.length) && onSubmit) {\n try {\n await onSubmit(markdownParsed, uploadedFiles, newData)\n // only clear if onSubmit is successful\n setEditorValue('')\n setFiles([])\n } catch (error) {\n // error is handled in rtk query mutation\n return\n }\n }\n } catch (error) {\n console.error(error)\n toast.error('Something went wrong')\n } finally {\n setIsSubmitting(false)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (mention) {\n // close mention on escape\n if (e.key === 'Escape') {\n clearMention()\n return\n }\n\n // add top search of mention\n if (mention && e.key === 'Tab') {\n // we handle this in the onChange\n }\n\n const arrowDirection = e.key === 'ArrowUp' ? -1 : e.key === 'ArrowDown' ? 1 : 0\n\n if (arrowDirection) {\n // navigate through mentions\n e.preventDefault()\n let newIndex = mentionSelectedIndex + arrowDirection\n if (newIndex < 0) newIndex = shownMentionOptions.length - 1\n if (newIndex >= shownMentionOptions.length) newIndex = 0\n setMentionSelectedIndex(newIndex)\n }\n\n if (e.key === 'Enter') {\n // we handle this in the onChange\n }\n }\n\n if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {\n handleSubmit()\n }\n\n if (e.key === 'Escape') {\n handleClose()\n }\n }\n\n let quillMinHeight: number | undefined = isOpen ? initHeight + 41 : 44\n if (isEditing) quillMinHeight = undefined\n\n // QUILL CONFIG\n const modules = useMemo(\n () =>\n getModules({\n imageUploader: {\n projectName,\n onUpload: handleFileUploaded,\n onUploadProgress: handleFileProgress,\n },\n mentionTypeOptions,\n }),\n [projectName, setFiles, setFilesUploading],\n )\n\n const allFiles = [...annotations, ...(files || []), ...filesUploading].sort(\n (a, b) => a.order - b.order,\n )\n const compactGrid = allFiles.length > 3\n\n // disable version mentions for folders\n let mentionsError = null\n if (entities.length && entities[0].entityType === 'folder') {\n if (mention?.type === '@@') {\n mentionsError = 'Version mentions are disabled for folders'\n }\n }\n\n const getCommentPlaceholder = (isOpen?: boolean) => {\n if (disabled) {\n if (isGuest) return 'You do not have permission to comment.'\n return 'Commenting is disabled across multiple projects.'\n }\n\n if (isGuest || !isOpen) return 'Leave a comment'\n\n return 'Comment or mention with @user, @@version, @@@task...'\n }\n\n const handleReviewSubmit = async (status: VersionReviewFeedback) => {\n if (!onReview) return\n try {\n const postComment =\n (editorValue && editorValue !== EMPTY_EDITOR_VALUE) ||\n files.length > 0 ||\n annotations.length > 0\n // if the editor value is valid, also submit the comment first\n if (postComment) {\n await handleSubmit()\n }\n\n onReview(status)\n } catch (error) {\n console.error(error)\n toast.error('Something went wrong while submitting the review')\n }\n }\n\n const versionReviewButtons = versionReview && onReview && (\n <Styled.VersionReviewButtons className={clsx('version-review-buttons', { guest: isGuest })}>\n <Styled.VersionReviewButton\n icon=\"check\"\n variant=\"tertiary\"\n data-tooltip=\"Approve\"\n onClick={() => handleReviewSubmit(VersionReviewFeedback.APPROVE)}\n >\n <span className=\"label\">Approve</span>\n </Styled.VersionReviewButton>\n <Styled.VersionReviewButton\n icon=\"refresh\"\n variant=\"danger\"\n data-tooltip=\"Request changes\"\n onClick={() => handleReviewSubmit(VersionReviewFeedback.REQUEST_CHANGES)}\n >\n <span className=\"label\">Request changes</span>\n </Styled.VersionReviewButton>\n </Styled.VersionReviewButtons>\n )\n\n return (\n <>\n <Styled.AutoHeight\n className={clsx('comment-container', { isOpen, isEditing })}\n onDragOver={handleDragOver}\n onDragLeave={() => setIsDropping(false)}\n onDrop={handleDrop}\n onClick={() => setIsDropping(false)}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {versionReview && lastOwnVersionReview && (\n <VersionReviewPill lastOwnVersionReview={lastOwnVersionReview} />\n )}\n\n <Styled.Comment\n className={clsx('block-shortcuts', {\n isOpen,\n isClosed: !isOpen || disabled,\n isEditing,\n isDropping,\n disabled,\n isLoading,\n isSubmitting,\n category: !!category && !isGuest,\n })}\n onKeyDown={handleKeyDown}\n onClick={handleOpenClick}\n $categoryPrimary={categoryData?.color}\n $categoryTertiary={blendedCategoryColor.primary}\n $categorySecondary={blendedCategoryColor.secondary}\n >\n <Styled.Markdown ref={markdownRef}>\n {/* this is purely used to translate the markdown into html for Editor */}\n <InputMarkdownConvert typeOptions={mentionTypeOptions} initValue={initValue} />\n </Styled.Markdown>\n\n {/* file uploads */}\n {isOpen && (\n <FilesGrid\n files={allFiles}\n isCompact={compactGrid || isEditing}\n onRemove={handleFileRemove}\n projectName={projectName}\n onAnnotationClick={goToAnnotation}\n style={{\n borderBottom: '1px solid var(--md-sys-color-outline-variant)',\n height: '100%',\n }}\n isEditing\n pt={{\n file: {\n style: {\n height: isEditing ? 70 : undefined,\n },\n },\n }}\n />\n )}\n {isOpen && !disabled ? (\n <QuillListStyles ref={editorContainerRef}>\n {!isGuest && (\n <ActivityCategorySelect\n value={category}\n categories={categoryOptions}\n onChange={(c) => setCategory(c)}\n isCompact={isEditing}\n hasPowerpack={hasLicense}\n onPowerFeature={onPowerFeature}\n isHidden={isCategoryHidden(categoryOptions, { isGuest, isAdmin })}\n style={{\n position: isEditing ? 'relative' : 'absolute',\n left: 4,\n top: isEditing ? 0 : 4,\n }}\n />\n )}\n\n <ReactQuill\n theme=\"snow\"\n style={{ minHeight: quillMinHeight, maxHeight: 300 }}\n ref={editorRef}\n value={editorValue}\n onChange={handleChange}\n readOnly={!isOpen}\n placeholder={getCommentPlaceholder(true)}\n modules={modules}\n formats={quillFormats}\n />\n </QuillListStyles>\n ) : (\n <Styled.Placeholder>{getCommentPlaceholder()}</Styled.Placeholder>\n )}\n\n <Styled.Footer>\n {!isGuest && (\n <Styled.Buttons>\n {/* mention a user */}\n <Button\n icon=\"person\"\n variant=\"text\"\n onClick={() => handleMentionButton('@')}\n data-tooltip={'Mention user'}\n data-shortcut={'@'}\n />\n {/* mention a version */}\n <Button\n icon=\"layers\"\n variant=\"text\"\n onClick={() => handleMentionButton('@@')}\n data-tooltip={'Mention version'}\n data-shortcut={'@@'}\n />\n {/* mention a task */}\n <Button\n icon=\"check_circle\"\n variant=\"text\"\n onClick={() => handleMentionButton('@@@')}\n data-tooltip={'Mention task'}\n data-shortcut={'@@@'}\n />\n </Styled.Buttons>\n )}\n <Styled.SubmitButtons>\n {isEditing && (\n <Button variant=\"text\" onClick={handleClose}>\n Cancel\n </Button>\n )}\n <SaveButton\n label={isEditing ? 'Save' : 'Comment'}\n className=\"comment\"\n active={!!editorValue || !!files.length}\n onClick={handleSubmit}\n disabled={isLoading}\n />\n </Styled.SubmitButtons>\n </Styled.Footer>\n\n <Styled.Dropzone className={clsx({ show: isDropping && isOpen })}>\n <Icon icon=\"cloud_upload\" />\n </Styled.Dropzone>\n </Styled.Comment>\n <CommentMentionSelect\n mention={mention}\n options={shownMentionOptions}\n onChange={handleSelectChange}\n onPrefixFilter={(prefix) => {\n setMentionPrefix(prefix)\n setMentionSelectedIndex(0)\n }}\n activePrefix={mentionPrefix ? mentionPrefix.replace(':', '') : undefined}\n types={mentionTypes}\n // @ts-ignore\n config={mentionTypeOptions[mention?.type]}\n noneFound={!shownMentionOptions.length && (mention?.search || mentionPrefix)}\n noneFoundAtAll={!shownMentionOptions.length && !mention?.search && !mentionPrefix}\n selectedIndex={mentionSelectedIndex}\n // @ts-ignore\n error={mentionsError}\n isGuest={isGuest}\n />\n\n <Styled.VersionReviewButtonsSpacer />\n {versionReviewButtons}\n </Styled.AutoHeight>\n </>\n )\n}\n\nexport default CommentInput\n"],"names":["Delta","Quill","EMPTY_EDITOR_VALUE","mentionTypes","CommentInput","initValue","initFiles","initCategory","data","versionReview","lastOwnVersionReview","onSubmit","onReview","isEditing","disabled","isLoading","isOpen","onOpen","onClose","projectName","entities","projectInfo","scope","feedFilter","mentionSuggestionsData","categories","isGuest","useFeedContext","hasLicense","onPowerFeature","user","useDetailsPanelContext","isAdmin","project","useProjectContext","mentionUsers","mentionTeams","mentionVersions","mentionTasks","initHeight","setInitHeight","useState","editorValue","setEditorValue","files","setFiles","filesUploading","setFilesUploading","isDropping","setIsDropping","isSubmitting","setIsSubmitting","annotations","removeAnnotation","goToAnnotation","useAnnotationsSync","mention","setMention","mentionSelectedIndex","setMentionSelectedIndex","mentionPrefix","setMentionPrefix","clearMention","category","setCategory","categoryOptions","cat","categoryData","blendedCategoryColor","useBlendedCategoryColor","editorRef","useRef","editorContainerRef","markdownRef","useInitialValue","useSetCursorEnd","useMentionLink","useEffect","a","b","mentionSearchWithPrefix","mentionOptions","useMemo","getMentionOptions","getMentionUsers","getMentionVersions","getMentionTasks","shownMentionOptions","newSelection","setNewSelection","handleSelectMention","selectedOption","quill","typePrefix","search","mentionLabel","type","mentionTypeOptions","href","startIndex","endIndex","handleSelectChange","option","handleChange","content","delta","_","editor","currentCharacter","tabOrEnter","isDelete","mentionIndex","op","retain","mentionMatch","chars","isMatch","i","char","indexInDelta","distanceMentionToRetain","mentionFull","mentionSearch","currentSelection","lineBlock","lastMentionOp","mentionLength","addTextToEditor","typeWithDelay","handleMentionButton","length","start","handleOpenClick","handleClose","handleFileUploaded","file","fileName","parseFilename","newFile","prev","uploading","handleFileRemove","id","name","isUnsavedAnnotation","handleFileProgress","progress","uploadProgress","handleDrop","handleFileDrop","handleDragOver","uploadAnnotations","useAnnotationsUpload","handleSubmit","annotationFiles","annotationMetadata","metadata","annotationsData","markdown","convertToMarkdown","markdownParsed","parseImages","uploadedFiles","newData","error","toast","handleKeyDown","arrowDirection","newIndex","quillMinHeight","modules","getModules","allFiles","compactGrid","mentionsError","getCommentPlaceholder","handleReviewSubmit","status","versionReviewButtons","jsxs","Styled.VersionReviewButtons","clsx","jsx","Styled.VersionReviewButton","VersionReviewFeedback","Fragment","Styled.AutoHeight","VersionReviewPill","Styled.Comment","Styled.Markdown","InputMarkdownConvert","FilesGrid","QuillListStyles","ActivityCategorySelect","c","isCategoryHidden","ReactQuill","quillFormats","Styled.Placeholder","Styled.Footer","Styled.Buttons","Button","Styled.SubmitButtons","SaveButton","Styled.Dropzone","Icon","CommentMentionSelect","prefix","Styled.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,IAAK,EAAE,EAAI,OAC/D,MAAOzD,EAEP,OAAQ8F,EAAAA,mBAAmBzC,GAAS,IAAI,EACxC,UAAW,CAAC+B,EAAoB,SAAW/B,GAAS,QAAUI,GAC9D,eAAgB,CAAC2B,EAAoB,QAAU,CAAC/B,GAAS,QAAU,CAACI,EACpE,cAAeF,EAEf,MAAOoH,GACP,QAAApJ,CAAA,CAAA,EAGF4J,EAAAA,kBAAAA,IAAC0B,EAAAA,2BAAA,EAAkC,EAClC9B,EAAA,CAAA,CAAA,EAEL,CAEJ"}
|
|
1
|
+
{"version":3,"file":"CommentInput.cjs.js","sources":["../../../../../../../src/containers/Feed/components/CommentInput/CommentInput.tsx"],"sourcesContent":["// React and related hooks\nimport React, { FC, useEffect, useMemo, useRef, useState } from 'react'\n\n// Third-party libraries\nimport clsx from 'clsx'\nimport { toast } from 'react-toastify'\nimport ReactQuill, { Quill } from 'react-quill-ayon'\n\n// Components\nimport { Button, Icon, SaveButton } from '@ynput/ayon-react-components'\nimport CommentMentionSelect from '../CommentMentionSelect/CommentMentionSelect'\nimport InputMarkdownConvert from './InputMarkdownConvert'\nimport FilesGrid from '../FilesGrid'\n\n// Styled components\nimport * as Styled from './CommentInput.styled'\nimport { QuillListStyles } from '../../../../components/QuillListStyles'\n\n// Helpers and utilities\nimport getMentionOptions from '../../mentionHelpers/getMentionOptions'\nimport getMentionUsers from '../../mentionHelpers/getMentionUsers'\nimport getMentionTasks from '../../mentionHelpers/getMentionTasks'\nimport getMentionVersions from '../../mentionHelpers/getMentionVersions'\nimport { convertToMarkdown } from './quillToMarkdown'\nimport { handleFileDrop, parseImages, typeWithDelay } from './helpers'\nimport { getModules, quillFormats } from './modules'\n\n// Hooks\nimport useInitialValue from './hooks/useInitialValue'\nimport useSetCursorEnd from './hooks/useSetCursorEnd'\nimport useMentionLink from './hooks/useMentionLink'\nimport useAnnotationsSync from './hooks/useAnnotationsSync'\nimport { useBlendedCategoryColor } from './hooks/useBlendedCategoryColor'\n\n// State management\nimport useAnnotationsUpload from './hooks/useAnnotationsUpload'\nimport { useFeedContext } from '../../context/FeedContext'\nimport { ActivityCategorySelect, isCategoryHidden, SavedAnnotationMetadata } from '../../index'\nimport { useDetailsPanelContext } from '@shared/context'\nimport { useProjectContext } from '@shared/context'\nimport { parseFilename } from '@shared/components'\nimport { FeedActivity } from '@shared/api'\nimport { VersionReviewPill } from './VersionReviewPill'\nimport { VersionReviewFeedback, mentionTypeOptions } from './types'\n\nvar Delta = Quill.import('delta')\n\nconst EMPTY_EDITOR_VALUE = '<p><br></p>'\n\nconst mentionTypes = ['@', '@@', '@@@']\n\ninterface CommentInputProps {\n initValue: string | null\n initFiles?: any[]\n initCategory?: string | null\n data?: any\n versionReview: boolean\n lastOwnVersionReview?: FeedActivity\n onSubmit: (markdown: string, files: any[], data?: any) => Promise<void>\n onReview?: (feedback: VersionReviewFeedback) => void\n isEditing?: boolean\n disabled?: boolean\n isLoading?: boolean\n isOpen: boolean\n onOpen?: () => void\n onClose?: () => void\n}\n\nconst CommentInput: FC<CommentInputProps> = ({\n initValue,\n initFiles = [],\n initCategory = null,\n data = {},\n versionReview,\n lastOwnVersionReview,\n onSubmit,\n onReview,\n isEditing,\n disabled,\n isLoading,\n isOpen,\n onOpen,\n onClose,\n}) => {\n const {\n projectName,\n entities,\n projectInfo,\n scope,\n feedFilter,\n mentionSuggestionsData,\n categories,\n isGuest,\n } = useFeedContext()\n\n const { hasLicense, onPowerFeature, user } = useDetailsPanelContext()\n const isAdmin = user?.data?.isAdmin\n\n const project = useProjectContext()\n\n const {\n users: mentionUsers,\n teams: mentionTeams,\n versions: mentionVersions,\n tasks: mentionTasks,\n } = mentionSuggestionsData || {}\n\n const [initHeight, setInitHeight] = useState(88)\n const [editorValue, setEditorValue] = useState('')\n // file uploads\n const [files, setFiles] = useState(initFiles)\n const [filesUploading, setFilesUploading] = useState([])\n const [isDropping, setIsDropping] = useState(false)\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n const { annotations, removeAnnotation, goToAnnotation } = useAnnotationsSync({\n entityId: entities[0]?.id,\n filesUploading,\n })\n\n // MENTION STATES\n const [mention, setMention] = useState<null | any>(null)\n const [mentionSelectedIndex, setMentionSelectedIndex] = useState(0)\n // Prefix filter for mentions (e.g. 'team:' or 'user:')\n const [mentionPrefix, setMentionPrefix] = useState('')\n\n const clearMention = () => {\n setMention(null)\n setMentionSelectedIndex(0)\n setMentionPrefix('')\n }\n // CATEGORY STATE\n const [category, setCategory] = useState<null | string>(initCategory)\n const categoryOptions = categories.filter((cat) => cat.accessLevel >= 20)\n const categoryData = categories.find((cat) => cat.name === category)\n // Compute blended background color for category\n const blendedCategoryColor = useBlendedCategoryColor(categoryData?.color)\n // REFS\n const editorRef = useRef<any>(null)\n const editorContainerRef = useRef<HTMLDivElement>(null)\n\n const markdownRef = useRef<HTMLDivElement>(null)\n\n // if there is an initial value, set it so the editor is prefilled\n useInitialValue({\n markdownRef,\n initValue,\n setEditorValue,\n setInitHeight,\n isOpen: isOpen,\n // @ts-expect-error - QueryFilter type is the same\n filter: feedFilter,\n })\n\n // When editing, set selection to the end of the editor\n useSetCursorEnd({ initHeight, editorRef, isEditing })\n // create a new quill format for mentions and registers it\n useMentionLink({ projectName })\n\n // focus on editor when opened\n useEffect(() => {\n if (isOpen) {\n editorRef.current?.getEditor()?.enable()\n // block autofocus if opened from an annotation\n if (annotations.length > 0 && files.length === 0) {\n return\n }\n\n editorRef.current?.focus()\n }\n // We don't set annotations or files as useEffect dependencies, because we don't want to focus\n // the input if it's already open but annotations change (e.g. are removed).\n }, [isOpen, editorRef])\n\n mentionTypes.sort((a, b) => b.length - a.length)\n\n // Combine prefix filter with typed search for options filtering\n const mentionSearchWithPrefix = mentionPrefix + (mention?.search || '')\n\n const mentionOptions = useMemo(\n () =>\n getMentionOptions(\n mention?.type,\n {\n '@': () => getMentionUsers(mentionUsers, mentionTeams),\n '@@': () => getMentionVersions(mentionVersions, project),\n '@@@': () => getMentionTasks(mentionTasks, projectInfo.taskTypes),\n },\n mentionSearchWithPrefix || undefined,\n ),\n [\n mentionTasks,\n mentionVersions,\n mentionUsers,\n mentionTeams,\n mention?.type,\n mentionSearchWithPrefix,\n ],\n )\n\n // show first 5 and filter itself out\n const shownMentionOptions = mentionOptions.slice(0, 5)\n\n // triggered when a mention is selected\n const [newSelection, setNewSelection] = useState<null | number>()\n\n useEffect(() => {\n if (newSelection) {\n setNewSelection(null)\n // now we set selection to the end of the mention\n const quill = editorRef.current.getEditor()\n quill.setSelection(newSelection)\n }\n }, [newSelection])\n\n const handleSelectMention = (selectedOption: any) => {\n // get option text\n const quill = editorRef.current.getEditor()\n\n const typePrefix = mention.type // the type of mention: @, @@, @@@\n const search = typePrefix + (mention.search || '') // the full search string: @Tim\n const mentionLabel = typePrefix + selectedOption.label // the label of the mention: @Tim Bailey\n // @ts-expect-error\n const type = mentionTypeOptions[typePrefix] // the type of mention: user, version, task\n // Use the option's own type (e.g. 'team') if available, otherwise fall back to the mention type config\n const refType = selectedOption.type || type?.id\n const href = `${refType}:${selectedOption.id}` // the href of the mention: user:user.123 or team:Thunder boys\n\n // get selection delta\n const selection = quill.getSelection(true)\n const selectionIndex = selection?.index || 0\n const startIndex = selectionIndex - search.length // the start index of the search\n\n // first delete the search string\n quill.deleteText(startIndex, search.length)\n\n // insert embed link\n quill.insertText(startIndex, mentionLabel, 'mention', href)\n\n const endIndex = startIndex + mentionLabel.length\n\n // insert a space after the mention\n quill.updateContents(new Delta().retain(endIndex).insert(' '))\n\n // remove single \\n after mention\n quill.updateContents(new Delta().retain(endIndex + 1).delete(1))\n\n // set selection to the end of the mention + 1\n setNewSelection(endIndex + 1)\n\n // reset mention state\n clearMention()\n }\n\n const handleSelectChange = (option: any) => {\n handleSelectMention(option)\n }\n\n const handleChange = (content: string, delta: any, _: any, editor: any) => {\n let currentCharacter =\n (delta.ops[0] && delta.ops[0].insert) || (delta.ops[1] && delta.ops[1].insert)\n\n const tabOrEnter = currentCharacter === '\\n' || currentCharacter === '\\t'\n // find the first option\n const selectedOption = mentionOptions[mentionSelectedIndex]\n\n if (mention && tabOrEnter && selectedOption && !isGuest) {\n // get option text\n const retain = (delta.ops[0] && delta.ops[0].retain) || 0\n // prevent default\n\n // @ts-ignore\n handleSelectMention(selectedOption, retain)\n\n return\n }\n\n setEditorValue(content)\n\n const isDelete = delta.ops.length === 2 && !!delta.ops[1].delete\n\n if (!currentCharacter && isDelete) {\n currentCharacter = editor.getText(delta.ops[0].retain - 1, 1)\n }\n\n const isMention = mentionTypes.includes(currentCharacter)\n\n if (isMention) {\n const mentionIndex = delta.ops.findIndex((op: any) => 'insert' in op || 'delete' in op)\n const mention = currentCharacter\n let retain = mentionIndex === 0 ? 0 : delta.ops[mentionIndex - 1].retain\n if (isDelete) retain = retain - 1\n\n // for each mention denotation char, check if it is a mention\n // sort by length of mention denotation char\n let mentionMatch = null\n\n // loop through each mention denotation char, with longest first. First one to match is the one we want\n for (const chars of mentionTypes) {\n let isMatch = true\n // start with the last character\n if (chars.endsWith(mention)) {\n // loop through the chars backwards\n for (let i = chars.length - 1; i >= 0; i--) {\n // skip first character as that's already been checked\n if (i === 0) continue\n const char = chars[i - 1]\n const indexInDelta = retain - (chars.length - i)\n const valueCharAtIndex = editor.getText(indexInDelta, 1)\n if (valueCharAtIndex !== char) {\n isMatch = false\n break\n }\n }\n } else {\n isMatch = false\n }\n\n if (isMatch) {\n // console.log('match!!!', chars)\n mentionMatch = chars\n break\n }\n }\n\n if (mentionMatch) {\n setMention({\n type: mentionMatch,\n retain: retain,\n })\n } else {\n clearMention()\n }\n } else {\n // get full string between mention and new delta\n // This is where SEARCH is handled\n if (mention) {\n const retain = delta.ops[0].retain\n // if space is pressed, remove mention\n if (currentCharacter === ' ' || !retain) {\n clearMention()\n return\n }\n\n let distanceMentionToRetain = retain - mention.retain\n if (!isDelete) distanceMentionToRetain++\n const mentionFull = editor.getText(mention.retain, distanceMentionToRetain)\n const mentionSearch = mentionFull.replace(mention.type.slice(-1), '')\n // check for space in mentionFull\n if (mentionFull.includes(' ')) {\n clearMention()\n } else {\n setMention({\n ...mention,\n search: mentionSearch?.toLowerCase(),\n })\n }\n } else if (isDelete) {\n // backspace inside a mention deletes the whole mention\n const quill = editorRef.current.getEditor()\n const currentSelection = quill.getSelection(false)\n const currentFormat = quill.getFormat(currentSelection?.index, currentSelection?.length)\n if (currentFormat.mention) {\n const [lineBlock] = quill.getLine(currentSelection.index - 1) || []\n const ops = lineBlock?.cache?.delta?.ops || []\n const lastMentionOp = ops.reverse().find((op: any) => op.attributes?.mention)\n if (lastMentionOp) {\n const mentionLength = lastMentionOp.insert.length\n quill.deleteText(currentSelection.index - mentionLength, mentionLength)\n }\n }\n }\n }\n }\n\n const addTextToEditor = (type: string) => {\n // get editor retain\n const quill = editorRef.current.getEditor()\n\n let retain = quill.getSelection(true)?.index || 0\n\n // get character at retain\n const currentCharacter = quill.getText(retain - 1, 1)\n\n // if the current character is a character, increment retain\n const addSpace = currentCharacter !== ' ' && currentCharacter\n if (addSpace) {\n quill.insertText(retain, ' ')\n retain++\n }\n\n // This is hack AF, but it works\n typeWithDelay(quill, retain, type)\n }\n\n const handleMentionButton = (type: string) => {\n // first check if mention is already open\n if (mention) {\n const { type, retain, search = '' } = mention\n\n const quill = editorRef.current.getEditor()\n const length = type.length + search.length\n const start = retain - type.length + 1\n // delete the mention\n quill.deleteText(start, length)\n }\n\n addTextToEditor(type)\n }\n\n const handleOpenClick = () => {\n if (isOpen || disabled) return\n\n onOpen && onOpen()\n }\n\n const handleClose = () => {\n // get editor value\n const editor = editorRef.current.getEditor()\n const text = editor.getText()\n if (text.length < 2 || isEditing) {\n setEditorValue('')\n }\n\n // always close editor\n onClose && onClose()\n }\n\n const handleFileUploaded = ({ file, data }: any) => {\n const fileName = parseFilename(file.name)\n const newFile = {\n id: data.id,\n name: fileName,\n mime: file.type,\n size: file.size,\n order: files.length,\n }\n\n setFiles((prev) => [...prev, newFile])\n // remove from uploading\n setFilesUploading((prev) =>\n prev.filter((uploading: any) => parseFilename(uploading.name) !== fileName),\n )\n\n return newFile\n }\n\n const handleFileRemove = (id: string, name: string, isUnsavedAnnotation: boolean) => {\n if (isUnsavedAnnotation) {\n // remove from annotations (if it's an unsaved annotation)\n removeAnnotation?.(id)\n } else {\n // remove file from files\n setFiles((prev) => prev.filter((file) => file.id !== id))\n // remove from uploading\n setFilesUploading((prev) => {\n return prev.filter((file: any) => parseFilename(file.name) !== parseFilename(name))\n })\n }\n }\n\n const handleFileProgress = (e: any, file: any) => {\n const progress = Math.round((e.loaded * 100) / e.total)\n if (progress !== 100) {\n const fileName = parseFilename(file.name)\n const uploadProgress = {\n name: fileName,\n progress,\n type: file.type,\n order: files.length + filesUploading.length,\n }\n\n // @ts-ignore\n setFilesUploading((prev) => {\n // replace or add new progress\n const newProgress = prev.filter((name: any) => parseFilename(name.name) !== fileName)\n return [...newProgress, uploadProgress]\n })\n }\n }\n\n // when a file is not dropped onto the comment input\n const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {\n setIsDropping(false)\n // upload file\n handleFileDrop(e, projectName, handleFileProgress, handleFileUploaded)\n }\n\n const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDropping(true)\n }\n\n const uploadAnnotations = useAnnotationsUpload({\n projectName,\n onSuccess: handleFileUploaded,\n })\n\n const handleSubmit = async () => {\n try {\n setIsSubmitting(true)\n\n // upload any annotations first\n let annotationFiles = []\n let annotationMetadata: SavedAnnotationMetadata[] | undefined = undefined\n if (annotations.length) {\n const { files, metadata } = await uploadAnnotations(annotations)\n annotationFiles = files\n // get current files data\n const { annotations: annotationsData = [] } = data || {}\n // merge existing annotations data with new metadata\n annotationMetadata = [...annotationsData, ...metadata]\n }\n\n // convert to markdown\n const [markdown] = convertToMarkdown(editorValue)\n\n // remove img query params\n const markdownParsed = parseImages(markdown)\n\n const uploadedFiles = [...files, ...annotationFiles]\n\n const newData = {\n ...data,\n annotations: annotationMetadata, // could be undefined\n category: isGuest ? null : category, // guests cannot set category (it is done by default on backend)\n }\n\n if ((markdownParsed || uploadedFiles.length) && onSubmit) {\n try {\n await onSubmit(markdownParsed, uploadedFiles, newData)\n // only clear if onSubmit is successful\n setEditorValue('')\n setFiles([])\n } catch (error) {\n // error is handled in rtk query mutation\n return\n }\n }\n } catch (error) {\n console.error(error)\n toast.error('Something went wrong')\n } finally {\n setIsSubmitting(false)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (mention) {\n // close mention on escape\n if (e.key === 'Escape') {\n clearMention()\n return\n }\n\n // add top search of mention\n if (mention && e.key === 'Tab') {\n // we handle this in the onChange\n }\n\n const arrowDirection = e.key === 'ArrowUp' ? -1 : e.key === 'ArrowDown' ? 1 : 0\n\n if (arrowDirection) {\n // navigate through mentions\n e.preventDefault()\n let newIndex = mentionSelectedIndex + arrowDirection\n if (newIndex < 0) newIndex = shownMentionOptions.length - 1\n if (newIndex >= shownMentionOptions.length) newIndex = 0\n setMentionSelectedIndex(newIndex)\n }\n\n if (e.key === 'Enter') {\n // we handle this in the onChange\n }\n }\n\n if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {\n handleSubmit()\n }\n\n if (e.key === 'Escape') {\n handleClose()\n }\n }\n\n let quillMinHeight: number | undefined = isOpen ? initHeight + 41 : 44\n if (isEditing) quillMinHeight = undefined\n\n // QUILL CONFIG\n const modules = useMemo(\n () =>\n getModules({\n imageUploader: {\n projectName,\n onUpload: handleFileUploaded,\n onUploadProgress: handleFileProgress,\n },\n mentionTypeOptions,\n }),\n [projectName, setFiles, setFilesUploading],\n )\n\n const allFiles = [...annotations, ...(files || []), ...filesUploading].sort(\n (a, b) => a.order - b.order,\n )\n const compactGrid = allFiles.length > 3\n\n // disable version mentions for folders\n let mentionsError = null\n if (entities.length && entities[0].entityType === 'folder') {\n if (mention?.type === '@@') {\n mentionsError = 'Version mentions are disabled for folders'\n }\n }\n\n const getCommentPlaceholder = (isOpen?: boolean) => {\n if (disabled) {\n if (isGuest) return 'You do not have permission to comment.'\n return 'Commenting is disabled across multiple projects.'\n }\n\n if (isGuest || !isOpen) return 'Leave a comment'\n\n return 'Comment or mention with @user, @@version, @@@task...'\n }\n\n const handleReviewSubmit = async (status: VersionReviewFeedback) => {\n if (!onReview) return\n try {\n const postComment =\n (editorValue && editorValue !== EMPTY_EDITOR_VALUE) ||\n files.length > 0 ||\n annotations.length > 0\n // if the editor value is valid, also submit the comment first\n if (postComment) {\n await handleSubmit()\n }\n\n onReview(status)\n } catch (error) {\n console.error(error)\n toast.error('Something went wrong while submitting the review')\n }\n }\n\n const versionReviewButtons = versionReview && onReview && !disabled && (\n <Styled.VersionReviewButtons className={clsx('version-review-buttons', { guest: isGuest })}>\n <Styled.VersionReviewButton\n icon=\"check\"\n variant=\"tertiary\"\n data-tooltip=\"Approve\"\n onClick={() => handleReviewSubmit(VersionReviewFeedback.APPROVE)}\n >\n <span className=\"label\">Approve</span>\n </Styled.VersionReviewButton>\n <Styled.VersionReviewButton\n icon=\"refresh\"\n variant=\"danger\"\n data-tooltip=\"Request changes\"\n onClick={() => handleReviewSubmit(VersionReviewFeedback.REQUEST_CHANGES)}\n >\n <span className=\"label\">Request changes</span>\n </Styled.VersionReviewButton>\n </Styled.VersionReviewButtons>\n )\n\n return (\n <>\n <Styled.AutoHeight\n className={clsx('comment-container', { isOpen, isEditing })}\n onDragOver={handleDragOver}\n onDragLeave={() => setIsDropping(false)}\n onDrop={handleDrop}\n onClick={() => setIsDropping(false)}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {versionReview && lastOwnVersionReview && (\n <VersionReviewPill lastOwnVersionReview={lastOwnVersionReview} />\n )}\n\n <Styled.Comment\n className={clsx('block-shortcuts', {\n isOpen,\n isClosed: !isOpen || disabled,\n isEditing,\n isDropping,\n disabled,\n isLoading,\n isSubmitting,\n category: !!category && !isGuest,\n })}\n onKeyDown={handleKeyDown}\n onClick={handleOpenClick}\n $categoryPrimary={categoryData?.color}\n $categoryTertiary={blendedCategoryColor.primary}\n $categorySecondary={blendedCategoryColor.secondary}\n >\n <Styled.Markdown ref={markdownRef}>\n {/* this is purely used to translate the markdown into html for Editor */}\n <InputMarkdownConvert typeOptions={mentionTypeOptions} initValue={initValue} />\n </Styled.Markdown>\n\n {/* file uploads */}\n {isOpen && (\n <FilesGrid\n files={allFiles}\n isCompact={compactGrid || isEditing}\n onRemove={handleFileRemove}\n projectName={projectName}\n onAnnotationClick={goToAnnotation}\n style={{\n borderBottom: '1px solid var(--md-sys-color-outline-variant)',\n height: '100%',\n }}\n isEditing\n pt={{\n file: {\n style: {\n height: isEditing ? 70 : undefined,\n },\n },\n }}\n />\n )}\n {isOpen && !disabled ? (\n <QuillListStyles ref={editorContainerRef}>\n {!isGuest && (\n <ActivityCategorySelect\n value={category}\n categories={categoryOptions}\n onChange={(c) => setCategory(c)}\n isCompact={isEditing}\n hasPowerpack={hasLicense}\n onPowerFeature={onPowerFeature}\n isHidden={isCategoryHidden(categoryOptions, { isGuest, isAdmin })}\n style={{\n position: isEditing ? 'relative' : 'absolute',\n left: 4,\n top: isEditing ? 0 : 4,\n }}\n />\n )}\n\n <ReactQuill\n theme=\"snow\"\n style={{ minHeight: quillMinHeight, maxHeight: 300 }}\n ref={editorRef}\n value={editorValue}\n onChange={handleChange}\n readOnly={!isOpen}\n placeholder={getCommentPlaceholder(true)}\n modules={modules}\n formats={quillFormats}\n />\n </QuillListStyles>\n ) : (\n <Styled.Placeholder>{getCommentPlaceholder()}</Styled.Placeholder>\n )}\n\n <Styled.Footer>\n {!isGuest && (\n <Styled.Buttons>\n {/* mention a user */}\n <Button\n icon=\"person\"\n variant=\"text\"\n onClick={() => handleMentionButton('@')}\n data-tooltip={'Mention user'}\n data-shortcut={'@'}\n />\n {/* mention a version */}\n <Button\n icon=\"layers\"\n variant=\"text\"\n onClick={() => handleMentionButton('@@')}\n data-tooltip={'Mention version'}\n data-shortcut={'@@'}\n />\n {/* mention a task */}\n <Button\n icon=\"check_circle\"\n variant=\"text\"\n onClick={() => handleMentionButton('@@@')}\n data-tooltip={'Mention task'}\n data-shortcut={'@@@'}\n />\n </Styled.Buttons>\n )}\n <Styled.SubmitButtons>\n {isEditing && (\n <Button variant=\"text\" onClick={handleClose}>\n Cancel\n </Button>\n )}\n <SaveButton\n label={isEditing ? 'Save' : 'Comment'}\n className=\"comment\"\n active={!!editorValue || !!files.length}\n onClick={handleSubmit}\n disabled={isLoading}\n />\n </Styled.SubmitButtons>\n </Styled.Footer>\n\n <Styled.Dropzone className={clsx({ show: isDropping && isOpen })}>\n <Icon icon=\"cloud_upload\" />\n </Styled.Dropzone>\n </Styled.Comment>\n <CommentMentionSelect\n mention={mention}\n options={shownMentionOptions}\n onChange={handleSelectChange}\n onPrefixFilter={(prefix) => {\n setMentionPrefix(prefix)\n setMentionSelectedIndex(0)\n }}\n activePrefix={mentionPrefix ? mentionPrefix.replace(':', '') : undefined}\n types={mentionTypes}\n // @ts-ignore\n config={mentionTypeOptions[mention?.type]}\n noneFound={!shownMentionOptions.length && (mention?.search || mentionPrefix)}\n noneFoundAtAll={!shownMentionOptions.length && !mention?.search && !mentionPrefix}\n selectedIndex={mentionSelectedIndex}\n // @ts-ignore\n error={mentionsError}\n isGuest={isGuest}\n />\n\n <Styled.VersionReviewButtonsSpacer />\n {versionReviewButtons}\n </Styled.AutoHeight>\n </>\n )\n}\n\nexport default CommentInput\n"],"names":["Delta","Quill","EMPTY_EDITOR_VALUE","mentionTypes","CommentInput","initValue","initFiles","initCategory","data","versionReview","lastOwnVersionReview","onSubmit","onReview","isEditing","disabled","isLoading","isOpen","onOpen","onClose","projectName","entities","projectInfo","scope","feedFilter","mentionSuggestionsData","categories","isGuest","useFeedContext","hasLicense","onPowerFeature","user","useDetailsPanelContext","isAdmin","project","useProjectContext","mentionUsers","mentionTeams","mentionVersions","mentionTasks","initHeight","setInitHeight","useState","editorValue","setEditorValue","files","setFiles","filesUploading","setFilesUploading","isDropping","setIsDropping","isSubmitting","setIsSubmitting","annotations","removeAnnotation","goToAnnotation","useAnnotationsSync","mention","setMention","mentionSelectedIndex","setMentionSelectedIndex","mentionPrefix","setMentionPrefix","clearMention","category","setCategory","categoryOptions","cat","categoryData","blendedCategoryColor","useBlendedCategoryColor","editorRef","useRef","editorContainerRef","markdownRef","useInitialValue","useSetCursorEnd","useMentionLink","useEffect","a","b","mentionSearchWithPrefix","mentionOptions","useMemo","getMentionOptions","getMentionUsers","getMentionVersions","getMentionTasks","shownMentionOptions","newSelection","setNewSelection","handleSelectMention","selectedOption","quill","typePrefix","search","mentionLabel","type","mentionTypeOptions","href","startIndex","endIndex","handleSelectChange","option","handleChange","content","delta","_","editor","currentCharacter","tabOrEnter","isDelete","mentionIndex","op","retain","mentionMatch","chars","isMatch","i","char","indexInDelta","distanceMentionToRetain","mentionFull","mentionSearch","currentSelection","lineBlock","lastMentionOp","mentionLength","addTextToEditor","typeWithDelay","handleMentionButton","length","start","handleOpenClick","handleClose","handleFileUploaded","file","fileName","parseFilename","newFile","prev","uploading","handleFileRemove","id","name","isUnsavedAnnotation","handleFileProgress","progress","uploadProgress","handleDrop","handleFileDrop","handleDragOver","uploadAnnotations","useAnnotationsUpload","handleSubmit","annotationFiles","annotationMetadata","metadata","annotationsData","markdown","convertToMarkdown","markdownParsed","parseImages","uploadedFiles","newData","error","toast","handleKeyDown","arrowDirection","newIndex","quillMinHeight","modules","getModules","allFiles","compactGrid","mentionsError","getCommentPlaceholder","handleReviewSubmit","status","versionReviewButtons","Styled.VersionReviewButtons","clsx","jsx","Styled.VersionReviewButton","VersionReviewFeedback","Fragment","jsxs","Styled.AutoHeight","VersionReviewPill","Styled.Comment","Styled.Markdown","InputMarkdownConvert","FilesGrid","QuillListStyles","ActivityCategorySelect","c","isCategoryHidden","ReactQuill","quillFormats","Styled.Placeholder","Styled.Footer","Styled.Buttons","Button","Styled.SubmitButtons","SaveButton","Styled.Dropzone","Icon","CommentMentionSelect","prefix","Styled.VersionReviewButtonsSpacer"],"mappings":"gzlBA6C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8F,EAAAA,mBAAmBzC,GAAS,IAAI,EACxC,UAAW,CAAC+B,EAAoB,SAAW/B,GAAS,QAAUI,GAC9D,eAAgB,CAAC2B,EAAoB,QAAU,CAAC/B,GAAS,QAAU,CAACI,EACpE,cAAeF,EAEf,MAAOoH,GACP,QAAApJ,CAAA,CAAA,EAGF2J,EAAAA,kBAAAA,IAAC2B,EAAAA,2BAAA,EAAkC,EAClC9B,EAAA,CAAA,CAAA,EAEL,CAEJ"}
|
|
@@ -200,7 +200,7 @@ import "../../../../components/EntityPanelUploader/EntityPanelUploader.styled.es
|
|
|
200
200
|
import "axios";
|
|
201
201
|
import "../../../../components/ReviewablesList/ReviewablesList.styled.es.js";
|
|
202
202
|
import "../../../../components/ReviewablesList/ReviewablesUpload.styled.es.js";
|
|
203
|
-
import { parseFilename as
|
|
203
|
+
import { parseFilename as M } from "../../../../components/ReviewablesList/useReviewablesUpload.es.js";
|
|
204
204
|
import "../../../../components/EntityPath/EntityPath.styled.es.js";
|
|
205
205
|
import "../../../../components/EntityPath/SegmentProvider.es.js";
|
|
206
206
|
import "../../../../components/FeaturedVersionOrder/FeaturedVersionOrder.es.js";
|
|
@@ -324,14 +324,14 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
324
324
|
onSubmit: et,
|
|
325
325
|
onReview: L,
|
|
326
326
|
isEditing: s,
|
|
327
|
-
disabled:
|
|
327
|
+
disabled: k,
|
|
328
328
|
isLoading: rt,
|
|
329
329
|
isOpen: a,
|
|
330
330
|
onOpen: it,
|
|
331
331
|
onClose: nt
|
|
332
332
|
}) => {
|
|
333
333
|
const {
|
|
334
|
-
projectName:
|
|
334
|
+
projectName: j,
|
|
335
335
|
entities: H,
|
|
336
336
|
projectInfo: Vt,
|
|
337
337
|
scope: te,
|
|
@@ -358,7 +358,7 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
358
358
|
isOpen: a,
|
|
359
359
|
// @ts-expect-error - QueryFilter type is the same
|
|
360
360
|
filter: qt
|
|
361
|
-
}), _o({ initHeight: ct, editorRef: c, isEditing: s }), Ko({ projectName:
|
|
361
|
+
}), _o({ initHeight: ct, editorRef: c, isEditing: s }), Ko({ projectName: j }), It(() => {
|
|
362
362
|
if (a) {
|
|
363
363
|
if (c.current?.getEditor()?.enable(), D.length > 0 && v.length === 0)
|
|
364
364
|
return;
|
|
@@ -410,19 +410,19 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
410
410
|
g && (l = l - 1);
|
|
411
411
|
let w = null;
|
|
412
412
|
for (const C of q) {
|
|
413
|
-
let
|
|
413
|
+
let S = !0;
|
|
414
414
|
if (C.endsWith(p))
|
|
415
415
|
for (let x = C.length - 1; x >= 0; x--) {
|
|
416
416
|
if (x === 0) continue;
|
|
417
417
|
const lo = C[x - 1], co = l - (C.length - x);
|
|
418
418
|
if (n.getText(co, 1) !== lo) {
|
|
419
|
-
|
|
419
|
+
S = !1;
|
|
420
420
|
break;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
else
|
|
424
|
-
|
|
425
|
-
if (
|
|
424
|
+
S = !1;
|
|
425
|
+
if (S) {
|
|
426
426
|
w = C;
|
|
427
427
|
break;
|
|
428
428
|
}
|
|
@@ -447,9 +447,9 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
447
447
|
} else if (g) {
|
|
448
448
|
const u = c.current.getEditor(), p = u.getSelection(!1);
|
|
449
449
|
if (u.getFormat(p?.index, p?.length).mention) {
|
|
450
|
-
const [w] = u.getLine(p.index - 1) || [],
|
|
451
|
-
if (
|
|
452
|
-
const x =
|
|
450
|
+
const [w] = u.getLine(p.index - 1) || [], S = (w?.cache?.delta?.ops || []).reverse().find((x) => x.attributes?.mention);
|
|
451
|
+
if (S) {
|
|
452
|
+
const x = S.insert.length;
|
|
453
453
|
u.deleteText(p.index - x, x);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
@@ -466,11 +466,11 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
466
466
|
}
|
|
467
467
|
to(t);
|
|
468
468
|
}, oo = () => {
|
|
469
|
-
a ||
|
|
469
|
+
a || k || it && it();
|
|
470
470
|
}, jt = () => {
|
|
471
471
|
(c.current.getEditor().getText().length < 2 || s) && b(""), nt && nt();
|
|
472
472
|
}, W = ({ file: t, data: o }) => {
|
|
473
|
-
const r =
|
|
473
|
+
const r = M(t.name), n = {
|
|
474
474
|
id: o.id,
|
|
475
475
|
name: r,
|
|
476
476
|
mime: t.type,
|
|
@@ -478,27 +478,27 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
478
478
|
order: v.length
|
|
479
479
|
};
|
|
480
480
|
return A((i) => [...i, n]), R(
|
|
481
|
-
(i) => i.filter((d) =>
|
|
481
|
+
(i) => i.filter((d) => M(d.name) !== r)
|
|
482
482
|
), n;
|
|
483
483
|
}, eo = (t, o, r) => {
|
|
484
|
-
r ? Wt?.(t) : (A((n) => n.filter((i) => i.id !== t)), R((n) => n.filter((i) =>
|
|
484
|
+
r ? Wt?.(t) : (A((n) => n.filter((i) => i.id !== t)), R((n) => n.filter((i) => M(i.name) !== M(o))));
|
|
485
485
|
}, St = (t, o) => {
|
|
486
486
|
const r = Math.round(t.loaded * 100 / t.total);
|
|
487
487
|
if (r !== 100) {
|
|
488
|
-
const n =
|
|
488
|
+
const n = M(o.name), i = {
|
|
489
489
|
name: n,
|
|
490
490
|
progress: r,
|
|
491
491
|
type: o.type,
|
|
492
492
|
order: v.length + _.length
|
|
493
493
|
};
|
|
494
|
-
R((d) => [...d.filter((g) =>
|
|
494
|
+
R((d) => [...d.filter((g) => M(g.name) !== n), i]);
|
|
495
495
|
}
|
|
496
496
|
}, ro = (t) => {
|
|
497
|
-
E(!1), No(t,
|
|
497
|
+
E(!1), No(t, j, St, W);
|
|
498
498
|
}, io = (t) => {
|
|
499
499
|
t.preventDefault(), t.stopPropagation(), E(!0);
|
|
500
500
|
}, no = Qo({
|
|
501
|
-
projectName:
|
|
501
|
+
projectName: j,
|
|
502
502
|
onSuccess: W
|
|
503
503
|
}), Y = async () => {
|
|
504
504
|
try {
|
|
@@ -550,26 +550,26 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
550
550
|
const po = bt(
|
|
551
551
|
() => qo({
|
|
552
552
|
imageUploader: {
|
|
553
|
-
projectName:
|
|
553
|
+
projectName: j,
|
|
554
554
|
onUpload: W,
|
|
555
555
|
onUploadProgress: St
|
|
556
556
|
},
|
|
557
557
|
mentionTypeOptions: V
|
|
558
558
|
}),
|
|
559
|
-
[
|
|
559
|
+
[j, A, R]
|
|
560
560
|
), Tt = [...D, ...v || [], ..._].sort(
|
|
561
561
|
(t, o) => t.order - o.order
|
|
562
562
|
), so = Tt.length > 3;
|
|
563
563
|
let Dt = null;
|
|
564
564
|
H.length && H[0].entityType === "folder" && m?.type === "@@" && (Dt = "Version mentions are disabled for folders");
|
|
565
|
-
const Ft = (t) =>
|
|
565
|
+
const Ft = (t) => k ? h ? "You do not have permission to comment." : "Commenting is disabled across multiple projects." : h || !t ? "Leave a comment" : "Comment or mention with @user, @@version, @@@task...", Pt = async (t) => {
|
|
566
566
|
if (L)
|
|
567
567
|
try {
|
|
568
568
|
(T && T !== Zo || v.length > 0 || D.length > 0) && await Y(), L(t);
|
|
569
569
|
} catch (o) {
|
|
570
570
|
console.error(o), At.error("Something went wrong while submitting the review");
|
|
571
571
|
}
|
|
572
|
-
}, ao = tt && L && /* @__PURE__ */ e.jsxs(vo, { className: N("version-review-buttons", { guest: h }), children: [
|
|
572
|
+
}, ao = tt && L && !k && /* @__PURE__ */ e.jsxs(vo, { className: N("version-review-buttons", { guest: h }), children: [
|
|
573
573
|
/* @__PURE__ */ e.jsx(
|
|
574
574
|
Rt,
|
|
575
575
|
{
|
|
@@ -607,10 +607,10 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
607
607
|
{
|
|
608
608
|
className: N("block-shortcuts", {
|
|
609
609
|
isOpen: a,
|
|
610
|
-
isClosed: !a ||
|
|
610
|
+
isClosed: !a || k,
|
|
611
611
|
isEditing: s,
|
|
612
612
|
isDropping: dt,
|
|
613
|
-
disabled:
|
|
613
|
+
disabled: k,
|
|
614
614
|
isLoading: rt,
|
|
615
615
|
isSubmitting: zt,
|
|
616
616
|
category: !!B && !h
|
|
@@ -628,7 +628,7 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
628
628
|
files: Tt,
|
|
629
629
|
isCompact: so || s,
|
|
630
630
|
onRemove: eo,
|
|
631
|
-
projectName:
|
|
631
|
+
projectName: j,
|
|
632
632
|
onAnnotationClick: Yt,
|
|
633
633
|
style: {
|
|
634
634
|
borderBottom: "1px solid var(--md-sys-color-outline-variant)",
|
|
@@ -644,7 +644,7 @@ const Zo = "<p><br></p>", q = ["@", "@@", "@@@"], Wp = ({
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
),
|
|
647
|
-
a && !
|
|
647
|
+
a && !k ? /* @__PURE__ */ e.jsxs(Io, { ref: Ot, children: [
|
|
648
648
|
!h && /* @__PURE__ */ e.jsx(
|
|
649
649
|
Jo,
|
|
650
650
|
{
|