mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-12 01:59:34 -05:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user