|
|
@ -13,7 +13,6 @@ const { |
|
|
|
audits, |
|
|
|
audits, |
|
|
|
isAuditLoading, |
|
|
|
isAuditLoading, |
|
|
|
saveComment: _saveComment, |
|
|
|
saveComment: _saveComment, |
|
|
|
comment: newComment, |
|
|
|
|
|
|
|
updateComment, |
|
|
|
updateComment, |
|
|
|
} = useExpandedFormStoreOrThrow() |
|
|
|
} = useExpandedFormStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
@ -23,6 +22,14 @@ const commentsWrapperEl = ref<HTMLDivElement>() |
|
|
|
|
|
|
|
|
|
|
|
const commentInputRef = ref<any>() |
|
|
|
const commentInputRef = ref<any>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const comment = ref('') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { copy } = useClipboard() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { dashboardUrl } = useDashboard() |
|
|
|
|
|
|
|
|
|
|
|
const editRef = ref<any>() |
|
|
|
const editRef = ref<any>() |
|
|
|
|
|
|
|
|
|
|
|
const { user, appInfo } = useGlobal() |
|
|
|
const { user, appInfo } = useGlobal() |
|
|
@ -68,10 +75,16 @@ async function onEditComment() { |
|
|
|
|
|
|
|
|
|
|
|
isCommentMode.value = true |
|
|
|
isCommentMode.value = true |
|
|
|
|
|
|
|
|
|
|
|
await updateComment(editComment.value.id!, { |
|
|
|
const tempCom = { |
|
|
|
comment: editComment.value?.comment, |
|
|
|
...editCommentValue.value, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isEditing.value = false |
|
|
|
|
|
|
|
editCommentValue.value = undefined |
|
|
|
|
|
|
|
await updateComment(tempCom.id!, { |
|
|
|
|
|
|
|
comment: tempCom.comment, |
|
|
|
}) |
|
|
|
}) |
|
|
|
onStopEdit() |
|
|
|
loadComments() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onCancel() { |
|
|
|
function onCancel() { |
|
|
@ -116,10 +129,16 @@ function scrollComments() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const isSaving = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const saveComment = async () => { |
|
|
|
const saveComment = async () => { |
|
|
|
if (isSaving.value) return |
|
|
|
if (!comment.value.trim()) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (comment.value.endsWith('<br />') || comment.value.endsWith('\n')) { |
|
|
|
|
|
|
|
if (comment.value.endsWith('<br />')) { |
|
|
|
|
|
|
|
comment.value = comment.value.slice(0, -6) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
comment.value = comment.value.slice(0, -2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isCommentMode.value = true |
|
|
|
isCommentMode.value = true |
|
|
|
isSaving.value = true |
|
|
|
isSaving.value = true |
|
|
@ -129,7 +148,7 @@ const saveComment = async () => { |
|
|
|
...comments.value, |
|
|
|
...comments.value, |
|
|
|
{ |
|
|
|
{ |
|
|
|
id: `temp-${new Date().getTime()}`, |
|
|
|
id: `temp-${new Date().getTime()}`, |
|
|
|
comment: newComment.value, |
|
|
|
comment: comment.value, |
|
|
|
created_at: new Date().toISOString(), |
|
|
|
created_at: new Date().toISOString(), |
|
|
|
created_by: user.value?.id, |
|
|
|
created_by: user.value?.id, |
|
|
|
created_by_email: user.value?.email, |
|
|
|
created_by_email: user.value?.email, |
|
|
@ -137,13 +156,16 @@ const saveComment = async () => { |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tempCom = comment.value |
|
|
|
|
|
|
|
comment.value = '' |
|
|
|
|
|
|
|
|
|
|
|
commentInputRef?.value?.setEditorContent('', true) |
|
|
|
commentInputRef?.value?.setEditorContent('', true) |
|
|
|
await nextTick(() => { |
|
|
|
await nextTick(() => { |
|
|
|
scrollComments() |
|
|
|
scrollComments() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await _saveComment() |
|
|
|
await _saveComment(tempCom) |
|
|
|
await nextTick(() => { |
|
|
|
await nextTick(() => { |
|
|
|
isExpandedFormCommentMode.value = true |
|
|
|
isExpandedFormCommentMode.value = true |
|
|
|
}) |
|
|
|
}) |
|
|
@ -235,9 +257,7 @@ const createdBy = ( |
|
|
|
<div v-for="comment of comments" :key="comment.id" :class="`${comment.id}`" class="nc-comment-item"> |
|
|
|
<div v-for="comment of comments" :key="comment.id" :class="`${comment.id}`" class="nc-comment-item"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
|
'hover:bg-gray-200 bg-[#F9F9FA]': comment.id !== editComment?.id, |
|
|
|
'hover:bg-gray-100': editCommentValue?.id !== comment!.id |
|
|
|
'bg-gray-200': comment.id === editComment?.id, |
|
|
|
|
|
|
|
'!bg-[#E7E7E9]': comment.resolved_by, |
|
|
|
|
|
|
|
}" |
|
|
|
}" |
|
|
|
class="group gap-3 overflow-hidden px-3 py-2" |
|
|
|
class="group gap-3 overflow-hidden px-3 py-2" |
|
|
|
> |
|
|
|
> |
|
|
@ -337,7 +357,7 @@ const createdBy = ( |
|
|
|
v-model:value="value" |
|
|
|
v-model:value="value" |
|
|
|
autofocus |
|
|
|
autofocus |
|
|
|
:hide-options="false" |
|
|
|
:hide-options="false" |
|
|
|
class="expanded-form-comment-edit-input expanded-form-comment-input !pt-2 !pb-0.5 !pl-2 !m-0 w-full !border-1 !border-gray-200 !rounded-lg !bg-white !text-gray-800 !text-small !leading-18px !max-h-[694px]" |
|
|
|
class="expanded-form-comment-edit-input cursor-text expanded-form-comment-input !py-2 !px-2 !m-0 w-full !border-1 !border-gray-200 !rounded-lg !bg-white !text-gray-800 !text-small !leading-18px !max-h-[240px]" |
|
|
|
data-testid="expanded-form-comment-input" |
|
|
|
data-testid="expanded-form-comment-input" |
|
|
|
sync-value-change |
|
|
|
sync-value-change |
|
|
|
@save="onEditComment" |
|
|
|
@save="onEditComment" |
|
|
@ -366,10 +386,10 @@ const createdBy = ( |
|
|
|
<div v-if="hasEditPermission" class="bg-gray-50 nc-comment-input !rounded-br-2xl gap-2 flex"> |
|
|
|
<div v-if="hasEditPermission" class="bg-gray-50 nc-comment-input !rounded-br-2xl gap-2 flex"> |
|
|
|
<SmartsheetExpandedFormRichComment |
|
|
|
<SmartsheetExpandedFormRichComment |
|
|
|
ref="commentInputRef" |
|
|
|
ref="commentInputRef" |
|
|
|
v-model:value="newComment" |
|
|
|
v-model:value="comment" |
|
|
|
:hide-options="false" |
|
|
|
:hide-options="false" |
|
|
|
placeholder="Comment..." |
|
|
|
placeholder="Comment..." |
|
|
|
class="expanded-form-comment-input !m-0 pt-2 w-full !border-t-1 !border-gray-200 !bg-transparent !text-gray-800 !text-small !leading-18px !max-h-[566px]" |
|
|
|
class="expanded-form-comment-input !py-2 !px-2 cursor-text border-1 rounded-lg w-full bg-transparent !text-gray-800 !text-small !leading-18px !max-h-[240px]" |
|
|
|
:autofocus="isExpandedFormCommentMode" |
|
|
|
:autofocus="isExpandedFormCommentMode" |
|
|
|
data-testid="expanded-form-comment-input" |
|
|
|
data-testid="expanded-form-comment-input" |
|
|
|
@focus="isExpandedFormCommentMode = false" |
|
|
|
@focus="isExpandedFormCommentMode = false" |
|
|
@ -512,7 +532,8 @@ const createdBy = ( |
|
|
|
box-shadow: none; |
|
|
|
box-shadow: none; |
|
|
|
&:focus, |
|
|
|
&:focus, |
|
|
|
&:focus-within { |
|
|
|
&:focus-within { |
|
|
|
@apply min-h-16; |
|
|
|
@apply min-h-16 !bg-white border-brand-500; |
|
|
|
|
|
|
|
box-shadow: 0px 0px 0px 2px rgba(51, 102, 255, 0.24); |
|
|
|
} |
|
|
|
} |
|
|
|
&::placeholder { |
|
|
|
&::placeholder { |
|
|
|
@apply !text-gray-400; |
|
|
|
@apply !text-gray-400; |
|
|
|