chfw commented on a change in pull request #13848:
URL:
https://github.com/apache/incubator-echarts/pull/13848#discussion_r546961094
##########
File path: src/component/tooltip/tooltipMarkup.ts
##########
@@ -401,36 +446,46 @@ function wrapBlockHTML(
+ '</div>';
}
-function wrapInlineNameHTML(name: string, leftHasMarker: boolean): string {
+function wrapInlineNameHTML(
+ name: string,
+ leftHasMarker: boolean,
+ style: string
+): string {
const marginCss = leftHasMarker ? 'margin-left:2px' : '';
- return `<span style="${TOOLTIP_NAME_TEXT_STYLE_CSS};${marginCss}">`
+ return `<span style="${style};${marginCss}">`
+ encodeHTML(name)
+ '</span>';
}
-function wrapInlineValueHTML(valueList: string[], alignRight: boolean,
valueCloseToMarker: boolean): string {
+function wrapInlineValueHTML(
+ valueList: string[],
+ alignRight: boolean,
+ valueCloseToMarker: boolean,
+ style: string
+): string {
// Do not too close to marker, considering there are multiple values
separated by spaces.
const paddingStr = valueCloseToMarker ? '10px' : '20px';
const alignCSS = alignRight ? `float:right;margin-left:${paddingStr}` : '';
return (
- `<span style="${alignCSS};${TOOLTIP_VALUE_TEXT_STYLE_CSS}">`
+ `<span style="${alignCSS};${style}">`
// Value has commas inside, so use ' ' as delimiter for multiple
values.
+ map(valueList, value => encodeHTML(value)).join(' ')
+ '</span>'
);
}
-function wrapInlineNameRichText(ctx: TooltipMarkupBuildContext, name: string):
string {
- return ctx.markupStyleCreator.wrapRichTextStyle(name,
TOOLTIP_TEXT_STYLE_RICH);
+function wrapInlineNameRichText(ctx: TooltipMarkupBuildContext, name: string,
style: RichTextStyle): string {
+ return ctx.markupStyleCreator.wrapRichTextStyle(name, style as
Dictionary<unknown>);
}
function wrapInlineValueRichText(
ctx: TooltipMarkupBuildContext,
valueList: string[],
alignRight: boolean,
- valueCloseToMarker: boolean
+ valueCloseToMarker: boolean,
+ style: RichTextStyle
): string {
- const styles: Dictionary<unknown>[] = [TOOLTIP_VALUE_TEXT_STYLE_RICH];
+ const styles: Dictionary<unknown>[] = [style];
Review comment:
Instead of unknown, use `RichTextStyle`? i.e.:
const styles: Dictionary<RichTextStyle>[] = [style];
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]