Browse Source

feat: copy expanded record url

pull/6575/head
DarkPhoenix2704 1 year ago
parent
commit
0dcd63003d
  1. 23
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

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

@ -51,6 +51,10 @@ const key = ref(0)
const wrapper = ref()
const { dashboardUrl } = useDashboard()
const { copy } = useClipboard()
const { isMobileMode } = useGlobal()
const { t } = useI18n()
@ -63,6 +67,8 @@ const state = toRef(props, 'state')
const meta = toRef(props, 'meta')
const route = useRoute()
const router = useRouter()
const isPublic = inject(IsPublicInj, ref(false))
@ -188,6 +194,17 @@ const onNext = async () => {
}
}
const copyRecordUrl = () => {
copy(
encodeURI(
`${dashboardUrl?.value}#/${route.params.typeOrId}/${route.params.baseId}/${meta.value?.id}${
props.view ? `/${props.view.title}` : ''
}?rowId=${primaryKey.value}`,
),
)
message.success('Copied to clipboard')
}
const saveChanges = async () => {
isUnsavedFormExist.value = false
await save()
@ -418,6 +435,12 @@ export default {
{{ $t('general.reload') }}
</div>
</NcMenuItem>
<NcMenuItem v-if="!isNew" class="text-gray-700" @click="!isNew ? copyRecordUrl() : () => {}">
<div v-e="['c:row-expand:copy-url']" data-testid="nc-expanded-form-copy-url" class="flex gap-2 items-center">
<component :is="iconMap.link" class="cursor-pointer nc-duplicate-row" />
Copy record URL
</div>
</NcMenuItem>
<NcMenuItem
v-if="isUIAllowed('dataEdit') && !isNew"
class="text-gray-700"

Loading…
Cancel
Save