fix(task): use DOMParser in task glance tooltip description preview
Replace innerHTML on a detached element with DOMParser for extracting plain text from task descriptions.
This commit is contained in:
parent
3c2977b126
commit
dd0b82f00a
|
|
@ -113,10 +113,8 @@ const descriptionPreview = computed(() => {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a temporary div to extract plain text from HTML
|
const doc = new DOMParser().parseFromString(props.task.description, 'text/html')
|
||||||
const tempDiv = document.createElement('div')
|
const plainText = doc.body.textContent || ''
|
||||||
tempDiv.innerHTML = props.task.description
|
|
||||||
const plainText = tempDiv.textContent || tempDiv.innerText || ''
|
|
||||||
|
|
||||||
const trimmedText = plainText.trim()
|
const trimmedText = plainText.trim()
|
||||||
if (trimmedText.length <= MAX_DESCRIPTION_LENGTH) {
|
if (trimmedText.length <= MAX_DESCRIPTION_LENGTH) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue