Просмотр исходного кода

update is highlighted by elasticsearch

ryoji-s 3 лет назад
Родитель
Сommit
27a47db638
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      packages/app/src/components/ReactMarkdownComponents/CodeBlock.tsx

+ 2 - 1
packages/app/src/components/ReactMarkdownComponents/CodeBlock.tsx

@@ -9,7 +9,8 @@ import styles from './CodeBlock.module.scss';
 export const CodeBlock: CodeComponent = ({ inline, className, children }) => {
 
   const isHighlightedByElasticsearch = useMemo((): boolean => {
-    return !(children.every(item => typeof item === 'string') && children.length === 1);
+    const hasOnlyOneStringChild = children.length === 1 && typeof children[0] === 'string';
+    return !hasOnlyOneStringChild;
   }, [children]);
 
   if (inline) {