Преглед изворни кода

Merge pull request #5414 from weseek/fix/89163-do-not-highlight-pages-with-empty-body

fix: 89163 Do not highlight empty body pages in search results.
cao пре 4 година
родитељ
комит
dca38eb8e1
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      packages/app/src/components/Page/RevisionRenderer.jsx

+ 2 - 1
packages/app/src/components/Page/RevisionRenderer.jsx

@@ -143,7 +143,8 @@ class LegacyRevisionRenderer extends React.PureComponent {
     await interceptorManager.process('prePostProcess', context);
     await interceptorManager.process('prePostProcess', context);
     context.parsedHTML = growiRenderer.postProcess(context.parsedHTML);
     context.parsedHTML = growiRenderer.postProcess(context.parsedHTML);
 
 
-    if (highlightKeywords != null && highlightKeywords.length > 0) {
+    const isMarkdownEmpty = context.markdown.trim().length === 0;
+    if (highlightKeywords != null && highlightKeywords === '' && !isMarkdownEmpty) {
       context.parsedHTML = this.getHighlightedBody(context.parsedHTML, highlightKeywords);
       context.parsedHTML = this.getHighlightedBody(context.parsedHTML, highlightKeywords);
     }
     }
     await interceptorManager.process('postPostProcess', context);
     await interceptorManager.process('postPostProcess', context);