Browse Source

fix: pr review changes

pull/9766/head
DarkPhoenix2704 3 weeks ago
parent
commit
5c3c6cdbcc
  1. 22
      packages/nc-gui/components/cell/RichText.vue
  2. 12
      packages/nc-gui/components/cell/TextArea.vue
  3. 4
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  4. 5
      packages/nc-gui/helpers/tiptapExtensions/mention/index.ts

22
packages/nc-gui/components/cell/RichText.vue

@ -134,12 +134,20 @@ if (appInfo.value.ee) {
const colorStyles = bUser?.id === user.value?.id ? '' : 'bg-[#D4F7E0] text-[#17803D]'
return `<span data-type="mention" data-id='{
"id": "${bUser?.id}",
"email": "${bUser?.email}",
"name": "${bUser?.display_name ?? ''}",
"isSameUser": "${bUser?.id === user.value?.id}"
}' class="${colorStyles} mention font-semibold m-0.5 rounded-md px-1">@${processedContent}</span>`
const span = document.createElement('span')
span.setAttribute('data-type', 'mention')
span.setAttribute(
'data-id',
JSON.stringify({
id: bUser?.id,
email: bUser?.email,
name: bUser?.display_name ?? '',
isSameUser: bUser?.id === user.value?.id,
}),
)
span.setAttribute('class', `${colorStyles} mention font-semibold m-0.5 rounded-md px-1`)
span.textContent = `@${processedContent}`
return span.outerHTML
}
return text.replace(regex, replacement)
@ -160,7 +168,7 @@ if (appInfo.value.ee) {
name: user.display_name,
email: user.email,
}))
.filter((user) => user.label.toLowerCase() === content.toLowerCase())[0]
.find((user) => user.label.toLowerCase() === content.toLowerCase()) as any
return `@(${user.id}|${user.email}|${user.display_name ?? ''})`
},

12
packages/nc-gui/components/cell/TextArea.vue

@ -225,6 +225,7 @@ watch([widthTextArea, heightTextArea], () => {
})
const updateSize = () => {
try {
const size = localStorage.getItem(STORAGE_KEY)
let elem = document.querySelector('.nc-text-area-expanded') as HTMLElement
@ -232,9 +233,14 @@ const updateSize = () => {
elem = document.querySelector('.nc-long-text-expanded-modal .nc-textarea-rich-editor .tiptap') as HTMLElement
}
if (size && elem) {
elem.style.width = `${JSON.parse(size).width}px`
elem.style.height = `${JSON.parse(size).height}px`
const parsedJSON = JSON.parse(size)
if (parsedJSON && elem) {
elem.style.width = `${parsedJSON.width}px`
elem.style.height = `${parsedJSON.height}px`
}
} catch (e) {
console.error(e)
}
}

4
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -576,7 +576,7 @@ watch([expandedFormScrollWrapper, isLoading], () => {
})
mentionedCell.value = columnId as string
scrollToColumn(columnId as string)
onClickOutside(document.querySelector(`.${mentionedCell.value}`)! as HTMLDivElement, () => {
onClickOutside(document.querySelector(`[col-id="${columnId}"]`)! as HTMLDivElement, () => {
mentionedCell.value = null
})
} else {
@ -813,7 +813,7 @@ export default {
v-for="(col, i) of fields"
v-show="!isVirtualCol(col) || !isNew || isLinksOrLTAR(col)"
:key="col.title"
:class="`nc-expand-col-${col.title} ${col.id}`"
:class="`nc-expand-col-${col.title}`"
:col-id="col.id"
:data-testid="`nc-expand-col-${col.title}`"
class="nc-expanded-form-row w-full"

5
packages/nc-gui/helpers/tiptapExtensions/mention/index.ts

@ -7,7 +7,10 @@ export const Mention = TipTapMention.Mention.extend({
const innerText = attributes.name && attributes.name.length > 0 ? attributes.name : attributes.email
const styles = attributes.isSameUser === 'true' ? 'bg-[#D4F7E0] text-[#17803D]' : 'bg-brand-50 text-brand-500'
const styles =
attributes.isSameUser === true || attributes.isSameUser === 'true'
? 'bg-[#D4F7E0] text-[#17803D]'
: 'bg-brand-50 text-brand-500'
return [
'span',

Loading…
Cancel
Save