helgasoft commented on issue #18253:
URL: https://github.com/apache/echarts/issues/18253#issuecomment-1424765310
@sirAbramstone, great catch! Here is proposed code for your PR.
```
function getTooltipTextStyle(
textStyle: TooltipOption['textStyle'],
renderMode: TooltipRenderMode
): {
nameStyle: TextStyle
valueStyle: TextStyle
} {
const nameFontColor = textStyle.color || '#6e7079';
const nameFontSize = textStyle.fontSize || '12px';
const nameFontWeight = textStyle.fontWeight || '400';
const valueFontColor = textStyle.color || '#464646';
const valueFontSize = textStyle.fontSize || '14px';
const valueFontWeight = textStyle.fontWeight || '900';
if (renderMode === 'html') {
// `textStyle` is probably from user input, should be encoded to
reduce security risk.
return {
// eslint-disable-next-line max-len
nameStyle: `font-size:${encodeHTML(nameFontSize +'')};
color:${encodeHTML(nameFontColor)}; font-weight:${encodeHTML(nameFontWeight
+'')}`,
valueStyle: `font-size:${encodeHTML(valueFontSize
+'')};color:${encodeHTML(valueFontColor)};font-weight:${encodeHTML(valueFontWeight
+'')}`
}
}
return {
nameStyle: {
fontSize: nameFontSize,
fill: nameFontColor,
fontWeight: nameFontWeight
},
valueStyle: {
fontSize: valueFontSize,
fill: valueFontColor,
fontWeight: valueFontWeight
}
};
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]