From e3f1f3e7db34907cde1b27034d5b1c1541987b1e Mon Sep 17 00:00:00 2001 From: Heesu Suh Date: Thu, 24 Oct 2024 00:59:49 +0900 Subject: [PATCH] use SyntaxHighlighterWrapper for mentionable preview --- .../chat-view/chat-input/ChatUserInput.tsx | 12 +++++++++++- styles.css | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/chat-view/chat-input/ChatUserInput.tsx b/src/components/chat-view/chat-input/ChatUserInput.tsx index 05dd9cb..12c309d 100644 --- a/src/components/chat-view/chat-input/ChatUserInput.tsx +++ b/src/components/chat-view/chat-input/ChatUserInput.tsx @@ -26,10 +26,12 @@ import { } from 'src/utils/mentionable' import { useApp } from '../../../contexts/app-context' +import { useDarkModeContext } from '../../../contexts/dark-mode-context' import { Mentionable, SerializedMentionable } from '../../../types/mentionable' import { fuzzySearch } from '../../../utils/fuzzy-search' import { getMentionableKey } from '../../../utils/mentionable' import { readTFileContent } from '../../../utils/obsidian' +import { MemoizedSyntaxHighlighterWrapper } from '../SyntaxHighlighterWrapper' import MentionableBadge from './MentionableBadge' import { ModelSelect } from './ModelSelect' @@ -76,6 +78,7 @@ const ChatUserInput = forwardRef( ref, ) => { const app = useApp() + const { isDarkMode } = useDarkModeContext() const editorRef = useRef(null) const contentEditableRef = useRef(null) @@ -309,7 +312,14 @@ const ChatUserInput = forwardRef( {fileContent && (
- {fileContent} + + {fileContent} +
)} diff --git a/styles.css b/styles.css index e9745b9..2dfcac8 100644 --- a/styles.css +++ b/styles.css @@ -304,8 +304,7 @@ button:not(.clickable-icon).smtcmp-chat-list-dropdown { background-color: var(--background-primary); border-radius: var(--radius-s); border: 1px solid var(--background-modifier-border); - padding: var(--size-4-2); - max-height: 400px; + max-height: 350px; overflow-y: auto; white-space: pre-line; }