fix(图表): 修复数据源标题带有特殊字符时,富文本的指标数据无法显示 #17482 (#17634)

This commit is contained in:
王嘉豪
2025-12-17 17:01:58 +08:00
committed by GitHub
parent 321a48da47
commit 15cd539756

View File

@@ -130,6 +130,7 @@ const language_map = {
tw: 'zh_TW',
'zh-CN': 'zh_CN'
}
const language = language_map[userStore.getLanguage]
const dataRowSelect = ref({})
const dataRowNameSelect = ref({})
@@ -382,7 +383,7 @@ const assignment = content => {
if (on) {
const thresholdStyleInfo = conditionAdaptor(state.viewDataInfo)
on.forEach(itm => {
if (dataRowFiledName.value.includes(itm)) {
if (dataRowFiledName.value.includes(decodeHTMLEntities(itm))) {
const ele = itm.slice(1, -1)
let value =
dataRowNameSelect.value[ele] !== undefined ? dataRowNameSelect.value[ele] : null
@@ -411,6 +412,22 @@ const assignment = content => {
return content
}
const decodeHTMLEntities = text => {
if (!text) return text
const textarea = document.createElement('textarea')
textarea.innerHTML = text
return textarea.value
}
const encodeHTMLEntities = text => {
if (!text) return text
const textarea = document.createElement('textarea')
textarea.textContent = text
return textarea.innerHTML
}
const initFontFamily = htmlText => {
const regex = /font-family:\s*([^;"]+);/g
let match