Files
Davide Silvestri 23f328cb19 feat(database): assign identities to rows and mention them in comments (#6619)
* feat(database): assign and mention identities behind a field option

- Collaborator fields get `include_identities` and long text fields
  `long_text_include_identities`, both off by default.
- With the option on, active identities of the workspace can be assigned
  or suggested as mentions; they are shown with their icon and renamed
  in realtime, and they never receive notifications.
- Turning the collaborator option off backs up the column, deletes the
  identity assignments and strips identities from the view defaults, so
  the update can be undone.
- Identities can author row comments and be mentioned in them.
- Exports write an identity as `Name <identity>`.

* refactor: hide internal emails in collaborator exports through one check

* fix: import a personal view only for a person, without a query per owner

* fix: show collaborator identities with the icon of the user subject type

* refactor: drop a redundant local import of the core handler

* fix: unify identity icons and space field options

* fix: keep identity field menus and saved mentions readable

* fix: limit identity mention suggestions to row comments

* perf: prefetch available collaborators once per workspace

* fix: use workspace members as authors of generated rows

* fix: resolve linked collaborator values by member email

* fix: use workspace collaborators for field pickers and paste

* refactor: move identity avatar styles to the avatar stylesheet

* fix: address review feedback on identity collaborators
2026-11-18 22:53:44 +01:00

100 lines
2.4 KiB
Vue

<template>
<Modal
ref="modal"
:full-height="true"
:content-padding="false"
:right="true"
:can-close="!error"
@show="show"
@hidden="$emit('hidden', $event)"
>
<template #content>
<div class="rich-text-modal">
<div class="box__title">
<h2 class="row-modal__title">
{{ field.name }}
</h2>
</div>
<Alert v-if="error" type="error" class="rich-text-modal__alert">
{{ error }}
</Alert>
<RichTextEditor
ref="editor"
class="rich-text-modal__editor"
:enable-rich-text-formatting="true"
:enable-images="enableImages"
:mentionable-users="mentionableUsers"
:allow-identity-suggestions="false"
:model-value="modelValue"
:clipboard-markdown-resolver="resolveClipboardMarkdown"
:upload-file="uploadFile"
@update:model-value="$emit('update:modelValue', $event)"
></RichTextEditor>
</div>
</template>
</Modal>
</template>
<script>
import RichTextEditor from '@baserow/modules/core/components/editor/RichTextEditor.vue'
import Alert from '@baserow/modules/core/components/Alert'
import modal from '@baserow/modules/core/mixins/modal'
import { getRichTextClipboardContent } from '@baserow/modules/database/utils/clipboard'
export default {
name: 'FieldRichTextModal',
components: { RichTextEditor, Alert },
mixins: [modal],
props: {
field: {
type: Object,
required: true,
},
modelValue: {
type: [String, Object],
required: true,
},
mentionableUsers: {
type: [Array],
default: () => [],
},
enableImages: {
type: Boolean,
default: true,
},
error: {
type: String,
default: null,
},
uploadFile: {
type: Function,
default: null,
},
},
emits: ['hidden', 'input', 'update:modelValue'],
watch: {
modelValue: {
handler(value) {
this.richCopy = value || ''
},
immediate: true,
},
},
methods: {
resolveClipboardMarkdown: getRichTextClipboardContent,
show() {
this.$nextTick(() => {
this.$refs.editor.focus()
})
},
isOpen() {
return this.$refs.modal.isOpen()
},
// Editor is only mounted while open; guard for reactive validation during the transition.
serializeToMarkdown() {
return this.$refs.editor?.serializeToMarkdown() ?? ''
},
},
}
</script>