Browse Source

make urls clickable in popups and text selectable

pull/5247/head
flisowna 2 years ago
parent
commit
58beed0de5
  1. 13
      packages/nc-gui/components/smartsheet/Map.vue

13
packages/nc-gui/components/smartsheet/Map.vue

@ -196,11 +196,17 @@ watch([formattedData, mapMetaData, markersClusterGroupRef], () => {
const listItems = Object.entries(row.row) const listItems = Object.entries(row.row)
.filter(([key, val]) => val !== null) .filter(([key, val]) => val !== null)
.map(([key, val]) => { .map(([key, val]) => {
const prettyVal = typeof val === 'object' || Array.isArray(val) ? JSON.stringify(val) : val let prettyVal = val
if (val !== null && (typeof val === 'object' || Array.isArray(val))) {
prettyVal = JSON.stringify(val)
} else if (typeof val === 'string' && (val.startsWith('http://') || val.startsWith('https://'))) {
prettyVal = `<a href="${val}" target="_blank">${val}</a>`
}
return `<li><b>${key}</b>: <br/>${prettyVal}</li>` return `<li><b>${key}</b>: <br/>${prettyVal}</li>`
}) })
.join('') .join('')
const popupContent = `<ul>${listItems}</ul>`
const popupContent = `<ul class="selectable">${listItems}</ul>`
const [lat, long] = primaryGeoDataValue.split(';').map(parseFloat) const [lat, long] = primaryGeoDataValue.split(';').map(parseFloat)
@ -276,4 +282,7 @@ const count = computed(() => paginationData.value.totalRows)
max-height: 255px; max-height: 255px;
overflow: scroll; overflow: scroll;
} }
.selectable {
user-select: text;
}
</style> </style>

Loading…
Cancel
Save