Skip to content

Commit 2204b1a

Browse files
committed
fix(label): support global richInheritPlainLabel option
1 parent a1c4c3f commit 2204b1a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/label/labelStyle.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,18 @@ function setTextStyleCommon(
395395
let richResult: TextStyleProps['rich'];
396396
if (richItemNames) {
397397
richResult = {};
398-
const richInheritPlainLabel = textStyleModel.get('richInheritPlainLabel') !== false;
398+
const richInheritPlainLabelOptionName = 'richInheritPlainLabel' as const;
399+
const richInheritPlainLabel = retrieve2(
400+
textStyleModel.get(richInheritPlainLabelOptionName),
401+
ecModel && ecModel.get(richInheritPlainLabelOptionName)
402+
);
399403
for (const name in richItemNames) {
400404
if (richItemNames.hasOwnProperty(name)) {
401405
// Cascade is supported in rich.
402-
const richTextStyle = textStyleModel.getModel(['rich', name], richInheritPlainLabel && textStyleModel);
406+
const richTextStyle = textStyleModel.getModel(
407+
['rich', name],
408+
richInheritPlainLabel !== false ? textStyleModel : void 0
409+
);
403410
// In rich, never `disableBox`.
404411
// consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,
405412
// the default color `'blue'` will not be adopted if no color declared in `rich`.

test/rich-inherit-plain-label.html

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)