mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-03 23:37:23 +00:00
Nc fix(nc-gui): allow copy paste email id from gmail in team & settings, for example, abc <abc@gmail.com> (#7963)
* fix(nc-gui): allow copy paste email id from gmail * fix(nc-gui): skip display error & add only valid emails if user copy paste bulk emails in team & settings invite input element * fix(nc-gui): add a comment explaining the regex pattern for email validate/extract * fix(nc-gui): allow copy paste emailid from gmail in team & settings oss * fix(nc-gui): add support to extract email from pasted string in email cell if accept only email is true
This commit is contained in:
@@ -4,6 +4,7 @@ import type { RoleLabels } from 'nocodb-sdk'
|
||||
import { OrderedWorkspaceRoles, WorkspaceUserRoles } from 'nocodb-sdk'
|
||||
import { extractSdkResponseErrorMsg, useWorkspace } from '#imports'
|
||||
import { validateEmail } from '~/utils/validation'
|
||||
import { extractEmail } from '~/helpers/parsers/parserHelpers'
|
||||
|
||||
const inviteData = reactive({
|
||||
email: '',
|
||||
@@ -42,13 +43,17 @@ const insertOrUpdateString = (str: string) => {
|
||||
emailBadges.value.push(str)
|
||||
}
|
||||
|
||||
const emailInputValidation = (input: string): boolean => {
|
||||
const emailInputValidation = (input: string, isBulkEmailCopyPaste: boolean = false): boolean => {
|
||||
if (!input.length) {
|
||||
if (isBulkEmailCopyPaste) return false
|
||||
|
||||
emailValidation.isError = true
|
||||
emailValidation.message = 'Email should not be empty'
|
||||
return false
|
||||
}
|
||||
if (!validateEmail(input.trim())) {
|
||||
if (isBulkEmailCopyPaste) return false
|
||||
|
||||
emailValidation.isError = true
|
||||
emailValidation.message = 'Invalid Email'
|
||||
return false
|
||||
@@ -164,6 +169,8 @@ onKeyStroke('Backspace', () => {
|
||||
|
||||
// when bulk email is pasted
|
||||
const onPaste = (e: ClipboardEvent) => {
|
||||
emailValidation.isError = false
|
||||
|
||||
const pastedText = e.clipboardData?.getData('text')
|
||||
|
||||
const inputArray = pastedText?.split(',') || pastedText?.split(' ')
|
||||
@@ -175,7 +182,9 @@ const onPaste = (e: ClipboardEvent) => {
|
||||
}
|
||||
|
||||
inputArray?.forEach((el) => {
|
||||
const isEmailIsValid = emailInputValidation(el)
|
||||
el = extractEmail(el) || el
|
||||
|
||||
const isEmailIsValid = emailInputValidation(el, inputArray.length > 1)
|
||||
|
||||
if (!isEmailIsValid) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user