diff --git a/packages/nc-gui/components/cell/RichText/LinkOptions.vue b/packages/nc-gui/components/cell/RichText/LinkOptions.vue
index 5c89009095..49c0f7ef96 100644
--- a/packages/nc-gui/components/cell/RichText/LinkOptions.vue
+++ b/packages/nc-gui/components/cell/RichText/LinkOptions.vue
@@ -11,6 +11,7 @@ const emits = defineEmits(['blur'])
interface Props {
editor: Editor
isFormField?: boolean
+ isComment?: boolean
}
const { editor, isFormField } = toRefs(props)
@@ -164,6 +165,9 @@ const openLink = () => {
const onMountLinkOptions = (e) => {
if (e?.popper?.style) {
+ if (props.isComment) {
+ e.popper.style.left = '-10%'
+ }
e.popper.style.width = '95%'
}
}
@@ -233,14 +237,6 @@ const tabIndex = computed(() => {
-
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
index 3e90a9d0d3..fb1ef536eb 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
@@ -13,7 +13,6 @@ const {
audits,
isAuditLoading,
saveComment: _saveComment,
- comment: newComment,
updateComment,
} = useExpandedFormStoreOrThrow()
@@ -23,6 +22,14 @@ const commentsWrapperEl = ref()
const commentInputRef = ref()
+const comment = ref('')
+
+const { copy } = useClipboard()
+
+const route = useRoute()
+
+const { dashboardUrl } = useDashboard()
+
const editRef = ref()
const { user, appInfo } = useGlobal()
@@ -68,10 +75,16 @@ async function onEditComment() {
isCommentMode.value = true
- await updateComment(editComment.value.id!, {
- comment: editComment.value?.comment,
+ const tempCom = {
+ ...editCommentValue.value,
+ }
+
+ isEditing.value = false
+ editCommentValue.value = undefined
+ await updateComment(tempCom.id!, {
+ comment: tempCom.comment,
})
- onStopEdit()
+ loadComments()
}
function onCancel() {
@@ -116,10 +129,16 @@ function scrollComments() {
}
}
-const isSaving = ref(false)
-
const saveComment = async () => {
- if (isSaving.value) return
+ if (!comment.value.trim()) return
+
+ while (comment.value.endsWith('
') || comment.value.endsWith('\n')) {
+ if (comment.value.endsWith('
')) {
+ comment.value = comment.value.slice(0, -6)
+ } else {
+ comment.value = comment.value.slice(0, -2)
+ }
+ }
isCommentMode.value = true
isSaving.value = true
@@ -129,7 +148,7 @@ const saveComment = async () => {
...comments.value,
{
id: `temp-${new Date().getTime()}`,
- comment: newComment.value,
+ comment: comment.value,
created_at: new Date().toISOString(),
created_by: user.value?.id,
created_by_email: user.value?.email,
@@ -137,13 +156,16 @@ const saveComment = async () => {
},
]
+ const tempCom = comment.value
+ comment.value = ''
+
commentInputRef?.value?.setEditorContent('', true)
await nextTick(() => {
scrollComments()
})
try {
- await _saveComment()
+ await _saveComment(tempCom)
await nextTick(() => {
isExpandedFormCommentMode.value = true
})
@@ -235,10 +257,8 @@ const createdBy = (
)+$/g, ''), + comment: `${comment}`.replace(/(
)+$/g, ''), }) // Increase Comment Count in rowMeta @@ -275,8 +276,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m // reloadTrigger?.trigger() await Promise.all([loadComments(), loadAudits()]) - - comment.value = '' } catch (e: any) { comments.value = comments.value.filter((c) => !(c.id ?? '').startsWith('temp-')) message.error( @@ -526,7 +525,34 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m } const updateComment = async (commentId: string, comment: Partial