Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fix(pubcontent): render soft-line break + editor inline code styles
Browse files Browse the repository at this point in the history
  • Loading branch information
horacioh committed Nov 1, 2023
1 parent ffc22ad commit 061110a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
10 changes: 10 additions & 0 deletions frontend/packages/editor/src/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,13 @@
[data-list-type='ol'] .node-blockContainer {
display: list-item;
}

.editor code {
background-color: var(--color4);
font-family: 'ui-monospace', 'SFMono-Regular', 'SF Mono', Menlo, Consolas,
'Liberation Mono', monospace;
overflow: hidden;
font-size: 0.8em;
line-height: 1.5;
padding: 2px var(--space-7);
}
25 changes: 22 additions & 3 deletions frontend/packages/shared/src/publication-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,27 @@ function InlineContentView({
textDecorationLine = 'line-through'
}

let children: any = content.text
// TODO: fix this hack to render soft-line breaks
let children: any = content.text.split('\n')

if (children.length > 1) {
children = children.map(
(l: string, i: number, a: Array<string>) => {
if (a.length == i - 1) {
return l
} else {
return (
<>
{l}
<br />
</>
)
}
},
)
} else {
children = content.text
}

if (content.styles.bold) {
children = (
Expand All @@ -807,8 +827,7 @@ function InlineContentView({
if (content.styles.code) {
children = (
<Text
backgroundColor="$backgroundFocus"
// bg="red"
backgroundColor="$color4"
fontFamily="$mono"
tag="code"
borderRadius="$2"
Expand Down

0 comments on commit 061110a

Please sign in to comment.