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 ''
|
||||
}
|
||||
|
||||
// Create a temporary div to extract plain text from HTML
|
||||
const tempDiv = document.createElement('div')
|
||||
tempDiv.innerHTML = props.task.description
|
||||
const plainText = tempDiv.textContent || tempDiv.innerText || ''
|
||||
const doc = new DOMParser().parseFromString(props.task.description, 'text/html')
|
||||
const plainText = doc.body.textContent || ''
|
||||
|
||||
const trimmedText = plainText.trim()
|
||||
if (trimmedText.length <= MAX_DESCRIPTION_LENGTH) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue