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 wrapper = ref()
const { dashboardUrl } = useDashboard()
const { copy } = useClipboard()
const { isMobileMode } = useGlobal() const { isMobileMode } = useGlobal()
const { t } = useI18n() const { t } = useI18n()
@ -63,6 +67,8 @@ const state = toRef(props, 'state')
const meta = toRef(props, 'meta') const meta = toRef(props, 'meta')
const route = useRoute()
const router = useRouter() const router = useRouter()
const isPublic = inject(IsPublicInj, ref(false)) 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 () => { const saveChanges = async () => {
isUnsavedFormExist.value = false isUnsavedFormExist.value = false
await save() await save()
@ -418,6 +435,12 @@ export default {
{{ $t('general.reload') }} {{ $t('general.reload') }}
</div> </div>
</NcMenuItem> </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 <NcMenuItem
v-if="isUIAllowed('dataEdit') && !isNew" v-if="isUIAllowed('dataEdit') && !isNew"
class="text-gray-700" class="text-gray-700"

Loading…
Cancel
Save