From 0e8cf4987ebde29f49374d092d5e79cace272387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= <39538890+Skalakid@users.noreply.github.com> Date: Mon, 17 Feb 2025 01:17:25 -0800 Subject: [PATCH] Fix setting border radius on web in singleline mode (#617) --- src/MarkdownTextInputDecoratorViewNativeComponent.ts | 3 +++ src/web/utils/blockUtils.ts | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MarkdownTextInputDecoratorViewNativeComponent.ts b/src/MarkdownTextInputDecoratorViewNativeComponent.ts index 2ad81e44c..73d46cb5c 100644 --- a/src/MarkdownTextInputDecoratorViewNativeComponent.ts +++ b/src/MarkdownTextInputDecoratorViewNativeComponent.ts @@ -37,14 +37,17 @@ interface MarkdownStyle { mentionHere: { color: ColorValue; backgroundColor: ColorValue; + borderRadius?: Float; }; mentionUser: { color: ColorValue; backgroundColor: ColorValue; + borderRadius?: Float; }; mentionReport: { color: ColorValue; backgroundColor: ColorValue; + borderRadius?: Float; }; inlineImage: { minWidth: Float; diff --git a/src/web/utils/blockUtils.ts b/src/web/utils/blockUtils.ts index d0720d622..075ec12e5 100644 --- a/src/web/utils/blockUtils.ts +++ b/src/web/utils/blockUtils.ts @@ -82,9 +82,11 @@ function addStyleToBlock(targetElement: HTMLElement, type: NodeType, markdownSty }); break; case 'text': - if (!isMultiline) { - Object.assign(node.style, {backgroundColor: targetElement.parentElement?.style.backgroundColor}); - Object.assign(targetElement.parentElement?.style ?? {}, {backgroundColor: 'transparent'}); + if (!isMultiline && targetElement.parentElement?.style) { + // Move text background styles from parent to the text node + const parentElement = targetElement.parentElement; + node.style.cssText = parentElement.style.cssText; + parentElement.style.cssText = ''; } break; default: