apache / apache/echarts

Wrong token parse in rich text

Open
#14,889 0 comments 0 reactions 0 assignees View on GitHub
bug en
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version
5.1.1

### Steps to reproduce
```js
option = {
legend: {
formatter: '{a|{name}}',
textStyle: {
rich: {
a: {
width: 200
}
}
}
},
series: [
{
name: '访问来源',
type: 'pie',
data: [
{value: 1048, name: '搜索引擎{}'},
{value: 300, name: '视频广告'}
]
}
]
};
```

### What is expected?
No space in the '{}'

### What is actually happening?

Screen Shot 2021-05-08 at 11 51 45 AM

And I have not found a work around yet.

### Discuss

1. Should the rich text delimiters (`{a|xxx}`) only available in `formatter` field or also enabled in data?
I think we probably can not restrict the delimiters only available in `formatter` (consider formatter can be a function).
That is, if data contains `'{a|xxx}'`, it also should be recognized as rich text delimiters.
2. Should we provide escaping for rich text delimiters?
I think it should. And we should better provide a util method to escape delimiters in data.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.