mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: max height of memo content compact mode
This commit is contained in:
@@ -8,7 +8,7 @@ interface Props extends BaseProps {
|
|||||||
|
|
||||||
const Blockquote: React.FC<Props> = ({ children }: Props) => {
|
const Blockquote: React.FC<Props> = ({ children }: Props) => {
|
||||||
return (
|
return (
|
||||||
<blockquote className="p-2 border-s-4 border-gray-300 bg-gray-50 dark:border-gray-500 dark:bg-zinc-700">
|
<blockquote className="p-2 border-s-4 rounded border-gray-300 bg-gray-50 dark:border-gray-500 dark:bg-zinc-700">
|
||||||
{children.map((child, index) => (
|
{children.map((child, index) => (
|
||||||
<Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />
|
<Renderer key={`${child.type}-${index}`} index={String(index)} node={child} />
|
||||||
))}
|
))}
|
||||||
|
@@ -40,7 +40,7 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
|
|||||||
return <MermaidBlock content={content} />;
|
return <MermaidBlock content={content} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlightedCode: string = useMemo(() => {
|
const highlightedCode = useMemo(() => {
|
||||||
try {
|
try {
|
||||||
const lang = hljs.getLanguage(formatedLanguage);
|
const lang = hljs.getLanguage(formatedLanguage);
|
||||||
if (lang) {
|
if (lang) {
|
||||||
@@ -52,7 +52,7 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
|
|||||||
// Skip error and use default highlighted code.
|
// Skip error and use default highlighted code.
|
||||||
}
|
}
|
||||||
|
|
||||||
// escape any HTML entities when rendering original content
|
// Escape any HTML entities when rendering original content.
|
||||||
return Object.assign(document.createElement("span"), {
|
return Object.assign(document.createElement("span"), {
|
||||||
textContent: content,
|
textContent: content,
|
||||||
}).innerHTML;
|
}).innerHTML;
|
||||||
|
@@ -80,7 +80,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
|||||||
ref={memoContentContainerRef}
|
ref={memoContentContainerRef}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"relative w-full max-w-full word-break text-base leading-snug space-y-2 whitespace-pre-wrap",
|
"relative w-full max-w-full word-break text-base leading-snug space-y-2 whitespace-pre-wrap",
|
||||||
showCompactMode && "line-clamp-6",
|
showCompactMode && "line-clamp-6 max-h-44",
|
||||||
contentClassName,
|
contentClassName,
|
||||||
)}
|
)}
|
||||||
onClick={handleMemoContentClick}
|
onClick={handleMemoContentClick}
|
||||||
@@ -91,7 +91,6 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
|||||||
skipNextLineBreakFlag = false;
|
skipNextLineBreakFlag = false;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevNode = node;
|
prevNode = node;
|
||||||
skipNextLineBreakFlag = true;
|
skipNextLineBreakFlag = true;
|
||||||
return <Renderer key={`${node.type}-${index}`} index={String(index)} node={node} />;
|
return <Renderer key={`${node.type}-${index}`} index={String(index)} node={node} />;
|
||||||
|
Reference in New Issue
Block a user