Skip to content

Commit

Permalink
fix: Add larger paddings to multi <p> in msg.
Browse files Browse the repository at this point in the history
fix: Fix children number checking criteria in text processor.
  • Loading branch information
nfnfgo committed Oct 20, 2024
1 parent 8ff00b7 commit bc3403c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/render/msgpiece_processor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ const textElementProcessor: FragmentProcessFunc = (parent, element, index) => {

// remove unnecessary wrapping <p> if there is only one element
let renderedHtmlElement = (new DOMParser).parseFromString(renderedMarkdownInnerHtml, 'text/html');
mditLogger('debug', 'renderedHtmlElement.children.length==1', renderedHtmlElement.children.length == 1);
mditLogger('debug', 'renderedHtmlElement.body.children.length==1', renderedHtmlElement.body.children.length == 1);
mditLogger('debug', 'renderedMarkdownInnerHtml.startsWith(p)', renderedMarkdownInnerHtml.startsWith('<p>'));
mditLogger('debug', 'renderedMarkdownInnerHtml.endsWith(p)', renderedMarkdownInnerHtml.endsWith('</p>'));
if ((renderedHtmlElement.children.length == 1)
if ((renderedHtmlElement.body.children.length == 1)
&& renderedMarkdownInnerHtml.startsWith('<p>')
&& renderedMarkdownInnerHtml.endsWith('</p>')) {
renderedMarkdownInnerHtml =
Expand Down
31 changes: 18 additions & 13 deletions src/style/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ em {
font-style: italic;
}

span > p > img {
span>p>img {
max-width: 100%;
height: auto;
}
Expand All @@ -116,8 +116,8 @@ div.katex-block-rendered {
}

/* language and copy button style */
pre.hl-code-block > button.lang_copy,
div.katex-block-rendered > button.copy_latex {
pre.hl-code-block>button.lang_copy,
div.katex-block-rendered>button.copy_latex {
z-index: 10;
position: absolute;
right: 2px;
Expand All @@ -134,40 +134,40 @@ div.katex-block-rendered > button.copy_latex {
transition-duration: 20ms;
}

pre.hl-code-block > button.lang_copy:active,
div.katex-block-rendered > button.copy_latex:active {
pre.hl-code-block>button.lang_copy:active,
div.katex-block-rendered>button.copy_latex:active {
transform: scale(0.85);
}


@media (prefers-color-scheme: light) {

pre.hl-code-block > button.lang_copy,
div.katex-block-rendered > button.copy_latex {
pre.hl-code-block>button.lang_copy,
div.katex-block-rendered>button.copy_latex {
background-color: rgba(255, 255, 255, 0.5);
color: black;
}
}

@media (prefers-color-scheme: dark) {

pre.hl-code-block > button.lang_copy,
div.katex-block-rendered > button.copy_latex {
pre.hl-code-block>button.lang_copy,
div.katex-block-rendered>button.copy_latex {
background-color: rgba(0, 0, 0, 0.5);
color: white;
}
}

pre.hl-code-block:not(:hover) > button.lang_copy,
div.katex-block-rendered:not(:hover) > button.copy_latex {
pre.hl-code-block:not(:hover)>button.lang_copy,
div.katex-block-rendered:not(:hover)>button.copy_latex {
display: none;
}

pre.hl-code-block > button.lang_copy:hover > p.lang {
pre.hl-code-block>button.lang_copy:hover>p.lang {
display: none;
}

pre.hl-code-block > button.lang_copy:not(:hover) > p.copy {
pre.hl-code-block>button.lang_copy:not(:hover)>p.copy {
display: none;
}

Expand All @@ -177,6 +177,11 @@ pre.hl-code-block > button.lang_copy:not(:hover) > p.copy {
flex-direction: row;
} */


.mix-message__inner>.text-element>p+p {
padding-top: 14px;
}

.lite-tools-slot.embed-slot {
flex: none;
}
Expand Down

0 comments on commit bc3403c

Please sign in to comment.