diff --git a/packages/x6/src/registry/attr/text.ts b/packages/x6/src/registry/attr/text.ts index 9233a4cdc40..9fb33981a79 100644 --- a/packages/x6/src/registry/attr/text.ts +++ b/packages/x6/src/registry/attr/text.ts @@ -39,13 +39,13 @@ export const text: Attr.Definition = { const fontSize = (attrs['font-size'] || attrs.fontSize) as string const textHash = JSON.stringify([text, options]) + if (fontSize) { + elem.setAttribute('font-size', fontSize) + } + // Updates the text only if there was a change in the string // or any of its attributes. if (cache == null || cache !== textHash) { - if (fontSize) { - elem.setAttribute('font-size', fontSize) - } - // Text Along Path Selector const textPath = options.textPath as any if (textPath != null && typeof textPath === 'object') {