From eea4453d2994d0449515254309a84dfb5fdc6409 Mon Sep 17 00:00:00 2001 From: shadow2kk Date: Thu, 4 May 2023 11:22:08 +0800 Subject: [PATCH 1/3] fix: the code block overflow container --- apps/community/src/components/Editor/Content.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/community/src/components/Editor/Content.tsx b/apps/community/src/components/Editor/Content.tsx index c242bae1..12202964 100644 --- a/apps/community/src/components/Editor/Content.tsx +++ b/apps/community/src/components/Editor/Content.tsx @@ -40,6 +40,10 @@ img { margin: 0 auto; } +pre { + white-space: pre-wrap; +} + ` export const Content = forwardRef( From e4f32a968916f786518e529e79b763bb900a9dcf Mon Sep 17 00:00:00 2001 From: shadow2kk Date: Thu, 4 May 2023 11:42:29 +0800 Subject: [PATCH 2/3] style: add code style --- apps/app/components/Preview/parser.tsx | 11 +++++++++++ apps/community/src/components/Editor/Content.tsx | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/apps/app/components/Preview/parser.tsx b/apps/app/components/Preview/parser.tsx index cd898421..80e277ff 100644 --- a/apps/app/components/Preview/parser.tsx +++ b/apps/app/components/Preview/parser.tsx @@ -72,6 +72,17 @@ const shadowRootStyle = ` p:empty::after { content: "\\00A0"; } + + pre { + white-space: pre-wrap; + } + + code { + display: block; + background: #EBEBEB; + padding: 18px; + font-size: 14px; + } ` export const RenderHTML: React.FC = ({ diff --git a/apps/community/src/components/Editor/Content.tsx b/apps/community/src/components/Editor/Content.tsx index 12202964..13488135 100644 --- a/apps/community/src/components/Editor/Content.tsx +++ b/apps/community/src/components/Editor/Content.tsx @@ -44,6 +44,13 @@ pre { white-space: pre-wrap; } +code { + display: block; + background: #EBEBEB; + padding: 18px; + font-size: 14px; +} + ` export const Content = forwardRef( From d33578b0fa1cdd415f49ea29369aeb464ef5da7f Mon Sep 17 00:00:00 2001 From: shadow2kk Date: Sat, 6 May 2023 15:20:38 +0800 Subject: [PATCH 3/3] fix: inline code style --- apps/app/components/Preview/parser.tsx | 9 +++++++-- apps/community/src/components/Editor/Content.tsx | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/app/components/Preview/parser.tsx b/apps/app/components/Preview/parser.tsx index 80e277ff..8fd307e9 100644 --- a/apps/app/components/Preview/parser.tsx +++ b/apps/app/components/Preview/parser.tsx @@ -73,15 +73,20 @@ const shadowRootStyle = ` content: "\\00A0"; } + pre { white-space: pre-wrap; } code { - display: block; background: #EBEBEB; - padding: 18px; font-size: 14px; + padding: 5px; + } + + pre code { + display: block; + padding: 18px; } ` diff --git a/apps/community/src/components/Editor/Content.tsx b/apps/community/src/components/Editor/Content.tsx index 13488135..e0dc8a90 100644 --- a/apps/community/src/components/Editor/Content.tsx +++ b/apps/community/src/components/Editor/Content.tsx @@ -45,10 +45,14 @@ pre { } code { - display: block; background: #EBEBEB; - padding: 18px; font-size: 14px; + padding: 5px; +} + +pre code { + display: block; + padding: 18px; } `